Skip to content

Commit d86ec01

Browse files
Enable merge by default for scalars
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent f9393d5 commit d86ec01

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ class TargetLoweringBase {
35083508

35093509
/// Returns true if it's profitable to allow merging store of loads when there
35103510
/// are functions calls between the load and the store.
3511-
virtual bool shouldMergeStoreOfLoadsOverCall() const { return true; }
3511+
virtual bool shouldMergeStoreOfLoadsOverCall(EVT) const { return true; }
35123512

35133513
//===----------------------------------------------------------------------===//
35143514
// GlobalISel Hooks

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21417,7 +21417,8 @@ bool DAGCombiner::tryStoreMergeOfLoads(SmallVectorImpl<MemOpLink> &StoreNodes,
2141721417
}
2141821418

2141921419
// Check if there is a call in the load/store chain.
21420-
if (!TLI.shouldMergeStoreOfLoadsOverCall() && HasCallInLdStChain(Ld, St)) {
21420+
if (!TLI.shouldMergeStoreOfLoadsOverCall(MemVT) &&
21421+
HasCallInLdStChain(Ld, St)) {
2142121422
StIt = StoreNodes.erase(StIt);
2142221423
} else {
2142321424
LoadNodes.push_back(MemOpLink(Ld, LdOffset));

llvm/lib/Target/RISCV/RISCVISelLowering.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,10 +1070,11 @@ class RISCVTargetLowering : public TargetLowering {
10701070
return false;
10711071
}
10721072

1073-
/// Disables storing and loading vectors when there are function calls between
1074-
/// the load and store, since these are more expensive than just using scalars
1075-
bool shouldMergeStoreOfLoadsOverCall() const override {
1076-
return false;
1073+
/// Disables storing and loading vectors by default when there are function
1074+
/// calls between the load and store, since these are more expensive than just
1075+
/// using scalars
1076+
bool shouldMergeStoreOfLoadsOverCall(EVT VT) const override {
1077+
return VT.isScalarInteger();
10771078
}
10781079

10791080
/// For available scheduling models FDIV + two independent FMULs are much

0 commit comments

Comments
 (0)