Skip to content

Commit 57045a1

Browse files
authored
[DAGCombiner] Avoid repeated calls to WideVT.getScalarSizeInBits() in DAGCombiner::mergeTruncStores. NFC (llvm#152231)
We already have a variable, WideNumBits, that contains the same information. Use it and delay the creation of WideVT until we really need it.
1 parent e232f05 commit 57045a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9390,8 +9390,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
93909390
LLVMContext &Context = *DAG.getContext();
93919391
unsigned NumStores = Stores.size();
93929392
unsigned WideNumBits = NumStores * NarrowNumBits;
9393-
EVT WideVT = EVT::getIntegerVT(Context, WideNumBits);
9394-
if (WideVT != MVT::i16 && WideVT != MVT::i32 && WideVT != MVT::i64)
9393+
if (WideNumBits != 16 && WideNumBits != 32 && WideNumBits != 64)
93959394
return SDValue();
93969395

93979396
// Check if all bytes of the source value that we are looking at are stored
@@ -9445,7 +9444,7 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
94459444
SourceValue = WideVal;
94469445

94479446
// Give up if the source value type is smaller than the store size.
9448-
if (SourceValue.getScalarValueSizeInBits() < WideVT.getScalarSizeInBits())
9447+
if (SourceValue.getScalarValueSizeInBits() < WideNumBits)
94499448
return SDValue();
94509449
}
94519450

@@ -9469,6 +9468,8 @@ SDValue DAGCombiner::mergeTruncStores(StoreSDNode *N) {
94699468
OffsetMap[Offset] = ByteOffsetFromBase;
94709469
}
94719470

9471+
EVT WideVT = EVT::getIntegerVT(Context, WideNumBits);
9472+
94729473
assert(FirstOffset != INT64_MAX && "First byte offset must be set");
94739474
assert(FirstStore && "First store must be set");
94749475

0 commit comments

Comments
 (0)