Skip to content

Commit 3f5edfd

Browse files
RKSimonAlexisPerry
authored andcommitted
[X86] combineConstantPoolLoads - early-out if the load is not from a constant pool. NFC.
Don't embed inside the for-loop later on
1 parent 53b09d4 commit 3f5edfd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50874,6 +50874,10 @@ static SDValue combineConstantPoolLoads(SDNode *N, const SDLoc &dl,
5087450874
if (!(RegVT.is128BitVector() || RegVT.is256BitVector()))
5087550875
return SDValue();
5087650876

50877+
const Constant *LdC = getTargetConstantFromBasePtr(Ptr);
50878+
if (!LdC)
50879+
return SDValue();
50880+
5087750881
auto MatchingBits = [](const APInt &Undefs, const APInt &UserUndefs,
5087850882
ArrayRef<APInt> Bits, ArrayRef<APInt> UserBits) {
5087950883
for (unsigned I = 0, E = Undefs.getBitWidth(); I != E; ++I) {
@@ -50898,12 +50902,11 @@ static SDValue combineConstantPoolLoads(SDNode *N, const SDLoc &dl,
5089850902
RegVT.getFixedSizeInBits()) {
5089950903
EVT UserVT = User->getValueType(0);
5090050904
SDValue UserPtr = UserLd->getBasePtr();
50901-
const Constant *LdC = getTargetConstantFromBasePtr(Ptr);
5090250905
const Constant *UserC = getTargetConstantFromBasePtr(UserPtr);
5090350906

5090450907
// See if we are loading a constant that matches in the lower
5090550908
// bits of a longer constant (but from a different constant pool ptr).
50906-
if (LdC && UserC && UserPtr != Ptr) {
50909+
if (UserC && UserPtr != Ptr) {
5090750910
unsigned LdSize = LdC->getType()->getPrimitiveSizeInBits();
5090850911
unsigned UserSize = UserC->getType()->getPrimitiveSizeInBits();
5090950912
if (LdSize < UserSize || !ISD::isNormalLoad(User)) {

0 commit comments

Comments
 (0)