[PATCH] D136472: [DAGCombiner][RISCV] Make foldBinOpIntoSelect work correctly with opaque constants.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 21 14:07:45 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2288
+ if (BinOpcode == ISD::AND && isNullOrNullSplat(CT))
+ NewCT = DAG.getConstant(0, DL, VT);
+ else if (BinOpcode == ISD::OR && isAllOnesOrAllOnesSplat(CT))
----------------
craig.topper wrote:
> spatel wrote:
> > Add a note here or to the text above to explain that we don't re-use an opaque 0/1 because that could inf-loop.
> The 0/-1 weren’t opaque. I was just being paranoid about using 0/-1 that might be mixed with undef. Do I need to worry about that here?
Ah, I misunderstood how this was looping.
Still worth a note that we're creating 0/-1 directly here rather than relying on getNode because CBO could be opaque?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136472/new/
https://reviews.llvm.org/D136472
More information about the llvm-commits
mailing list