Diff Detail
Unit Tests
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | We also want to do this if x is divergent and y is uniform. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | If x is divergent and y is uniform, we can transform to So I believe in DAGCombiner we only need to enable it when the divergency property is the same. |
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll | ||
---|---|---|
57–58 ↗ | (On Diff #515119) | I think the scalar instruction + vop2 instruction should save power compare to v_xad_u32. Especially the xor value is -1. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | The rules we implement in DAGCombiner should make sense without having to understand exactly what any particular target can do. The original rule here was "pull constants out of nested adds/subs". The new rule is "pull constants out of nested adds/subs, unless that increases the number of divergent nodes in the dag". |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | Yeah, the rule is correct. But it means (N0->isDivergent() == N1->isDivergent()) not (N0->isDivergent() || !N1->isDivergent()) I think. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | These reassociations only increase the number of divergent nodes in one case: when x is uniform and y is divergent. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | There are 3 operators, 1 operator is uniform, 1 is divergency, 1 is constant, we can always do (uniform op constant) op divergency. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | If you use N0->isDivergent() == N1->isDivergent() then this target independent code will not transform: (divergent op constant) op uniform into (divergent op uniform) op constant
Can you explain why it should *not* do the transform? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 |
I don't want to insist, I want to reach agreement :) |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | I think it’s unnecessary because that case should be transformed to: |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 |
That sounds fine but it is implemented yet (in a target-independent way)? Or can you implement it in this patch or in a follow-up? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
3874–3899 | Maybe I can move D148463 into target-independent way? |
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll | ||
---|---|---|
77 ↗ | (On Diff #515514) | This is the kind of regression I expect out of globalisel, I'm surprised the DAG regressed here |
We also want to do this if x is divergent and y is uniform.