[GISel] Add combine for constant G_PTR_ADD offsets.
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Wed, 14 Oct 2020 00:19:28 +0000 (17:19 -0700)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Wed, 14 Oct 2020 00:26:12 +0000 (17:26 -0700)
commitef3d17482fff105a1c44fccbbe494ccddafa5661
tree2047bba9ad311f56a9e996545c049966078b4c13
parentcc69d211d0d65d7bf0335fecbc323f784ac3afcc
[GISel] Add combine for constant G_PTR_ADD offsets.

https://reviews.llvm.org/D88865

This adds a single combine for GlobalISel to fold:

ptradd (inttoptr C1) C2
Into:

C1 + C2
Additionally, a small test for AArch64 is added.

Patch by pnappa.
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/include/llvm/Target/GlobalISel/Combine.td.rej [new file with mode: 0644]
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-ptradd-int2ptr.mir [new file with mode: 0644]