[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
Sun Jul 31 18:37:39 PDT 2022
xiangzhangllvm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5583
+ BV2->getConstantRawBits(IsLE, EltBits, RawBits2, UndefElts2)) {
+ // Handle constant folding with UNDEF. TODO: Handle more cases.
+ auto FoldValueWithUndef = [](unsigned Opcode, const APInt &C1,
----------------
Maybe better to add a small case here, some like
"old nodes" --> "new nodes"
================
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)
----------------
Do we need to make sure the C1 C2 has no other uses ?
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