//
// header:
// br %cond, label %if.then, label %if.else
-// / \
-// / \
-// / \
+// + +
+// + +
+// + +
// if.then: if.else:
// %lt = load %addr_l %le = load %addr_l
// <use %lt> <use %le>
// <...> <...>
// store %st, %addr_s store %se, %addr_s
// br label %if.end br label %if.end
-// \ /
-// \ /
-// \ /
+// + +
+// + +
+// + +
// if.end ("footer"):
// <...>
//
// header:
// %l = load %addr_l
// br %cond, label %if.then, label %if.else
-// / \
-// / \
-// / \
+// + +
+// + +
+// + +
// if.then: if.else:
// <use %l> <use %l>
// <...> <...>
// br label %if.end br label %if.end
-// \ /
-// \ /
-// \ /
+// + +
+// + +
+// + +
// if.end ("footer"):
// %s.sink = phi [%st, if.then], [%se, if.else]
// <...>
return true;
if (isa<TerminatorInst>(Inst))
return true;
+ // FIXME: Conservatively let a store instruction block the load.
+ // Use alias analysis instead.
+ if (isa<StoreInst>(Inst))
+ return true;
// Note: mayHaveSideEffects covers all instructions that could
// trigger a change to state. Eg. in-flight stores have to be executed
// before ordered loads or fences, calls could invoke functions that store
///
/// \brief True when instruction is sink barrier for a store
-///
+///
bool MergedLoadStoreMotion::isStoreSinkBarrier(Instruction *Inst) {
+ // FIXME: Conservatively let a load instruction block the store.
+ // Use alias analysis instead.
+ if (isa<LoadInst>(Inst))
+ return true;
if (isa<CallInst>(Inst))
return true;
if (isa<TerminatorInst>(Inst) && !isa<BranchInst>(Inst))