[PATCH] D135957: [AArch64][SeperateConstOffsetFromGEP] Prevent pass from splitting GEP if an index has more than one use

Zain Jaffal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 04:51:20 PDT 2022


zjaffal added a comment.

In D135957#3878970 <https://reviews.llvm.org/D135957#3878970>, @dmgreen wrote:

> Hmm. Should we be going further though? i.e why is it limited to the first index of a 2 element gep? Should ConstantOffsetExtractor::Extract be considering the number of uses of the Add/Sub/Or is examines, and checking whether we are going to require duplicating instructions to separate the constant.

I added the following check in `ConstantOffsetExtractor::CanTraceInto`

  if(!SignExtended && !ZeroExtended){
    if (!llvm::all_of(BO->users(),
                       [](const User *U) { return isa<GetElementPtrInst>(U); }))
      return false;
  }

I think it might be more general this way. I think we might need similar checks for `sext` and `zext operands.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135957



More information about the llvm-commits mailing list