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
Unit Tests
Unit Tests
Time | Test | |
---|---|---|
60,070 ms | x64 debian > lit.lit::max-failures.py |
Event Timeline
Comment Actions
Did you look at performing this inside SimplifyDemandedBits instead?
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6636 | 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 | ||
---|---|---|
6636 | Made new helper that uses isBitwiseNot. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6636 | Also change for the add patch. |
Don't bother with the helper - just inline the check.