Force postdom to be linked into opt and bugpoint, even though it is no longer used...
[oota-llvm.git] / lib / Analysis / BasicAliasAnalysis.cpp
index 866c8100abbbffb9d378f320059e09c957ff1b3d..21108c645351c71ec7c079ad52b99f0519e3f5ed 100644 (file)
@@ -79,15 +79,15 @@ namespace {
     virtual void deleteValue(Value *V) {}
     virtual void copyValue(Value *From, Value *To) {}
   };
+}  // End of anonymous namespace
 
-  // Register this pass...
-  char NoAA::ID = 0;
-  RegisterPass<NoAA>
-  U("no-aa", "No Alias Analysis (always returns 'may' alias)");
+// Register this pass...
+char NoAA::ID = 0;
+static RegisterPass<NoAA>
+U("no-aa", "No Alias Analysis (always returns 'may' alias)", true, true);
 
-  // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis> V(U);
-}  // End of anonymous namespace
+// Declare that we implement the AliasAnalysis interface
+static RegisterAnalysisGroup<AliasAnalysis> V(U);
 
 ImmutablePass *llvm::createNoAAPass() { return new NoAA(); }
 
@@ -124,15 +124,15 @@ namespace {
                          const Type *BasePtr2Ty,
                          Value **GEP2Ops, unsigned NumGEP2Ops, unsigned G2Size);
   };
+}  // End of anonymous namespace
 
-  // Register this pass...
-  char BasicAliasAnalysis::ID = 0;
-  RegisterPass<BasicAliasAnalysis>
-  X("basicaa", "Basic Alias Analysis (default AA impl)");
+// Register this pass...
+char BasicAliasAnalysis::ID = 0;
+static RegisterPass<BasicAliasAnalysis>
+X("basicaa", "Basic Alias Analysis (default AA impl)", false, true);
 
-  // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
-}  // End of anonymous namespace
+// Declare that we implement the AliasAnalysis interface
+static RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
 
 ImmutablePass *llvm::createBasicAliasAnalysisPass() {
   return new BasicAliasAnalysis();
@@ -264,7 +264,7 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
               CI != CE; ++CI)
             if (isa<PointerType>((*CI)->getType()) &&
                 ( getUnderlyingObject(*CI) == P ||
-                  alias(cast<Value>(CI), ~0UL, P, ~0UL) != NoAlias) )
+                  alias(cast<Value>(CI), ~0U, P, ~0U) != NoAlias) )
               passedAsArg = true;
           
           if (!passedAsArg)
@@ -273,8 +273,10 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
 
       // If this is a tail call and P points to a stack location, we know that
       // the tail call cannot access or modify the local stack.
-      if (isa<AllocaInst>(Object) ||
-          (isa<Argument>(Object) && cast<Argument>(Object)->hasByValAttr()))
+      // We cannot exclude byval arguments here; these belong to the caller of
+      // the current function not to the current function, and a tail callee
+      // may reference them.
+      if (isa<AllocaInst>(Object))
         if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction()))
           if (CI->isTailCall())
             return NoModRef;