[PATCH] D130839: [DAG] FoldConstantArithmetic - add initial support for undef elements in bitcasted binop constant folding
Xiang Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 18:04:40 PDT 2022
xiangzhangllvm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5589
+ if (!(IsUndef1 || IsUndef2))
+ Fold = FoldValue(Opcode, C1, C2);
+ else if (Opcode == ISD::AND || Opcode == ISD::MUL)
----------------
RKSimon wrote:
> xiangzhangllvm wrote:
> > Do we need to make sure the C1 C2 has no other uses ?
> I don't think we have any one use limits on constant folding?
Yes, sorry my mistake at first.
take following case for example:
```
A = and(x, undef)
C = A op B
```
If we directly let "A = 0" (I think A=undef before), seems it may break the undef propagation in other use. for example C when "op" can do undef propagation (but not constant zero propagation).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130839/new/
https://reviews.llvm.org/D130839
More information about the llvm-commits
mailing list