mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-28 18:54:55 +00:00
[InstCombine] Fix worklist management in varargs transform
Add a replaceUse() helper to mirror replaceOperand() for the rare cases where we're working directly on uses. NFC apart from worklist order changes.
This commit is contained in:
parent
6f07a9e80a
commit
28f67bd5c5
@ -4573,7 +4573,7 @@ Instruction *InstCombiner::visitCallBase(CallBase &Call) {
|
||||
I != E; ++I, ++ix) {
|
||||
CastInst *CI = dyn_cast<CastInst>(*I);
|
||||
if (CI && isSafeToEliminateVarargsCast(Call, DL, CI, ix)) {
|
||||
*I = CI->getOperand(0);
|
||||
replaceUse(*I, CI->getOperand(0));
|
||||
|
||||
// Update the byval type to match the argument type.
|
||||
if (Call.isByValArgument(ix)) {
|
||||
|
@ -686,6 +686,12 @@ public:
|
||||
return &I;
|
||||
}
|
||||
|
||||
/// Replace use and add the previously used value to the worklist.
|
||||
void replaceUse(Use &U, Value *NewValue) {
|
||||
Worklist.addValue(U);
|
||||
U = NewValue;
|
||||
}
|
||||
|
||||
/// Creates a result tuple for an overflow intrinsic \p II with a given
|
||||
/// \p Result and a constant \p Overflow value.
|
||||
Instruction *CreateOverflowTuple(IntrinsicInst *II, Value *Result,
|
||||
|
@ -87,9 +87,7 @@ bool InstCombiner::SimplifyDemandedBits(Instruction *I, unsigned OpNo,
|
||||
Value *NewVal = SimplifyDemandedUseBits(U.get(), DemandedMask, Known,
|
||||
Depth, I);
|
||||
if (!NewVal) return false;
|
||||
// Add the old operand back to the worklist.
|
||||
Worklist.addValue(U.get());
|
||||
U = NewVal;
|
||||
replaceUse(U, NewVal);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user