mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Fix not correct imm operand assertion for SUB32ri in X86CondBrFolding::analyzeCompare
Summary: When doing X86CondBrFolding::analyzeCompare, it will meet the SUB32ri instruction as below to use the global address for its operand, %733:gr32 = SUB32ri %62:gr32(tied-def 0), @img2buf_normal, implicit-def $eflags JNE_1 %bb.41, implicit $eflags so the assertion "assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand")" is not correct and change the assert to if make X86CondBrFolding::analyzeCompare return false as not finding the compare for this Patch by Jianping Chen Reviewers: smaslov, LuoYuanke, liutianle, Jianping Reviewed By: Jianping Subscribers: lebedev.ri, llvm-commits Differential Revision: https://reviews.llvm.org/D54250 llvm-svn: 348853
This commit is contained in:
parent
b4996575fa
commit
0b7311fee6
@ -468,7 +468,8 @@ bool X86CondBrFolding::analyzeCompare(const MachineInstr &MI, unsigned &SrcReg,
|
||||
break;
|
||||
}
|
||||
SrcReg = MI.getOperand(SrcRegIndex).getReg();
|
||||
assert(MI.getOperand(ValueIndex).isImm() && "Expecting Imm operand");
|
||||
if (!MI.getOperand(ValueIndex).isImm())
|
||||
return false;
|
||||
CmpValue = MI.getOperand(ValueIndex).getImm();
|
||||
return true;
|
||||
}
|
||||
|
30
test/CodeGen/X86/test_x86condbr_globaladdr.mir
Normal file
30
test/CodeGen/X86/test_x86condbr_globaladdr.mir
Normal file
@ -0,0 +1,30 @@
|
||||
# RUN: llc -o - %s -mtriple=i686-- -mcpu=ivybridge --run-pass X86CondBrFolding | FileCheck %s
|
||||
|
||||
# Test wrong assertion when meet SUB32ri with global address
|
||||
# in X86CondBrFoldingiPass
|
||||
--- |
|
||||
@img2buf_normal = external global i32
|
||||
define void @func() { ret void }
|
||||
...
|
||||
---
|
||||
# CHECK: bb.0:
|
||||
# CHECK: %2:gr32 = SUB32ri %1, @img2buf_normal, implicit-def $eflags
|
||||
|
||||
name: func
|
||||
tracksRegLiveness: true
|
||||
body: |
|
||||
bb.0:
|
||||
liveins: $edx
|
||||
%1:gr32 = COPY $edx
|
||||
%2:gr32 = MOV32rm %1:gr32, 1, $noreg, 850256, $noreg
|
||||
%3:gr32 = SUB32ri %2:gr32, @img2buf_normal, implicit-def $eflags
|
||||
JE_1 %bb.2, implicit $eflags
|
||||
JMP_1 %bb.3
|
||||
|
||||
bb.2:
|
||||
RET 0, undef $eax
|
||||
|
||||
bb.3:
|
||||
$eax = MOV32rr %3:gr32
|
||||
RET 0, $eax
|
||||
...
|
Loading…
Reference in New Issue
Block a user