llvm.org GIT mirror llvm / 6d8e50b
ARM: don't use a deleted node as the BaseReg in complex pattern. We mutated the DAG, which invalidated the node we were trying to use as a base register. Sometimes we got away with it, but other times the node really did get deleted before it was finished with. Should fix PR25733 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255120 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 4 years ago
2 changed file(s) with 19 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
547547 unsigned PowerOfTwo = 0;
548548 SDValue NewMulConst;
549549 if (canExtractShiftFromMul(N, 31, PowerOfTwo, NewMulConst)) {
550 BaseReg = SDValue(Select(CurDAG->getNode(ISD::MUL, SDLoc(N), MVT::i32,
551 N.getOperand(0), NewMulConst)
552 .getNode()),
553 0);
550554 replaceDAGValue(N.getOperand(1), NewMulConst);
551 BaseReg = N;
552555 Opc = CurDAG->getTargetConstant(ARM_AM::getSORegOpc(ARM_AM::lsl,
553556 PowerOfTwo),
554557 SDLoc(N), MVT::i32);
223223 %conv = zext i8 %0 to i32
224224 ret i32 %conv
225225 }
226
227
228 define void @test_well_formed_dag(i32 %in1, i32 %in2, i32* %addr) {
229 ; CHECK-LABEL: test_well_formed_dag:
230 ; CHECK-ARM: movw [[SMALL_CONST:r[0-9]+]], #675
231 ; CHECK-ARM: mul [[SMALL_PROD:r[0-9]+]], r0, [[SMALL_CONST]]
232 ; CHECK-ARM: add {{r[0-9]+}}, r1, [[SMALL_PROD]], lsl #7
233
234 %mul.small = mul i32 %in1, 675
235 store i32 %mul.small, i32* %addr
236 %mul.big = mul i32 %in1, 86400
237 %add = add i32 %in2, %mul.big
238 store i32 %add, i32* %addr
239 ret void
240 }