From 10437f66fac8ac84bc8a80b8beb5d1c17a20e654 Mon Sep 17 00:00:00 2001 From: Gerolf Hoflehner Date: Mon, 21 Jul 2014 03:02:46 +0000 Subject: [PATCH] Fix for regression: [Bug 20369] wrong code at -O3 on x86_64-linux-gnu in 64-bit mode Prevents hoisting of loads above stores and sinking of stores below loads in MergedLoadStoreMotion.cpp (rdar://15991737) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213497 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/MergedLoadStoreMotion.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp b/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp index 7be4715f15d..a7e80240d9e 100644 --- a/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ b/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -243,6 +243,10 @@ bool MergedLoadStoreMotion::isLoadHoistBarrier(Instruction *Inst) { return true; if (isa(Inst)) return true; + // FIXME: Conservatively let a store instruction block the load. + // Use alias analysis instead. + if (isa(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 @@ -411,8 +415,12 @@ bool MergedLoadStoreMotion::mergeLoads(BasicBlock *BB) { /// /// \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(Inst)) + return true; if (isa(Inst)) return true; if (isa(Inst) && !isa(Inst)) -- 2.34.1