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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 05:13:06 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) ||
----------------
dtcxzyw wrote:

I think it is safe to drop the call. Loss of context-sensitivity doesn't cause regressions (in both llvm regression tests and my benchmark).



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


More information about the llvm-commits mailing list