[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 1 14:04:29 PDT 2021


a.elovikov added a comment.

> The main alternative I see here is to use different logic for opaque pointers and always base them off an i8 element type

Can we do that based on the fact the we can't deduce the element type from GEP step instruction (e.g. if there is no obvious one)?



================
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));
----------------
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.


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

https://reviews.llvm.org/D104795



More information about the llvm-commits mailing list