[GlobalISel] Implement some binary reassociations, G_ADD for now
authorAmara Emerson <amara@apple.com>
Sat, 3 Jun 2023 23:12:48 +0000 (16:12 -0700)
committerAmara Emerson <amara@apple.com>
Fri, 9 Jun 2023 04:14:58 +0000 (21:14 -0700)
commit086601eac266ec253bf313c746390ff3e5656132
treebbae69158f2c60fb284d9dee937ac29c2544cc99
parent3004e9f86b4ad549fc09f05f3d09169b1c1c3f66
[GlobalISel] Implement some binary reassociations, G_ADD for now

- (op (op X, C1), C2) -> (op X, (op C1, C2))
- (op (op X, C1), Y) -> (op (op X, Y), C1)

Some code duplication with the G_PTR_ADD reassociations unfortunately but no
easy way to avoid it that I can see.

Differential Revision: https://reviews.llvm.org/D150230
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.h
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-binop-reassoc.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.s.buffer.load.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-amdgcn.s.buffer.load.ll