llvm.org GIT mirror llvm / 5236ab3
Specify MachinePointerInfo as refering to the argument value and offset of the store when handling byval arguments. Thus preventing reordering of the store with load with post-RA scheduler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164553 91177308-0d34-0410-b5e6-96231b3b80d8 Roman Divacky 7 years ago
2 changed file(s) with 32 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
20472047
20482048 SmallVector MemOps;
20492049 unsigned nAltivecParamsAtEnd = 0;
2050 for (unsigned ArgNo = 0, e = Ins.size(); ArgNo != e; ++ArgNo) {
2050 Function::const_arg_iterator FuncArg = MF.getFunction()->arg_begin();
2051 for (unsigned ArgNo = 0, e = Ins.size(); ArgNo != e; ++ArgNo, ++FuncArg) {
20512052 SDValue ArgVal;
20522053 bool needsLoad = false;
20532054 EVT ObjectVT = Ins[ArgNo].VT;
21022103 EVT ObjType = (ObjSize == 1 ? MVT::i8 :
21032104 (ObjSize == 2 ? MVT::i16 : MVT::i32));
21042105 SDValue Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN,
2105 MachinePointerInfo(),
2106 MachinePointerInfo(FuncArg,
2107 CurArgOffset),
21062108 ObjType, false, false, 0);
21072109 MemOps.push_back(Store);
21082110 ++GPR_idx;
21352137 }
21362138
21372139 SDValue Store = DAG.getStore(Val.getValue(1), dl, Shifted, FIN,
2138 MachinePointerInfo(),
2140 MachinePointerInfo(FuncArg, ArgOffset),
21392141 false, false, 0);
21402142 MemOps.push_back(Store);
21412143 ++GPR_idx;
0 ; RUN: llc < %s | FileCheck %s
1 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3
4 %struct.foo = type { i8, i8 }
5
6 define void @_Z5check3foos(%struct.foo* nocapture byval %f, i16 signext %i) noinline {
7 ; CHECK: _Z5check3foos:
8 ; CHECK: sth 3, {{[0-9]+}}(1)
9 ; CHECK: lha {{[0-9]+}}, {{[0-9]+}}(1)
10 entry:
11 %0 = bitcast %struct.foo* %f to i16*
12 %1 = load i16* %0, align 2
13 %bf.val.sext = ashr i16 %1, 8
14 %cmp = icmp eq i16 %bf.val.sext, %i
15 br i1 %cmp, label %if.end, label %if.then
16
17 if.then: ; preds = %entry
18 %conv = sext i16 %bf.val.sext to i32
19 tail call void @exit(i32 %conv)
20 br label %if.end
21
22 if.end: ; preds = %entry, %if.then
23 ret void
24 }
25
26 declare void @exit(i32)