llvm.org GIT mirror llvm / ebcaef4
[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 Weiming Zhao 6 years ago
4 changed file(s) with 26 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
1818 namespace llvm {
1919
2020 template // could be MachineInstr or MCInst
21 inline bool isV8EligibleForIT(InstrType *Instr, int BLXOperandIndex = 0) {
21 inline bool isV8EligibleForIT(InstrType *Instr) {
2222 switch (Instr->getOpcode()) {
2323 default:
2424 return false;
6969 return true;
7070 // there are some "conditionally deprecated" opcodes
7171 case ARM::tADDspr:
72 case ARM::tBLXr:
7273 return Instr->getOperand(2).getReg() != ARM::PC;
7374 // ADD PC, SP and BLX PC were always unpredictable,
7475 // now on top of it they're deprecated
7576 case ARM::tADDrSP:
7677 case ARM::tBX:
7778 return Instr->getOperand(0).getReg() != ARM::PC;
78 case ARM::tBLXr:
79 return Instr->getOperand(BLXOperandIndex).getReg() != ARM::PC;
8079 case ARM::tADDhirr:
8180 return Instr->getOperand(0).getReg() != ARM::PC &&
8281 Instr->getOperand(2).getReg() != ARM::PC;
79557955
79567956 // Only after the instruction is fully processed, we can validate it
79577957 if (wasInITBlock && hasV8Ops() && isThumb() &&
7958 !isV8EligibleForIT(&Inst, 2)) {
7958 !isV8EligibleForIT(&Inst)) {
79597959 Warning(IDLoc, "deprecated instruction in IT block");
79607960 }
79617961 }
7171 indirectbr i8* undef, [label %KBBlockZero_return_1, label %KBBlockZero_return_0]
7272 }
7373
74 @foo = global i32 ()* null
75 define i32 @t4(i32 %x, i32 ()* %p_foo) {
76 entry:
77 ;CHECK-LABEL: t4:
78 ;CHECK-V8-LABEL: t4:
79 %cmp = icmp slt i32 %x, 60
80 br i1 %cmp, label %if.then, label %if.else
81
82 if.then: ; preds = %entry
83 %tmp.2 = call i32 %p_foo()
84 %sub = add nsw i32 %x, -1
85 br label %return
86
87 if.else: ; preds = %entry
88 %sub1 = add nsw i32 %x, -120
89 br label %return
90
91 return: ; preds = %if.end5, %if.then4, %if.then
92 %retval.0 = phi i32 [ %sub, %if.then ], [ %sub1, %if.else ]
93 ret i32 %retval.0
94 }
7495
7596 ; If-converter was checking for the wrong predicate subsumes pattern when doing
7697 ; nested predicates.
None ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8
1 ; RUN: llc < %s -mtriple=thumbv8-none-linux-gnueabi | FileCheck %s
0 ; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8
1 ; RUN: llc < %s -mtriple=thumbv8-none-linux-gnueabi
22
33 %struct.LIST_NODE.0.16 = type { %struct.LIST_NODE.0.16*, i8* }
44
3030 declare void @use(i32)
3131 define double @find_max_double(i32 %n, double* nocapture readonly %aa) {
3232 entry:
33 ;CHECK-LABEL: find_max_double:
3433 br i1 undef, label %for.body, label %for.end
3534
3635 for.body: ; preds = %for.body, %entry