[llvm] [DAGCombiner] Fix ReplaceAllUsesOfValueWith mutation bug in visitFREEZE (PR #104924)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 08:12:46 PDT 2024


================
@@ -15826,7 +15829,18 @@ SDValue DAGCombiner::visitFREEZE(SDNode *N) {
   // it could create undef or poison due to it's poison-generating flags.
   // So not finding any maybe-poison operands is fine.
 
-  for (SDValue MaybePoisonOperand : MaybePoisonOperands) {
+  for (unsigned OpNo : MaybePoisonOperandNumbers) {
+    // N0 can mutate during iteration, so make sure to refech the maybe poison
----------------
dtcxzyw wrote:

```suggestion
    // N0 can mutate during iteration, so make sure to refetch the maybe poison
```

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


More information about the llvm-commits mailing list