From d90f5f6698557d5d3799e710e5c7b38321f255f3 Mon Sep 17 00:00:00 2001 From: Amaury Sechet Date: Tue, 24 Jan 2017 17:48:25 +0000 Subject: [PATCH] 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 llvm-svn: 292957 --- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index a889a6702750..b5718c3a9e0b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -395,13 +395,12 @@ static Value *foldSelectCttzCtlz(ICmpInst *ICI, Value *TrueVal, Value *FalseVal, if (match(Count, m_Intrinsic(m_Specific(CmpLHS))) || match(Count, m_Intrinsic(m_Specific(CmpLHS)))) { IntrinsicInst *II = cast(Count); - IRBuilder<> Builder(II); // Explicitly clear the 'undef_on_zero' flag. IntrinsicInst *NewI = cast(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;