+ if (!LI->isUnordered()) {
+ if (!QueryInst)
+ return MemDepResult::getClobber(LI);
+ if (LI->getOrdering() != Monotonic)
+ return MemDepResult::getClobber(LI);
+ if (auto *QueryLI = dyn_cast<LoadInst>(QueryInst))
+ if (!QueryLI->isSimple())
+ return MemDepResult::getClobber(LI);
+ if (auto *QuerySI = dyn_cast<StoreInst>(QueryInst))
+ if (!QuerySI->isSimple())
+ return MemDepResult::getClobber(LI);
+ }
+
+ // FIXME: this is overly conservative.
+ // While volatile access cannot be eliminated, they do not have to clobber
+ // non-aliasing locations, as normal accesses can for example be reordered
+ // with volatile accesses.
+ if (LI->isVolatile())