[PATCH] D119654: [SDAG] enable binop identity constant folds for add/sub
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 13 07:21:36 PST 2022
LuoYuanke added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3333
+ if (N0->getOpcode() == ISD::FREEZE && N0.hasOneUse())
+ N0 = N0->getOperand(0);
----------------
xbolva00 wrote:
> Some general solution? FREEZE should be dropped much sooner, no?
It is not dropped soon, because compiler can't guarantee it is NOT undef or poison value.
```
13469 SDValue DAGCombiner::visitFREEZE(SDNode *N) {
13470 SDValue N0 = N->getOperand(0);
13471
13472 if (DAG.isGuaranteedNotToBeUndefOrPoison(N0, /*PoisonOnly*/ false))
13473 return N0;
13474
13475 return SDValue();
13476 }
```
The freeze node live until instruction selection.
```
ISEL: Starting selection on root node: t40: v4i32 = freeze t2
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119654/new/
https://reviews.llvm.org/D119654
More information about the llvm-commits
mailing list