[llvm] [InstSimplify] Simplify `select cond, undef, val` to `val` if `val = poison` implies `cond = poison` (PR #76465)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 01:04:27 PST 2023


================
@@ -4858,13 +4858,15 @@ static Value *simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
   // select ?, undef,  X -> X
   if (isa<PoisonValue>(TrueVal) ||
       (Q.isUndefValue(TrueVal) &&
-       isGuaranteedNotToBePoison(FalseVal, Q.AC, Q.CxtI, Q.DT)))
+       (isGuaranteedNotToBePoison(FalseVal, Q.AC, Q.CxtI, Q.DT) ||
----------------
nikic wrote:

Can you drop the isGuaranteedNotToBePoison call? Or does the loss of context-sensitivity cause regressions?

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


More information about the llvm-commits mailing list