[llvm] [InstCombine] Do not use operand info in `replaceInInstruction` (PR #99492)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 07:53:16 PDT 2024


================
@@ -1247,8 +1247,11 @@ bool InstCombinerImpl::replaceInInstruction(Value *V, Value *Old, Value *New,
   if (Depth == 2)
     return false;
 
+  assert(!isa<Constant>(Old) && "Only replace non-constant values");
+
   auto *I = dyn_cast<Instruction>(V);
-  if (!I || !I->hasOneUse() || !isSafeToSpeculativelyExecute(I))
+  if (!I || !I->hasOneUse() ||
+      !isSafeToSpeculativelyExecuteWithOperandsReplaced(I))
----------------
dtcxzyw wrote:

```suggestion
      !isSafeToSpeculativelyExecuteWithVariableReplaced(I))
```

https://github.com/llvm/llvm-project/pull/99492


More information about the llvm-commits mailing list