or (xor x, y), x --> or x, y
or (xor x, y), y --> or x, y
or (xor x, y), (and x, y) --> or x, y
or (xor x, y), (or x, y) --> or x, y
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Does instcombine do this at the IR level? Is there a need to do it in selectiondag too?
Yeah, instsimplify do this. But I find some corner cases in selectiondag can trigger this code because of some logical op generated by SelectionDAG itself. So, I add all similar code in this change.
llvm/test/CodeGen/X86/combine-sra-load.ll | ||
---|---|---|
101 | This test probably needs adjusting so the multiple uses of %shift remains. |
add a test to amdgpu for or (xor x, y), x --> or x, y
adjust test sra_to_sextload_multiple_sra_uses
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
7008–7009 | Should we also handle the commuted forms of the OR? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
7008–7009 | We already handle these case. This code is in the function visitORCommutative. It will call twice with (N0, N1) and (N1, N0). |
Should we also handle the commuted forms of the OR?
or x, (xor x, y)
or (x and/or y), (xor x, y)