]> granicus.if.org Git - llvm/commitdiff
Use InstCombine's builder in foldSelectCttzCtlz instead of creating a new one.
authorAmaury Sechet <deadalnix@gmail.com>
Tue, 24 Jan 2017 17:48:25 +0000 (17:48 +0000)
committerAmaury Sechet <deadalnix@gmail.com>
Tue, 24 Jan 2017 17:48:25 +0000 (17:48 +0000)
Summary: As per title. This will add the instructiions we are interested in in the worklist.

Reviewers: mehdi_amini, majnemer, andreadb

Differential Revision: https://reviews.llvm.org/D29081

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292957 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineSelect.cpp

index a889a67027503475d41f2e151efe741799dc0cf4..b5718c3a9e0b0bb34956217d386f59b7bb5f8311 100644 (file)
@@ -395,13 +395,12 @@ static Value *foldSelectCttzCtlz(ICmpInst *ICI, Value *TrueVal, Value *FalseVal,
   if (match(Count, m_Intrinsic<Intrinsic::cttz>(m_Specific(CmpLHS))) ||
       match(Count, m_Intrinsic<Intrinsic::ctlz>(m_Specific(CmpLHS)))) {
     IntrinsicInst *II = cast<IntrinsicInst>(Count);
-    IRBuilder<> Builder(II);
     // Explicitly clear the 'undef_on_zero' flag.
     IntrinsicInst *NewI = cast<IntrinsicInst>(II->clone());
     Type *Ty = NewI->getArgOperand(1)->getType();
     NewI->setArgOperand(1, Constant::getNullValue(Ty));
-    Builder.Insert(NewI);
-    return Builder.CreateZExtOrTrunc(NewI, ValueOnZero->getType());
+    Builder->Insert(NewI);
+    return Builder->CreateZExtOrTrunc(NewI, ValueOnZero->getType());
   }
 
   return nullptr;