[PATCH] D107822: [InstCombine] Fold Int2Ptr/PtrToInt if the ptr is dereferenceable

Krishna Kariya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 06:13:24 PDT 2021


Krishnakariya created this revision.
Herald added a subscriber: hiraditya.
Krishnakariya requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In this patch, we remove the int2ptr [ptr2int (p)] if p is dereferenceable. 
If the user of the round-trip cast is dominated by a load/store instruction of the same address, then we 
can replace round-trip cast with bitcast.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107822

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/load-int2ptr-fold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107822.365447.patch
Type: text/x-patch
Size: 8896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210810/a6a492c9/attachment.bin>


More information about the llvm-commits mailing list