[PATCH] D110247: [InstCombine] Fold ptrtoint(gep null) with a variable index

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 06:59:24 PDT 2021


arichardson created this revision.
arichardson added reviewers: lebedev.ri, nikic, reames.
Herald added subscribers: arphaman, hiraditya.
arichardson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a follow-up to the previous changes that fold ptrtoint(gep null).
If there is only one variable index (and N constant ones), we can fold
this to a mul+add+zext/trunc. Avoiding the pointer operation should be
beneficial for follow-up optimizations.

Depends on D110246 <https://reviews.llvm.org/D110246>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110247

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/InstCombine/ptrtoint-nullgep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110247.374217.patch
Type: text/x-patch
Size: 12869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/5140a47c/attachment.bin>


More information about the llvm-commits mailing list