Skip to content

Commit f793de7

Browse files
committed
Don't glue users to extract_subreg when selecting the llvm.arm.ldrexd
intrinsic - it can cause impossible-to-schedule subgraphs to be introduced. PR15053. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176777 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d683edc commit f793de7

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lib/Target/ARM/ARMISelDAGToDAG.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,17 +3155,16 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
31553155
cast<MachineSDNode>(Ld)->setMemRefs(MemOp, MemOp + 1);
31563156

31573157
// Remap uses.
3158-
SDValue Glue = isThumb ? SDValue(Ld, 2) : SDValue(Ld, 1);
3158+
SDValue OutChain = isThumb ? SDValue(Ld, 2) : SDValue(Ld, 1);
31593159
if (!SDValue(N, 0).use_empty()) {
31603160
SDValue Result;
31613161
if (isThumb)
31623162
Result = SDValue(Ld, 0);
31633163
else {
31643164
SDValue SubRegIdx = CurDAG->getTargetConstant(ARM::gsub_0, MVT::i32);
31653165
SDNode *ResNode = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
3166-
dl, MVT::i32, MVT::Glue, SDValue(Ld, 0), SubRegIdx, Glue);
3166+
dl, MVT::i32, SDValue(Ld, 0), SubRegIdx);
31673167
Result = SDValue(ResNode,0);
3168-
Glue = Result.getValue(1);
31693168
}
31703169
ReplaceUses(SDValue(N, 0), Result);
31713170
}
@@ -3176,13 +3175,12 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
31763175
else {
31773176
SDValue SubRegIdx = CurDAG->getTargetConstant(ARM::gsub_1, MVT::i32);
31783177
SDNode *ResNode = CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG,
3179-
dl, MVT::i32, MVT::Glue, SDValue(Ld, 0), SubRegIdx, Glue);
3178+
dl, MVT::i32, SDValue(Ld, 0), SubRegIdx);
31803179
Result = SDValue(ResNode,0);
3181-
Glue = Result.getValue(1);
31823180
}
31833181
ReplaceUses(SDValue(N, 1), Result);
31843182
}
3185-
ReplaceUses(SDValue(N, 2), Glue);
3183+
ReplaceUses(SDValue(N, 2), OutChain);
31863184
return NULL;
31873185
}
31883186

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; RUN: llc -mtriple=armv7 < %s
2+
; PR15053
3+
4+
declare i32 @llvm.arm.strexd(i32, i32, i8*) nounwind
5+
declare { i32, i32 } @llvm.arm.ldrexd(i8*) nounwind readonly
6+
7+
define void @foo() {
8+
entry:
9+
%0 = tail call { i32, i32 } @llvm.arm.ldrexd(i8* undef) nounwind
10+
%1 = extractvalue { i32, i32 } %0, 0
11+
%2 = tail call i32 @llvm.arm.strexd(i32 %1, i32 undef, i8* undef) nounwind
12+
ret void
13+
}

0 commit comments

Comments
 (0)