[llvm] r292957 - Use InstCombine's builder in foldSelectCttzCtlz instead of creating a new one.
Amaury Sechet via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 24 09:48:26 PST 2017
Author: deadalnix
Date: Tue Jan 24 11:48:25 2017
New Revision: 292957
URL: http://llvm.org/viewvc/llvm-project?rev=292957&view=rev
Log:
Use InstCombine's builder in foldSelectCttzCtlz instead of creating a new one.
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
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp?rev=292957&r1=292956&r2=292957&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp Tue Jan 24 11:48:25 2017
@@ -395,13 +395,12 @@ static Value *foldSelectCttzCtlz(ICmpIns
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;
More information about the llvm-commits
mailing list