[Reassociation] Fix miscompile for va_arg arguments.
[oota-llvm.git] / lib / Analysis / ValueTracking.cpp
index b761a5c1b436275c034988686f86b1cbc50d8a91..275e35992fb09072d74fd51c1f4056f7b1fe3d8b 100644 (file)
@@ -3161,6 +3161,10 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V,
   }
 }
 
+bool llvm::mayBeMemoryDependent(const Instruction &I) {
+  return I.mayReadOrWriteMemory() || !isSafeToSpeculativelyExecute(&I);
+}
+
 /// Return true if we know that the specified value is never null.
 bool llvm::isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI) {
   // Alloca never returns null, malloc might.