Skip to content

Commit 26ae724

Browse files
author
git apple-llvm automerger
committed
Merge commit 'b513e1963f3a' from llvm.org/release/11.x into apple/stable/20200714
2 parents d119bb6 + b513e19 commit 26ae724

File tree

2 files changed

+51
-28
lines changed

2 files changed

+51
-28
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -171,32 +171,6 @@ static cl::opt<unsigned> SwitchPeelThreshold(
171171
// store [4096 x i8] %data, [4096 x i8]* %buffer
172172
static const unsigned MaxParallelChains = 64;
173173

174-
// Return the calling convention if the Value passed requires ABI mangling as it
175-
// is a parameter to a function or a return value from a function which is not
176-
// an intrinsic.
177-
static Optional<CallingConv::ID> getABIRegCopyCC(const Value *V) {
178-
if (auto *R = dyn_cast<ReturnInst>(V))
179-
return R->getParent()->getParent()->getCallingConv();
180-
181-
if (auto *CI = dyn_cast<CallInst>(V)) {
182-
const bool IsInlineAsm = CI->isInlineAsm();
183-
const bool IsIndirectFunctionCall =
184-
!IsInlineAsm && !CI->getCalledFunction();
185-
186-
// It is possible that the call instruction is an inline asm statement or an
187-
// indirect function call in which case the return value of
188-
// getCalledFunction() would be nullptr.
189-
const bool IsInstrinsicCall =
190-
!IsInlineAsm && !IsIndirectFunctionCall &&
191-
CI->getCalledFunction()->getIntrinsicID() != Intrinsic::not_intrinsic;
192-
193-
if (!IsInlineAsm && !IsInstrinsicCall)
194-
return CI->getCallingConv();
195-
}
196-
197-
return None;
198-
}
199-
200174
static SDValue getCopyFromPartsVector(SelectionDAG &DAG, const SDLoc &DL,
201175
const SDValue *Parts, unsigned NumParts,
202176
MVT PartVT, EVT ValueVT, const Value *V,
@@ -1638,7 +1612,7 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
16381612
unsigned InReg = FuncInfo.InitializeRegForValue(Inst);
16391613

16401614
RegsForValue RFV(*DAG.getContext(), TLI, DAG.getDataLayout(), InReg,
1641-
Inst->getType(), getABIRegCopyCC(V));
1615+
Inst->getType(), None);
16421616
SDValue Chain = DAG.getEntryNode();
16431617
return RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, nullptr, V);
16441618
}
@@ -5577,7 +5551,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
55775551
if (VMI != FuncInfo.ValueMap.end()) {
55785552
const auto &TLI = DAG.getTargetLoweringInfo();
55795553
RegsForValue RFV(V->getContext(), TLI, DAG.getDataLayout(), VMI->second,
5580-
V->getType(), getABIRegCopyCC(V));
5554+
V->getType(), None);
55815555
if (RFV.occupiesMultipleRegs()) {
55825556
splitMultiRegDbgValue(RFV.getRegsAndSizes());
55835557
return true;

llvm/test/CodeGen/ARM/pr47454.ll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=armv8-unknown-linux-unknown -mattr=-fp16 -O0 < %s | FileCheck %s
3+
4+
declare fastcc half @getConstant()
5+
6+
declare fastcc i1 @isEqual(half %0, half %1)
7+
8+
define internal fastcc void @main() {
9+
; CHECK-LABEL: main:
10+
; CHECK: @ %bb.0: @ %Entry
11+
; CHECK-NEXT: push {r11, lr}
12+
; CHECK-NEXT: mov r11, sp
13+
; CHECK-NEXT: sub sp, sp, #16
14+
; CHECK-NEXT: mov r0, #31744
15+
; CHECK-NEXT: strh r0, [r11, #-2]
16+
; CHECK-NEXT: ldrh r0, [r11, #-2]
17+
; CHECK-NEXT: bl __gnu_h2f_ieee
18+
; CHECK-NEXT: vmov s0, r0
19+
; CHECK-NEXT: vstr s0, [sp, #8] @ 4-byte Spill
20+
; CHECK-NEXT: bl getConstant
21+
; CHECK-NEXT: vmov r0, s0
22+
; CHECK-NEXT: bl __gnu_h2f_ieee
23+
; CHECK-NEXT: vmov s0, r0
24+
; CHECK-NEXT: vmov r0, s0
25+
; CHECK-NEXT: bl __gnu_f2h_ieee
26+
; CHECK-NEXT: vldr s0, [sp, #8] @ 4-byte Reload
27+
; CHECK-NEXT: vmov r1, s0
28+
; CHECK-NEXT: str r0, [sp, #4] @ 4-byte Spill
29+
; CHECK-NEXT: mov r0, r1
30+
; CHECK-NEXT: bl __gnu_f2h_ieee
31+
; CHECK-NEXT: uxth r0, r0
32+
; CHECK-NEXT: vmov s0, r0
33+
; CHECK-NEXT: ldr r0, [sp, #4] @ 4-byte Reload
34+
; CHECK-NEXT: uxth r1, r0
35+
; CHECK-NEXT: vmov s1, r1
36+
; CHECK-NEXT: bl isEqual
37+
; CHECK-NEXT: mov sp, r11
38+
; CHECK-NEXT: pop {r11, pc}
39+
Entry:
40+
; First arg directly from constant
41+
%const = alloca half, align 2
42+
store half 0xH7C00, half* %const, align 2
43+
%arg1 = load half, half* %const, align 2
44+
; Second arg from fucntion return
45+
%arg2 = call fastcc half @getConstant()
46+
; Arguments should have equivalent mangling
47+
%result = call fastcc i1 @isEqual(half %arg1, half %arg2)
48+
ret void
49+
}

0 commit comments

Comments
 (0)