Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit ebcaef4

Browse files
author
Weiming Zhao
committed
[Thumbv8] Fix the value of BLXOperandIndex of isV8EligibleForIT
Originally, BLX was passed as operand #0 in MachineInstr and as operand #2 in MCInst. But now, it's operand #2 in both cases. This patch also removes unnecessary FileCheck in the test case added by r199127. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199928 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 67e9927 commit ebcaef4

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

lib/Target/ARM/ARMFeatures.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
namespace llvm {
2020

2121
template<typename InstrType> // could be MachineInstr or MCInst
22-
inline bool isV8EligibleForIT(InstrType *Instr, int BLXOperandIndex = 0) {
22+
inline bool isV8EligibleForIT(InstrType *Instr) {
2323
switch (Instr->getOpcode()) {
2424
default:
2525
return false;
@@ -70,14 +70,13 @@ inline bool isV8EligibleForIT(InstrType *Instr, int BLXOperandIndex = 0) {
7070
return true;
7171
// there are some "conditionally deprecated" opcodes
7272
case ARM::tADDspr:
73+
case ARM::tBLXr:
7374
return Instr->getOperand(2).getReg() != ARM::PC;
7475
// ADD PC, SP and BLX PC were always unpredictable,
7576
// now on top of it they're deprecated
7677
case ARM::tADDrSP:
7778
case ARM::tBX:
7879
return Instr->getOperand(0).getReg() != ARM::PC;
79-
case ARM::tBLXr:
80-
return Instr->getOperand(BLXOperandIndex).getReg() != ARM::PC;
8180
case ARM::tADDhirr:
8281
return Instr->getOperand(0).getReg() != ARM::PC &&
8382
Instr->getOperand(2).getReg() != ARM::PC;

lib/Target/ARM/AsmParser/ARMAsmParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7956,7 +7956,7 @@ MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
79567956

79577957
// Only after the instruction is fully processed, we can validate it
79587958
if (wasInITBlock && hasV8Ops() && isThumb() &&
7959-
!isV8EligibleForIT(&Inst, 2)) {
7959+
!isV8EligibleForIT(&Inst)) {
79607960
Warning(IDLoc, "deprecated instruction in IT block");
79617961
}
79627962
}

test/CodeGen/ARM/2013-05-05-IfConvertBug.ll

+21
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ KBBlockZero.exit: ; preds = %bb2.i
7272
indirectbr i8* undef, [label %KBBlockZero_return_1, label %KBBlockZero_return_0]
7373
}
7474

75+
@foo = global i32 ()* null
76+
define i32 @t4(i32 %x, i32 ()* %p_foo) {
77+
entry:
78+
;CHECK-LABEL: t4:
79+
;CHECK-V8-LABEL: t4:
80+
%cmp = icmp slt i32 %x, 60
81+
br i1 %cmp, label %if.then, label %if.else
82+
83+
if.then: ; preds = %entry
84+
%tmp.2 = call i32 %p_foo()
85+
%sub = add nsw i32 %x, -1
86+
br label %return
87+
88+
if.else: ; preds = %entry
89+
%sub1 = add nsw i32 %x, -120
90+
br label %return
91+
92+
return: ; preds = %if.end5, %if.then4, %if.then
93+
%retval.0 = phi i32 [ %sub, %if.then ], [ %sub1, %if.else ]
94+
ret i32 %retval.0
95+
}
7596

7697
; If-converter was checking for the wrong predicate subsumes pattern when doing
7798
; nested predicates.

test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8
2-
; RUN: llc < %s -mtriple=thumbv8-none-linux-gnueabi | FileCheck %s
1+
; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8
2+
; RUN: llc < %s -mtriple=thumbv8-none-linux-gnueabi
33

44
%struct.LIST_NODE.0.16 = type { %struct.LIST_NODE.0.16*, i8* }
55

@@ -31,7 +31,6 @@ bb5: ; preds = %bb3, %bb
3131
declare void @use(i32)
3232
define double @find_max_double(i32 %n, double* nocapture readonly %aa) {
3333
entry:
34-
;CHECK-LABEL: find_max_double:
3534
br i1 undef, label %for.body, label %for.end
3635

3736
for.body: ; preds = %for.body, %entry

0 commit comments

Comments
 (0)