Index: lib/Analysis/MemoryDependenceAnalysis.cpp =================================================================== --- lib/Analysis/MemoryDependenceAnalysis.cpp +++ lib/Analysis/MemoryDependenceAnalysis.cpp @@ -425,6 +425,8 @@ if (auto *QuerySI = dyn_cast(QueryInst)) if (!QuerySI->isSimple()) return MemDepResult::getClobber(LI); + if (QueryInst->mayReadOrWriteMemory()) + return MemDepResult::getClobber(LI); } // FIXME: this is overly conservative. @@ -503,6 +505,8 @@ if (auto *QuerySI = dyn_cast(QueryInst)) if (!QuerySI->isSimple()) return MemDepResult::getClobber(SI); + if (QueryInst->mayReadOrWriteMemory()) + return MemDepResult::getClobber(LI); } // FIXME: this is overly conservative.