Don't simplify XOR to AND whenever we can, because it's not clear
(to me) that it's simpler.
Instead simplify:
(X | C) ^ C -> X & ~C (X & ~C) ^ C -> X | C
These are clearly better because they remove one operation.
Paths
| Differential D87465
[TargetLowering] Change SimplifyDemandedBits for XOR AbandonedPublic Authored by foad on Sep 10 2020, 9:21 AM.
Details
Summary Don't simplify XOR to AND whenever we can, because it's not clear Instead simplify: (X | C) ^ C -> X & ~C (X & ~C) ^ C -> X | C These are clearly better because they remove one operation.
Diff Detail
Event Timelinefoad added a parent revision: D87464: [TargetLowering] Improve SimplifyDemandedBits for AND and OR.Sep 10 2020, 9:21 AM
Comment Actions This seems to lack description/motivation/test cases. Comment Actions
The original motivation was here: https://reviews.llvm.org/D87145?id=289963#inline-807379 But that problem was fixed in other ways, so I'll give up on this now.
Revision Contents
Diff 290999 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/2012-08-07-CmpISelBug.ll
|
ISD::AND ?