[llvm] r293508 - [InstCombine] use auto with obvious type; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:38:55 PST 2017


Author: spatel
Date: Mon Jan 30 11:38:55 2017
New Revision: 293508

URL: http://llvm.org/viewvc/llvm-project?rev=293508&view=rev
Log:
[InstCombine] use auto with obvious type; NFC

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp?rev=293508&r1=293507&r2=293508&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineShifts.cpp Mon Jan 30 11:38:55 2017
@@ -678,7 +678,7 @@ Instruction *InstCombiner::visitShl(Bina
       // 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(Bin
         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(Bin
         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;
     }




More information about the llvm-commits mailing list