[PATCH] D122070: [SDAG] enable binop identity constant folds for shifts
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 19 08:59:12 PDT 2022
RKSimon added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2167
+ case ISD::SRA: // X s>> 0 --> X
+ case ISD::SRL: // X u>> 0 --> X
return C->isZero();
----------------
pengfei wrote:
> Can it apply to ROTL/ROTR ?
Yes, we'd have to account for the implicit modulo though.
There's plenty of other ops we could attempt with this as well, including some non-binops (funnel shifts and fma for instance) - I'm also wondering what target binops will need to be supported.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122070/new/
https://reviews.llvm.org/D122070
More information about the llvm-commits
mailing list