[llvm] [SCEV] Retain SCEVSequentialMinMaxExpr if an operand may trigger UB. (PR #110824)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 02:40:07 PDT 2024


================
@@ -7299,6 +7309,11 @@ bool ScalarEvolution::isGuaranteedToTransferExecutionTo(const Instruction *A,
   return false;
 }
 
+bool ScalarEvolution::isGuaranteedNotToBePoison(const SCEV *Op) {
+  SCEVPoisonCollector PC(/* LookThroughMaybePoisonBlocking */ false);
----------------
nikic wrote:

```suggestion
  SCEVPoisonCollector PC(/* LookThroughMaybePoisonBlocking */ true);
```
I think? If we have `%a umin_seq %b` where `%b` may be poison, the whole expression may be poison (if `%a != 0`).

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


More information about the llvm-commits mailing list