[llvm] [DAGCombiner] Freeze maybe poison operands when folding select to logic (PR #84924)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 06:18:29 PDT 2024


================
@@ -11307,28 +11307,34 @@ static SDValue foldBoolSelectToLogic(SDNode *N, SelectionDAG &DAG) {
   if (VT != Cond.getValueType() || VT.getScalarSizeInBits() != 1)
     return SDValue();
 
-  // select Cond, Cond, F --> or Cond, F
-  // select Cond, 1, F    --> or Cond, F
+  auto FreezeIfNeeded = [&](SDValue V) {
+    if (!DAG.isGuaranteedNotToBePoison(V))
----------------
dtcxzyw wrote:

Do we have a plan to implement `impliesPoison` for `SDAG`?


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


More information about the llvm-commits mailing list