summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJonas Paulsson <jonas.paulsson@ericsson.com>2015-02-10 13:03:32 +0000
committerJonas Paulsson <jonas.paulsson@ericsson.com>2015-02-10 13:03:32 +0000
commitafa6813816a4ad14879ee532a7973c9e0ab917df (patch)
tree3d7d485d9a39d63e1326dc1ebd877694ba5d7599 /llvm/lib/CodeGen
parentcd32254a35c23d4f55ca16fa2917c19973b775e0 (diff)
downloadbcm5719-llvm-afa6813816a4ad14879ee532a7973c9e0ab917df.tar.gz
bcm5719-llvm-afa6813816a4ad14879ee532a7973c9e0ab917df.zip
Bugfix for missed dependency from store to load in buildSchedGraph().
Background: When handling underlying objects for a store, the vector of previous mem uses, mapped to the same Value, is afterwards cleared (regardless of ThisMayAlias). This means that during handling of the next store using the same Value, adjustChainDeps() must be called, otherwise a dependency might be missed. For example, three spill/reload (NonAliasing) memory accesses using the same Value 'a', with different offsets: SU(2): store @a SU(1): store @a, Offset:1 SU(0): load @a In this case we have: * SU(1) does not need a dep against SU(0). Therefore,SU(0) ends up in RejectMemNodes and is removed from the mem-uses list (AliasMemUses or NonAliasMemUses), as this list is cleared. * SU(2) needs a dep against SU(0). Therefore, SU(2) must check RejectMemNodes by calling adjustChainDeps(). Previously, for store SUs, adjustChainDeps() was only called if MayAlias was true, missing the S(2) to S(0) dependency in the case above. The fix is to always call adjustChainDeps(), regardless of MayAlias, since this applies both for AliasMemUses and NonAliasMemUses. No testcase found for any in-tree target. llvm-svn: 228686
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/ScheduleDAGInstrs.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index bf1ce7a4751..78bfd23e1b3 100644
--- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -991,11 +991,9 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA,
// Add dependence on alias chain, if needed.
if (AliasChain)
addChainDependency(AAForDep, MFI, SU, AliasChain, RejectMemNodes);
- // But we also should check dependent instructions for the
- // SU in question.
- adjustChainDeps(AA, MFI, SU, &ExitSU, RejectMemNodes,
- TrueMemOrderLatency);
}
+ adjustChainDeps(AA, MFI, SU, &ExitSU, RejectMemNodes,
+ TrueMemOrderLatency);
} else if (MI->mayLoad()) {
bool MayAlias = true;
if (MI->isInvariantLoad(AA)) {
OpenPOWER on IntegriCloud