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

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 19:35:15 PDT 2021


aqjune added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:348
+    }
+    // Vector to find out all target users of roundtrip (int2ptr/ptr2int) cast
+    // which are dominated by load/store instruction of same address as of
----------------
nlopes wrote:
> aqjune wrote:
> > Then, what do you think about adding a nofree check at this point? @nlopes 
> > 
> > Let's check whether CI's function has a nofree attribute. The checking will be fairly simple.
> > ```
> > define void @test(i8* %X, i8* %Y, i8* %Z) *nofree* {
> > ...
> > }
> > ```
> Well, nofree is still not very common. Which would render this optimization useless. Plus it would be unnecessary (and restrictive) to check once `isDereferenceableAndAlignedPointer` is fixed.
> Maybe what we need is a bug report for `isDereferenceableAndAlignedPointer` as it seems Philip abandoned the work on nofree.
Okay, then I'm fine with the code leaving as it is here.
Could you split this patch into three as suggested by Lebedev? @Krishnakariya 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107822



More information about the llvm-commits mailing list