llvm.org GIT mirror llvm / d3bf1ae
Fix PR 2160 by making sure arguments to external functions get marked as pointing to anything git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48509 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Berlin 12 years ago
2 changed file(s) with 50 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
646646
647647 if (N1->PointsTo->empty())
648648 return NoModRef;
649
649 #if FULL_UNIVERSAL
650 if (!UniversalSet->PointsTo->test(FindNode(getNode(P))))
651 return NoModRef; // Universal set does not contain P
652 #else
650653 if (!N1->PointsTo->test(UniversalSet))
651654 return NoModRef; // P doesn't point to the universal set.
655 #endif
652656 }
653657
654658 return AliasAnalysis::getModRefInfo(CS, P, Size);
12651269 }
12661270
12671271 CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end();
1272 bool external = !F || F->isDeclaration();
12681273 if (F) {
12691274 // Direct Call
12701275 Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end();
1271 for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI)
1272 if (isa(AI->getType())) {
1273 if (isa((*ArgI)->getType())) {
1274 // Copy the actual argument into the formal argument.
1275 Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
1276 for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI)
1277 {
1278 #if !FULL_UNIVERSAL
1279 if (external && isa((*ArgI)->getType()))
1280 {
1281 // Add constraint that ArgI can now point to anything due to
1282 // escaping, as can everything it points to. The second portion of
1283 // this should be taken care of by universal = *universal
1284 Constraints.push_back(Constraint(Constraint::Copy,
1285 getNode(*ArgI),
1286 UniversalSet));
1287 }
1288 #endif
1289 if (isa(AI->getType())) {
1290 if (isa((*ArgI)->getType())) {
1291 // Copy the actual argument into the formal argument.
1292 Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
1293 getNode(*ArgI)));
1294 } else {
1295 Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
1296 UniversalSet));
1297 }
1298 } else if (isa((*ArgI)->getType())) {
1299 #if FULL_UNIVERSAL
1300 Constraints.push_back(Constraint(Constraint::Copy,
1301 UniversalSet,
12761302 getNode(*ArgI)));
1277 } else {
1278 Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
1303 #else
1304 Constraints.push_back(Constraint(Constraint::Copy,
1305 getNode(*ArgI),
12791306 UniversalSet));
1307 #endif
12801308 }
1281 } else if (isa((*ArgI)->getType())) {
1282 #if FULL_UNIVERSAL
1283 Constraints.push_back(Constraint(Constraint::Copy,
1284 UniversalSet,
1285 getNode(*ArgI)));
1286 #else
1287 Constraints.push_back(Constraint(Constraint::Copy,
1288 getNode(*ArgI),
1289 UniversalSet));
1290 #endif
12911309 }
12921310 } else {
12931311 //Indirect Call
0 ; RUN: llvm-as < %s | opt -anders-aa -gvn | llvm-dis \
1 ; RUN: | not grep {ret i32 undef}
2
3 ;; From PR 2160
4 declare void @f(i32*)
5
6 define i32 @g() {
7 entry:
8 %tmp = alloca i32 ; [#uses=2]
9 call void @f( i32* %tmp )
10 %tmp2 = load i32* %tmp ; [#uses=1]
11 ret i32 %tmp2
12 }
13