Skip to content

Commit

Permalink
[InstCombine][NFC]Use only replaceInstUsesWith, NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-bataev committed Jul 8, 2021
1 parent 82563d8 commit 8af6997
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1905,10 +1905,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
unsigned IdxN = cast<ConstantInt>(Idx)->getZExtValue();

// An insert that entirely overwrites Vec with SubVec is a nop.
if (VecNumElts == SubVecNumElts) {
replaceInstUsesWith(CI, SubVec);
return eraseInstFromFunction(CI);
}
if (VecNumElts == SubVecNumElts)
return replaceInstUsesWith(CI, SubVec);

// Widen SubVec into a vector of the same width as Vec, since
// shufflevector requires the two input vectors to be the same width.
Expand All @@ -1932,8 +1930,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
Mask.push_back(i);

Value *Shuffle = Builder.CreateShuffleVector(Vec, WidenShuffle, Mask);
replaceInstUsesWith(CI, Shuffle);
return eraseInstFromFunction(CI);
return replaceInstUsesWith(CI, Shuffle);
}
break;
}
Expand Down Expand Up @@ -1962,8 +1959,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
Mask.push_back(IdxN + i);

Value *Shuffle = Builder.CreateShuffleVector(Vec, Mask);
replaceInstUsesWith(CI, Shuffle);
return eraseInstFromFunction(CI);
return replaceInstUsesWith(CI, Shuffle);
}
break;
}
Expand All @@ -1990,8 +1986,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
"Expected or reduction.");
Res = Builder.CreateIsNotNull(Res);
}
replaceInstUsesWith(CI, Res);
return eraseInstFromFunction(CI);
return replaceInstUsesWith(CI, Res);
}
LLVM_FALLTHROUGH;
}
Expand All @@ -2016,8 +2011,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
if (Arg != Vect &&
cast<Instruction>(Arg)->getOpcode() == Instruction::SExt)
Res = Builder.CreateNeg(Res);
replaceInstUsesWith(CI, Res);
return eraseInstFromFunction(CI);
return replaceInstUsesWith(CI, Res);;
}
}
}
Expand Down

0 comments on commit 8af6997

Please sign in to comment.