Skip to content

Commit

Permalink
Change IRBuilder to the one in the scope (llvm#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
khagankhan authored Sep 10, 2024
1 parent 4e427eb commit a0cdc6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5338,7 +5338,6 @@ Instruction* cs6475_optimizer(Instruction *I, InstCombinerImpl &IC, LazyValueInf
Value *Y = nullptr;
Value *LHS = nullptr;
Value *RHS = nullptr;
IRBuilder<> Builder(I);
// X - Y + Y * C = X + Y * (C - 1)
if (match(I, m_c_Add(m_Value(LHS), m_Value(RHS)))) {
// cs6475_debug("KK: matched the 'add'\n");
Expand All @@ -5347,8 +5346,8 @@ Instruction* cs6475_optimizer(Instruction *I, InstCombinerImpl &IC, LazyValueInf
// cs6475_debug("KK: matched the 'sub'\n");
// cs6475_debug("KK: matched the 'mul'\n");
log_optzn("Khagan Karimov");
Value *NewMul = Builder.CreateMul(
Y, Builder.CreateSub(C, ConstantInt::get(C->getType(), 1)));
Value *NewMul = IC.Builder.CreateMul(
Y, IC.Builder.CreateSub(C, ConstantInt::get(C->getType(), 1)));
Instruction *NewAdd = BinaryOperator::CreateAdd(X, NewMul);
return NewAdd;
}
Expand Down

0 comments on commit a0cdc6f

Please sign in to comment.