Skip to content

Commit d46bebc

Browse files
committed
Try Patryk27 fix
1 parent 7dc79da commit d46bebc

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

llvm/lib/Target/AVR/AVRISelLowering.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,14 +1114,22 @@ bool AVRTargetLowering::getPostIndexedAddressParts(SDNode *N, SDNode *Op,
11141114
if (AVR::isProgramMemoryAccess(LD))
11151115
return false;
11161116

1117-
// FIXME: We temporarily apply a test which prevents generating incorrect
1118-
// code (see https://github.com/llvm/llvm-project/issues/143247 )
1119-
// until we determined and fixed the root cause.
1120-
if (Op->getOperand(0)->hasOneUse())
1117+
SDValue Ptr;
1118+
if (LoadSDNode *LD = dyn_cast<LoadSDNode>(N)) {
1119+
Ptr = LD->getBasePtr();
1120+
} else if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
1121+
Ptr = ST->getBasePtr();
1122+
} else
11211123
return false;
11221124

11231125
Base = Op->getOperand(0);
11241126
Offset = DAG.getConstant(RHSC, DL, MVT::i8);
1127+
1128+
// Post-indexing updates the base, so it's not a valid transform
1129+
// if that's not the same as the load's pointer.
1130+
if (Ptr != Base)
1131+
return false;
1132+
11251133
AM = ISD::POST_INC;
11261134

11271135
return true;

0 commit comments

Comments
 (0)