Currently we only fold with ConstantInt RHS. This generalizes to any Constant RHS.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Can you add or change the bitwise logic tests to not have splat constants? That should allow us to expose the difference in a regression test (SimplifyDemanded doesn't handle non-splat afaik).
Also, for the bitwise logic tests, please add tests with a phi op, so we have some coverage for that part.
And actually, that makes the add/sub part of this seem suspicious and probably worth splitting into a separate patch. I think those cases should be calling foldOpWithConstantIntoOperand() to cover both selects and phis.
Comment Actions
LGTM. It would be nice to hoist transforms that are common to all of the bitwise logic ops into a shared helper as an NFC follow-up, so we're not duplicating code. We have something like that for the shift instructions.