This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by jeroen.dobbelaere on Oct 4 2019, 2:32 PM.

Details

Reviewers
hfinkel
jdoerfert
Summary

This is part of the series started by D68484.

Rebase of D9376

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2019, 2:32 PM
a.elovikov added inline comments.
llvm/lib/Analysis/InstructionSimplify.cpp
5156

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?

llvm/test/Transforms/InstSimplify/noalias.ll
9

Simplify to CHECK-NEXT: ret void?

jeroen.dobbelaere marked an inline comment as done.Oct 10 2019, 2:03 PM
jeroen.dobbelaere added inline comments.
llvm/lib/Analysis/InstructionSimplify.cpp
5156

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.

lebedev.ri added inline comments.
llvm/lib/Analysis/InstructionSimplify.cpp
5156

getelementptr is valid for null pointer.

jeroen.dobbelaere marked an inline comment as done.Oct 14 2019, 4:51 AM
jeroen.dobbelaere added inline comments.
llvm/lib/Analysis/InstructionSimplify.cpp
5156

Then this is wrong, but it should be fixed in D68493, not here.

For review convenience, all changes related to the original local restrict patches have now been incorporated in the full restrict patch series.