[PATCH] D157977: [InstCombine] OptimizePointerDifference when a gep has phi ptr

Biplob Mishra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 06:15:29 PDT 2023


bipmis created this revision.
bipmis added reviewers: dmgreen, momchil.velikov, nikic, RKSimon.
bipmis added projects: LLVM, All.
Herald added a subscriber: StephenFan.
bipmis requested review of this revision.

For scenarios like  
gep (PHI(X+A, X)), ...) - ( gep X, ...) where X is a ptr and A is a positive index, if the use of this sub results in a cmp with 0, the sub can essentially be folded.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157977

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/test/Transforms/InstCombine/sub-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157977.550301.patch
Type: text/x-patch
Size: 10318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230815/3eab6f2f/attachment.bin>


More information about the llvm-commits mailing list