[llvm] [DAGCombiner] Freeze maybe poison operands when folding select to logic (PR #84924)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 05:10:58 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))
----------------
RKSimon wrote:
getNode(ISD::FREEZE) should do this for us?
https://github.com/llvm/llvm-project/blob/02cb89b36a7ae9be4ab657306b69dc9d2830d0d5/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L5718-L5723
https://github.com/llvm/llvm-project/pull/84924
More information about the llvm-commits
mailing list