[PATCH] D128582: Enable SeparateConstOffsetFromGEPPass() at -O3 and -O2

Shubham Narlawar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 4 11:12:35 PDT 2022


gsocshubham added a comment.

In D128582#3624787 <https://reviews.llvm.org/D128582#3624787>, @dmgreen wrote:

> Hello. Unfortunately, I doubt that people will be in favour of this approach, especially if it is introducing ptr2int and int2ptr's so early in the pass pipeline. It looks like a pass that needs to be run as part of the backend.
>
> There is a run of the pass in the AArch64 backend already, but it is disabled by default: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp#L581

Hello David,

Passing `-aarch64-enable-gep-opt=true -O3` would do the job - https://clang.godbolt.org/z/hcjsh1vex what this patch was proposing. WDYT?

> Enabling it didn't seem to help with the original case in #50528. Would it be possible to teach it what it needs to for that case, and from there enable the EnableGEPOpt flag?

Sure. For #50528, enabling `EnableGEPOpt` reduces GEP instructions by half but is done by splitting GEP into ptr2int and int2ptr.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128582/new/

https://reviews.llvm.org/D128582



More information about the llvm-commits mailing list