[PATCH] D68492: [PATCH 09/38] [noalias] D9376: llvm.noalias - handling of dead intrinsics
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 14:15:07 PDT 2019
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5156
+ if (isa<UndefValue>(Arg0) ||
+ (isa<ConstantPointerNull>(Arg0) &&
+ Arg0->getType()->getPointerAddressSpace() == 0))
----------------
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68492/new/
https://reviews.llvm.org/D68492
More information about the llvm-commits
mailing list