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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 10:12:51 PDT 2021


nikic created this revision.
nikic added reviewers: fhahn, spatel, opaque-pointers.
Herald added subscribers: dexonsmith, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Rather than inspecting the element type of the pointer, look for the GEP step instruction and take it's element type. Also store that in the IVDescriptor and fetch it in LoopVectorize.

A problem of this approach is that it fails if there is no direct GEP step instruction. It's usually present, but one LoopVectorize test shows a case where it isn't. I'm not sure how important it is.

The main alternative I see here is to use different logic for opaque pointers and always base them off an i8 element type (aka "uglygep"). The disadvantage of that is that a switch to opaque pointers would have a non-trivial impact on how optimization works here, so I think it would be the worst option. Another variant is to always use i8 element types, i.e. make this purely offset based and force necessary pointer casts for non-opaque pointers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104795

Files:
  llvm/include/llvm/Analysis/IVDescriptors.h
  llvm/lib/Analysis/IVDescriptors.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/iv_outside_user.ll
  llvm/test/Transforms/LoopVectorize/opaque-ptr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104795.354012.patch
Type: text/x-patch
Size: 8838 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210623/0916e87a/attachment.bin>


More information about the llvm-commits mailing list