[PATCH] D40713: [DAGCombine] Remove isAndLoadExtLoad arguments
Sam Parker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 04:07:22 PST 2017
samparker created this revision.
The LoadedVT argument was already unused by all of its callers and now, with https://reviews.llvm.org/D40667, the only user of NarrowLoad is also being removed. So remove both of these arguments.
https://reviews.llvm.org/D40713
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -496,12 +496,9 @@
/// This is a helper function for visitAND and visitZERO_EXTEND. Returns
/// true if the (and (load x) c) pattern matches an extload. ExtVT returns
- /// the type of the loaded value to be extended. LoadedVT returns the type
- /// of the original loaded value. NarrowLoad returns whether the load would
- /// need to be narrowed in order to match.
+ /// the type of the loaded value to be extended.
bool isAndLoadExtLoad(ConstantSDNode *AndC, LoadSDNode *LoadN,
- EVT LoadResultTy, EVT &ExtVT, EVT &LoadedVT,
- bool &NarrowLoad);
+ EVT LoadResultTy, EVT &ExtVT);
/// Helper function for MergeConsecutiveStores which merges the
/// component store chains.
@@ -3693,22 +3690,20 @@
}
bool DAGCombiner::isAndLoadExtLoad(ConstantSDNode *AndC, LoadSDNode *LoadN,
- EVT LoadResultTy, EVT &ExtVT, EVT &LoadedVT,
- bool &NarrowLoad) {
+ EVT LoadResultTy, EVT &ExtVT) {
if (!AndC->getAPIntValue().isMask())
return false;
unsigned ActiveBits = AndC->getAPIntValue().countTrailingOnes();
ExtVT = EVT::getIntegerVT(*DAG.getContext(), ActiveBits);
- LoadedVT = LoadN->getMemoryVT();
+ EVT LoadedVT = LoadN->getMemoryVT();
if (ExtVT == LoadedVT &&
(!LegalOperations ||
TLI.isLoadExtLegal(ISD::ZEXTLOAD, LoadResultTy, ExtVT))) {
// ZEXTLOAD will match without needing to change the size of the value being
// loaded.
- NarrowLoad = false;
return true;
}
@@ -3728,7 +3723,6 @@
if (!TLI.shouldReduceLoadWidth(LoadN, ISD::ZEXTLOAD, ExtVT))
return false;
- NarrowLoad = true;
return true;
}
@@ -7652,11 +7646,9 @@
if (!N0.hasOneUse()) {
if (N0.getOpcode() == ISD::AND) {
auto *AndC = cast<ConstantSDNode>(N0.getOperand(1));
- auto NarrowLoad = false;
EVT LoadResultTy = AndC->getValueType(0);
- EVT ExtVT, LoadedVT;
- if (isAndLoadExtLoad(AndC, LN0, LoadResultTy, ExtVT, LoadedVT,
- NarrowLoad))
+ EVT ExtVT;
+ if (isAndLoadExtLoad(AndC, LN0, LoadResultTy, ExtVT))
DoXform = false;
}
if (DoXform)
@@ -8031,17 +8023,10 @@
if (!N1C)
return SDValue();
- EVT LoadedVT;
- bool NarrowLoad = false;
ExtType = ISD::ZEXTLOAD;
VT = HasAnyExt ? LN0->getValueType(0) : VT;
- if (!isAndLoadExtLoad(N1C, LN0, VT, ExtVT, LoadedVT, NarrowLoad))
+ if (!isAndLoadExtLoad(N1C, LN0, VT, ExtVT))
return SDValue();
-
- if (!NarrowLoad)
- return DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(LN0), VT,
- LN0->getChain(), LN0->getBasePtr(), ExtVT,
- LN0->getMemOperand());
}
if (LegalOperations && !TLI.isLoadExtLegal(ExtType, VT, ExtVT))
return SDValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40713.125104.patch
Type: text/x-patch
Size: 3196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171201/d7b1eff8/attachment.bin>
More information about the llvm-commits
mailing list