[PATCH] D68492: [PATCH 09/38] [noalias] D9376: llvm.noalias - handling of dead intrinsics

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 04:52:24 PDT 2019


jeroen.dobbelaere marked an inline comment as done.
jeroen.dobbelaere added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5156
+    if (isa<UndefValue>(Arg0) ||
+        (isa<ConstantPointerNull>(Arg0) &&
+         Arg0->getType()->getPointerAddressSpace() == 0))
----------------
lebedev.ri wrote:
> jeroen.dobbelaere wrote:
> > a.elovikov wrote:
> > > What if we have
> > > 
> > >   %i = ptr2int %p
> > >   %null = sub %i, %i
> > >   %nullptr = int2ptr %null
> > >   %scope = call @llvm.noalias(%nullptr) ; introduce the scope
> > >   %null2 = ptr2int %scope
> > >   %i2 = add %null2, %i
> > >   %same.as.orig.p = int2ptr %i2
> > > 
> > > Why don't we want `%same.as.orig.p` to have the scope?
> > A ptr2int will normally block the noalias propagation. Not sure if a 
> >   %same.as.orig.p = getelementptr %scope, %i
> > is valid when %scope is null. If that is valid, the noalias dependency should not be removed, and we should not short-circuit it here.
> > 
> `getelementptr` is valid for null pointer.
> 
Then this is wrong, but it should be fixed in D68493, not here.


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

https://reviews.llvm.org/D68492





More information about the llvm-commits mailing list