mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Do not issue identity copies.
llvm-svn: 52373
This commit is contained in:
parent
c1fd5f170b
commit
8cfd1d39a1
@ -108,15 +108,20 @@ bool LowerSubregsInstructionPass::LowerSubregToReg(MachineInstr *MI) {
|
||||
|
||||
DOUT << "subreg: CONVERTING: " << *MI;
|
||||
|
||||
// Insert sub-register copy
|
||||
const TargetRegisterClass *TRC0 = TRI.getPhysicalRegisterRegClass(DstSubReg);
|
||||
const TargetRegisterClass *TRC1 = TRI.getPhysicalRegisterRegClass(InsReg);
|
||||
TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
|
||||
if (DstSubReg == InsReg) {
|
||||
// No need to insert an identify copy instruction.
|
||||
DOUT << "subreg: eliminated!";
|
||||
} else {
|
||||
// Insert sub-register copy
|
||||
const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg);
|
||||
const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg);
|
||||
TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
|
||||
|
||||
#ifndef NDEBUG
|
||||
MachineBasicBlock::iterator dMI = MI;
|
||||
DOUT << "subreg: " << *(--dMI);
|
||||
MachineBasicBlock::iterator dMI = MI;
|
||||
DOUT << "subreg: " << *(--dMI);
|
||||
#endif
|
||||
}
|
||||
|
||||
DOUT << "\n";
|
||||
MBB->remove(MI);
|
||||
@ -149,15 +154,19 @@ bool LowerSubregsInstructionPass::LowerInsert(MachineInstr *MI) {
|
||||
|
||||
DOUT << "subreg: CONVERTING: " << *MI;
|
||||
|
||||
// Insert sub-register copy
|
||||
const TargetRegisterClass *TRC0 = TRI.getPhysicalRegisterRegClass(DstSubReg);
|
||||
const TargetRegisterClass *TRC1 = TRI.getPhysicalRegisterRegClass(InsReg);
|
||||
TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
|
||||
|
||||
if (DstSubReg == InsReg) {
|
||||
// No need to insert an identify copy instruction.
|
||||
DOUT << "subreg: eliminated!";
|
||||
} else {
|
||||
// Insert sub-register copy
|
||||
const TargetRegisterClass *TRC0= TRI.getPhysicalRegisterRegClass(DstSubReg);
|
||||
const TargetRegisterClass *TRC1= TRI.getPhysicalRegisterRegClass(InsReg);
|
||||
TII.copyRegToReg(*MBB, MI, DstSubReg, InsReg, TRC0, TRC1);
|
||||
#ifndef NDEBUG
|
||||
MachineBasicBlock::iterator dMI = MI;
|
||||
DOUT << "subreg: " << *(--dMI);
|
||||
MachineBasicBlock::iterator dMI = MI;
|
||||
DOUT << "subreg: " << *(--dMI);
|
||||
#endif
|
||||
}
|
||||
|
||||
DOUT << "\n";
|
||||
MBB->remove(MI);
|
||||
|
14
test/CodeGen/X86/2008-06-16-SubregsBug.ll
Normal file
14
test/CodeGen/X86/2008-06-16-SubregsBug.ll
Normal file
@ -0,0 +1,14 @@
|
||||
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep mov | count 4
|
||||
|
||||
define i16 @test(i16* %tmp179) nounwind {
|
||||
%tmp180 = load i16* %tmp179, align 2 ; <i16> [#uses=2]
|
||||
%tmp184 = and i16 %tmp180, -1024 ; <i16> [#uses=1]
|
||||
%tmp186 = icmp eq i16 %tmp184, -32768 ; <i1> [#uses=1]
|
||||
br i1 %tmp186, label %bb189, label %bb288
|
||||
|
||||
bb189: ; preds = %0
|
||||
ret i16 %tmp180
|
||||
|
||||
bb288: ; preds = %0
|
||||
ret i16 32
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user