This is generally done by the InstCombine, but can be emitted as an
intermediate step and is cheap to handle.
Details
Details
- Reviewers
RKSimon pengfei - Commits
- rGd4b24b4a5582: [DAGCombiner] Add fold for `~x & x` -> `0`
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Did you look at performing this inside SimplifyDemandedBits instead?
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6630 | Use isBitwiseNot / getBitwiseNotOperand ? |
Comment Actions
Just took a look. Seems to me SimplifyDemandedBits is not really the place to check for patterns between operands, but could move there if you prefer
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6630 | Made new helper that uses isBitwiseNot. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6630 | Also change for the add patch. |
Don't bother with the helper - just inline the check.