LazyValueInfo: Actually re-visit partially solved block-values in solveBlockValue()
[oota-llvm.git] / lib / Analysis / CFLAliasAnalysis.cpp
index 0386afeb23a1201aa2d39f741be88f7781d29fe4..5f1b3d3a638fff6f1d7de233ae0dd0a012c1a3a4 100644 (file)
@@ -157,8 +157,8 @@ struct FunctionHandle : public CallbackVH {
 
   virtual ~FunctionHandle() {}
 
-  virtual void deleted() override { removeSelfFromCache(); }
-  virtual void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
+  void deleted() override { removeSelfFromCache(); }
+  void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
 
 private:
   CFLAliasAnalysis *CFLAA;
@@ -317,6 +317,17 @@ public:
     Output.push_back(Edge(Ptr, Val, EdgeType::Dereference, AttrNone));
   }
 
+  void visitVAArgInst(VAArgInst &Inst) {
+    // We can't fully model va_arg here. For *Ptr = Inst.getOperand(0), it does
+    // two things:
+    //  1. Loads a value from *((T*)*Ptr).
+    //  2. Increments (stores to) *Ptr by some target-specific amount.
+    // For now, we'll handle this like a landingpad instruction (by placing the
+    // result in its own group, and having that group alias externals).
+    auto *Val = &Inst;
+    Output.push_back(Edge(Val, Val, EdgeType::Assign, AttrAll));
+  }
+
   static bool isFunctionExternal(Function *Fn) {
     return Fn->isDeclaration() || !Fn->hasLocalLinkage();
   }