[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 Nov 16 01:19:22 PST 2022


zjaffal added a comment.

In D135957#3885245 <https://reviews.llvm.org/D135957#3885245>, @zjaffal wrote:

> 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.

Actually this causes more tests to fail. I think for now doing it for only GEPs with one operand is fine. What do you think @dmgreen


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