summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2008-03-18 22:22:53 +0000
committerDaniel Berlin <dberlin@dberlin.org>2008-03-18 22:22:53 +0000
commit5fef9aea12b30f33e9e2feb7c68dbefbea8761e2 (patch)
tree4fb2999dc23fbc921d208152b06961d95f27843e /llvm/lib
parentb0c409a235c06bec6374e009d147e760a9dcefa1 (diff)
downloadbcm5719-llvm-5fef9aea12b30f33e9e2feb7c68dbefbea8761e2.tar.gz
bcm5719-llvm-5fef9aea12b30f33e9e2feb7c68dbefbea8761e2.zip
Fix PR 2160 by making sure arguments to external functions get marked as pointing to anything
llvm-svn: 48509
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/IPA/Andersens.cpp54
1 files changed, 36 insertions, 18 deletions
diff --git a/llvm/lib/Analysis/IPA/Andersens.cpp b/llvm/lib/Analysis/IPA/Andersens.cpp
index a66a6faf1c5..49c6edd6207 100644
--- a/llvm/lib/Analysis/IPA/Andersens.cpp
+++ b/llvm/lib/Analysis/IPA/Andersens.cpp
@@ -647,9 +647,13 @@ Andersens::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
if (N1->PointsTo->empty())
return NoModRef;
-
+#if FULL_UNIVERSAL
+ if (!UniversalSet->PointsTo->test(FindNode(getNode(P))))
+ return NoModRef; // Universal set does not contain P
+#else
if (!N1->PointsTo->test(UniversalSet))
return NoModRef; // P doesn't point to the universal set.
+#endif
}
return AliasAnalysis::getModRefInfo(CS, P, Size);
@@ -1266,29 +1270,43 @@ void Andersens::AddConstraintsForCall(CallSite CS, Function *F) {
}
CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end();
+ bool external = !F || F->isDeclaration();
if (F) {
// Direct Call
Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end();
- for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI)
- if (isa<PointerType>(AI->getType())) {
- if (isa<PointerType>((*ArgI)->getType())) {
- // Copy the actual argument into the formal argument.
- Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
- getNode(*ArgI)));
- } else {
- Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
- UniversalSet));
- }
- } else if (isa<PointerType>((*ArgI)->getType())) {
+ for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI)
+ {
+#if !FULL_UNIVERSAL
+ if (external && isa<PointerType>((*ArgI)->getType()))
+ {
+ // Add constraint that ArgI can now point to anything due to
+ // escaping, as can everything it points to. The second portion of
+ // this should be taken care of by universal = *universal
+ Constraints.push_back(Constraint(Constraint::Copy,
+ getNode(*ArgI),
+ UniversalSet));
+ }
+#endif
+ if (isa<PointerType>(AI->getType())) {
+ if (isa<PointerType>((*ArgI)->getType())) {
+ // Copy the actual argument into the formal argument.
+ Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
+ getNode(*ArgI)));
+ } else {
+ Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
+ UniversalSet));
+ }
+ } else if (isa<PointerType>((*ArgI)->getType())) {
#if FULL_UNIVERSAL
- Constraints.push_back(Constraint(Constraint::Copy,
- UniversalSet,
- getNode(*ArgI)));
+ Constraints.push_back(Constraint(Constraint::Copy,
+ UniversalSet,
+ getNode(*ArgI)));
#else
- Constraints.push_back(Constraint(Constraint::Copy,
- getNode(*ArgI),
- UniversalSet));
+ Constraints.push_back(Constraint(Constraint::Copy,
+ getNode(*ArgI),
+ UniversalSet));
#endif
+ }
}
} else {
//Indirect Call
OpenPOWER on IntegriCloud