[PATCH] D104795: [IVDescriptors] Make pointer inductions compatible with opaque pointers

Andrei Elovikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 10:37:48 PDT 2021


a.elovikov added inline comments.


================
Comment at: llvm/lib/Analysis/IVDescriptors.cpp:1272
+  // We need a GEP to determine the element type.
+  GEPOperator *GEP =
+      dyn_cast<GEPOperator>(Phi->getIncomingValueForBlock(Latch));
----------------
a.elovikov wrote:
> Would it work if we'd have a chain of geps with different srcElementTypes? E.g. something like
>   
>   %ptr = phi [ %from.preheader ], [ ptr.next ]
>   %gep = getelementptr i16, %ptr, 1
>   %ptr.next = getelementptr i32, %gep, 1
> 
> The step isn't even representable in multiples of i32 in that scenario.
@aeubanks , why can't this happen? Or, if it can, why isn't it an issue?


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

https://reviews.llvm.org/D104795



More information about the llvm-commits mailing list