llvm.org GIT mirror llvm / a08c922
[BasicAliasAnalysis] Take into account operand bundles in the getModRefInfo function Differential Revision: http://reviews.llvm.org/D16225 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257991 91177308-0d34-0410-b5e6-96231b3b80d8 Igor Laevsky 3 years ago
2 changed file(s) with 35 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
716716 if (!isa(Object) && CS.getInstruction() != Object &&
717717 isNonEscapingLocalObject(Object)) {
718718 bool PassedAsArg = false;
719 unsigned ArgNo = 0;
720 for (ImmutableCallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
721 CI != CE; ++CI, ++ArgNo) {
719 unsigned OperandNo = 0;
720 for (auto CI = CS.data_operands_begin(), CE = CS.data_operands_end();
721 CI != CE; ++CI, ++OperandNo) {
722722 // Only look at the no-capture or byval pointer arguments. If this
723723 // pointer were passed to arguments that were neither of these, then it
724724 // couldn't be no-capture.
725725 if (!(*CI)->getType()->isPointerTy() ||
726 (!CS.doesNotCapture(ArgNo) && !CS.isByValArgument(ArgNo)))
726 (!CS.doesNotCapture(OperandNo) && !CS.isByValArgument(OperandNo)))
727727 continue;
728728
729729 // If this is a no-capture pointer argument, see if we can tell that it
0 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
1
2 declare noalias i8* @malloc(i64) "malloc-like"
3
4 declare void @foo()
5 declare void @bar(i8*)
6
7 define void @test() {
8 %obj = call i8* @malloc(i64 8)
9 store i8 0, i8* %obj
10 ; don't remove store. %obj should be treated like it will be read by the @foo.
11 ; CHECK: store i8 0, i8* %obj
12 call void @foo() ["deopt" (i8* %obj)]
13 ret void
14 }
15
16 define void @test1() {
17 %obj = call i8* @malloc(i64 8)
18 store i8 0, i8* %obj
19 ; CHECK: store i8 0, i8* %obj
20 call void @bar(i8* nocapture %obj)
21 ret void
22 }
23
24 define void @test2() {
25 %obj = call i8* @malloc(i64 8)
26 store i8 0, i8* %obj
27 ; CHECK-NOT: store i8 0, i8* %obj
28 call void @foo()
29 ret void
30 }