From 49c02eaad55b68f58d4abdbc22eb08b92a024437 Mon Sep 17 00:00:00 2001 From: Peizhao Ou Date: Wed, 4 Apr 2018 16:23:31 -0700 Subject: [PATCH] Taints upcoming store and adds bogus conditional branches else where. Now as a separate branch --- lib/CodeGen/CodeGenPrepare.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index f4ff3787e63..c9d22a29865 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -964,19 +964,20 @@ bool AddFakeConditionalBranchAfterMonotonicLoads( } } - // We really need to process the relaxed load now. + // We really need to process the relaxed load now. Note that if the next + // instruction is a RMW, it will be transformed into a control block, so we + // can safely only taint upcoming store instructions. StoreInst* SI = nullptr; IntrinsicInst* II = nullptr; if (FirstInst) { SI = dyn_cast(FirstInst); II = dyn_cast(FirstInst); } - if (FirstInst && - (SI || (II && II->getIntrinsicID() == Intrinsic::aarch64_stlxr))) { + if (FirstInst && SI) { // For immediately coming stores, taint the address of the store. if (FirstInst->getParent() == LI->getParent() || DT->dominates(LI, FirstInst)) { - TaintRelaxedLoads(LI, FirstInst); + Changed != taintStoreAddress(SI, LI); Changed = true; } else { auto* Inst = @@ -985,8 +986,7 @@ bool AddFakeConditionalBranchAfterMonotonicLoads( LI->setOrdering(Acquire); Changed = true; } else { - TaintRelaxedLoads(Inst, FirstInst); - Changed = true; + Changed |= taintStoreAddress(SI, Inst); } } } else { -- 2.34.1