]> granicus.if.org Git - llvm/commitdiff
[InstCombine] use auto with obvious type; NFC
authorSanjay Patel <spatel@rotateright.com>
Mon, 30 Jan 2017 17:38:55 +0000 (17:38 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 30 Jan 2017 17:38:55 +0000 (17:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293508 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineShifts.cpp

index 5c86c3e28db1c62c1ef2cc4a0ceccdddd103dcb0..fb90814b6ecc451dc29054d2a52f3b30eb1afb0c 100644 (file)
@@ -678,7 +678,7 @@ Instruction *InstCombiner::visitShl(BinaryOperator &I) {
       // The inexact version is deferred to DAGCombine, so we don't hide shl
       // behind a bit mask.
       Constant *ShiftDiffCst = ConstantInt::get(Ty, *ShAmtAPInt - *ShrAmt);
-      auto *NewShl = BinaryOperator::Create(Instruction::Shl, X, ShiftDiffCst);
+      auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiffCst);
       NewShl->setHasNoUnsignedWrap(I.hasNoUnsignedWrap());
       NewShl->setHasNoSignedWrap(I.hasNoSignedWrap());
       return NewShl;
@@ -751,7 +751,7 @@ Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
         Constant *ShiftDiff = ConstantInt::get(Ty, ShAmt - ShlAmt);
         if (cast<BinaryOperator>(Op0)->hasNoUnsignedWrap()) {
           // (X <<nuw C1) >>u C2 --> X >>u (C2 - C1)
-          BinaryOperator *NewLShr = BinaryOperator::CreateLShr(X, ShiftDiff);
+          auto *NewLShr = BinaryOperator::CreateLShr(X, ShiftDiff);
           NewLShr->setIsExact(I.isExact());
           return NewLShr;
         }
@@ -804,7 +804,7 @@ Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
         ShlAmtAPInt->ult(*ShAmtAPInt)) {
       // (X <<nsw C1) >>s C2 --> X >>s (C2 - C1)
       Constant *ShiftDiff = ConstantInt::get(Ty, *ShAmtAPInt - *ShlAmtAPInt);
-      BinaryOperator *NewAShr = BinaryOperator::CreateAShr(X, ShiftDiff);
+      auto *NewAShr = BinaryOperator::CreateAShr(X, ShiftDiff);
       NewAShr->setIsExact(I.isExact());
       return NewAShr;
     }