[llvm] a46cf40 - [DAGCombiner] convert if-chain in store merging to switch; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 14:26:25 PDT 2020
Author: Sanjay Patel
Date: 2020-07-09T17:20:04-04:00
New Revision: a46cf40240adb3f3171f08705e65d7300b2719cb
URL: https://github.com/llvm/llvm-project/commit/a46cf40240adb3f3171f08705e65d7300b2719cb
DIFF: https://github.com/llvm/llvm-project/commit/a46cf40240adb3f3171f08705e65d7300b2719cb.diff
LOG: [DAGCombiner] convert if-chain in store merging to switch; NFC
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 309125035d34..effd5d6ab7d8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -16773,7 +16773,7 @@ bool DAGCombiner::mergeConsecutiveStores(StoreSDNode *St) {
// Do not bother looking at stored values that are not constants, loads, or
// extracted vector elements.
SDValue StoredVal = peekThroughBitcasts(St->getValue());
- StoreSource StoreSrc = getStoreSource(StoredVal);
+ const StoreSource StoreSrc = getStoreSource(StoredVal);
if (StoreSrc == StoreSource::Unknown)
return false;
@@ -16815,22 +16815,25 @@ bool DAGCombiner::mergeConsecutiveStores(StoreSDNode *St) {
// We have at least 2 consecutive stores. Try to merge them.
assert(NumConsecutiveStores >= 2 && "Expected at least 2 stores");
- if (StoreSrc == StoreSource::Constant) {
+ switch (StoreSrc) {
+ case StoreSource::Constant:
MadeChange |= tryStoreMergeOfConstants(StoreNodes, NumConsecutiveStores,
MemVT, RootNode, AllowVectors);
- continue;
- }
- if (StoreSrc == StoreSource::Extract) {
+ break;
+
+ case StoreSource::Extract:
MadeChange |= tryStoreMergeOfExtracts(StoreNodes, NumConsecutiveStores,
MemVT, RootNode);
- continue;
- }
- if (StoreSrc == StoreSource::Load) {
+ break;
+
+ case StoreSource::Load:
MadeChange |= tryStoreMergeOfLoads(StoreNodes, NumConsecutiveStores,
MemVT, RootNode, AllowVectors,
- IsNonTemporalStore,
- IsNonTemporalLoad);
- continue;
+ IsNonTemporalStore, IsNonTemporalLoad);
+ break;
+
+ default:
+ llvm_unreachable("Unhandled store source type");
}
}
return MadeChange;
More information about the llvm-commits
mailing list