mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Fix SDISel lowering of PHI nodes to use ComputeValueVTs.
This allows it to work correctly on aggregate values. This fixes PR2623. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54331 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1f565bcff6
commit
6f498b0a8e
@ -444,13 +444,19 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli,
|
||||
for (BasicBlock::iterator I = BB->begin();(PN = dyn_cast<PHINode>(I)); ++I){
|
||||
if (PN->use_empty()) continue;
|
||||
|
||||
MVT VT = TLI.getValueType(PN->getType());
|
||||
unsigned NumRegisters = TLI.getNumRegisters(VT);
|
||||
unsigned PHIReg = ValueMap[PN];
|
||||
assert(PHIReg && "PHI node does not have an assigned virtual register!");
|
||||
const TargetInstrInfo *TII = TLI.getTargetMachine().getInstrInfo();
|
||||
for (unsigned i = 0; i != NumRegisters; ++i)
|
||||
BuildMI(MBB, TII->get(TargetInstrInfo::PHI), PHIReg+i);
|
||||
|
||||
SmallVector<MVT, 4> ValueVTs;
|
||||
ComputeValueVTs(TLI, PN->getType(), ValueVTs);
|
||||
for (unsigned vti = 0, vte = ValueVTs.size(); vti != vte; ++vti) {
|
||||
MVT VT = ValueVTs[vti];
|
||||
unsigned NumRegisters = TLI.getNumRegisters(VT);
|
||||
const TargetInstrInfo *TII = TLI.getTargetMachine().getInstrInfo();
|
||||
for (unsigned i = 0; i != NumRegisters; ++i)
|
||||
BuildMI(MBB, TII->get(TargetInstrInfo::PHI), PHIReg+i);
|
||||
PHIReg += NumRegisters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5199,10 +5205,15 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
|
||||
|
||||
// Remember that this register needs to added to the machine PHI node as
|
||||
// the input for this MBB.
|
||||
MVT VT = TLI.getValueType(PN->getType());
|
||||
unsigned NumRegisters = TLI.getNumRegisters(VT);
|
||||
for (unsigned i = 0, e = NumRegisters; i != e; ++i)
|
||||
PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i));
|
||||
SmallVector<MVT, 4> ValueVTs;
|
||||
ComputeValueVTs(TLI, PN->getType(), ValueVTs);
|
||||
for (unsigned vti = 0, vte = ValueVTs.size(); vti != vte; ++vti) {
|
||||
MVT VT = ValueVTs[vti];
|
||||
unsigned NumRegisters = TLI.getNumRegisters(VT);
|
||||
for (unsigned i = 0, e = NumRegisters; i != e; ++i)
|
||||
PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i));
|
||||
Reg += NumRegisters;
|
||||
}
|
||||
}
|
||||
}
|
||||
ConstantsOut.clear();
|
||||
|
44
test/CodeGen/X86/pr2623.ll
Normal file
44
test/CodeGen/X86/pr2623.ll
Normal file
@ -0,0 +1,44 @@
|
||||
; RUN: llvm-as < %s | llc
|
||||
; PR2623
|
||||
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
||||
target triple = "i386-unknown-freebsd7.0"
|
||||
%.objc_id = type { %.objc_id }*
|
||||
%.objc_selector = type { i8*, i8* }*
|
||||
@.objc_sel_ptr = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr13 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr14 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr15 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr16 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr17 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr18 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr19 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr20 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
@.objc_sel_ptr21 = external constant %.objc_selector ; <%.objc_selector*> [#uses=1]
|
||||
|
||||
@.objc_untyped_selector_alias = alias internal %.objc_selector* @.objc_sel_ptr15 ; <%.objc_selector*> [#uses=0]
|
||||
@.objc_untyped_selector_alias1 = alias internal %.objc_selector* @.objc_sel_ptr ; <%.objc_selector*> [#uses=0]
|
||||
@.objc_untyped_selector_alias2 = alias internal %.objc_selector* @.objc_sel_ptr17 ; <%.objc_selector*> [#uses=0]
|
||||
@.objc_untyped_selector_alias3 = alias internal %.objc_selector* @.objc_sel_ptr16 ; <%.objc_selector*> [#uses=0]
|
||||
@.objc_untyped_selector_alias4 = alias internal %.objc_selector* @.objc_sel_ptr13 ; <%.objc_selector*> [#uses=0]
|
||||
@.objc_untyped_selector_alias7 = alias internal %.objc_selector* @.objc_sel_ptr14 ; <%.objc_selector*> [#uses=0]
|
||||
@getRange = alias internal %.objc_selector* @.objc_sel_ptr18 ; <%.objc_selector*> [#uses=0]
|
||||
@"valueWithRange:" = alias internal %.objc_selector* @.objc_sel_ptr21 ; <%.objc_selector*> [#uses=0]
|
||||
@rangeValue = alias internal %.objc_selector* @.objc_sel_ptr20 ; <%.objc_selector*> [#uses=0]
|
||||
@"printRange:" = alias internal %.objc_selector* @.objc_sel_ptr19 ; <%.objc_selector*> [#uses=0]
|
||||
|
||||
define void @"._objc_method_SmalltalkTool()-run"(i8* %self, %.objc_selector %_cmd) {
|
||||
entry:
|
||||
br i1 false, label %small_int_messagerangeValue, label %real_object_messagerangeValue
|
||||
|
||||
small_int_messagerangeValue: ; preds = %entry
|
||||
br label %Continue
|
||||
|
||||
real_object_messagerangeValue: ; preds = %entry
|
||||
br label %Continue
|
||||
|
||||
Continue: ; preds = %real_object_messagerangeValue, %small_int_messagerangeValue
|
||||
%rangeValue = phi { i32, i32 } [ undef, %small_int_messagerangeValue ], [ undef, %real_object_messagerangeValue ] ; <{ i32, i32 }> [#uses=1]
|
||||
call void (%.objc_id, %.objc_selector, ...)* null( %.objc_id null, %.objc_selector null, { i32, i32 } %rangeValue )
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user