From d0f60004ecb9c9637127a079adc2dae54382afa9 Mon Sep 17 00:00:00 2001 From: Igor Breger Date: Mon, 21 Aug 2017 08:59:59 +0000 Subject: [PATCH] [GlobalISel][X86] LowerCall, for now don't handel ByValue function arguments. llvm-svn: 311321 --- lib/Target/X86/X86CallLowering.cpp | 5 +++++ test/CodeGen/X86/GlobalISel/x86_64-fallback.ll | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/Target/X86/X86CallLowering.cpp b/lib/Target/X86/X86CallLowering.cpp index cbe9e60864d..1a3f00cc250 100644 --- a/lib/Target/X86/X86CallLowering.cpp +++ b/lib/Target/X86/X86CallLowering.cpp @@ -322,6 +322,11 @@ bool X86CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, SmallVector SplitArgs; for (const auto &OrigArg : OrigArgs) { + + // TODO: handle not simple cases. + if (OrigArg.Flags.isByVal()) + return false; + if (!splitToValueTypes(OrigArg, SplitArgs, DL, MRI, [&](ArrayRef Regs) { MIRBuilder.buildUnmerge(Regs, OrigArg.Reg); diff --git a/test/CodeGen/X86/GlobalISel/x86_64-fallback.ll b/test/CodeGen/X86/GlobalISel/x86_64-fallback.ll index 2743f882b2e..4427d91acbc 100644 --- a/test/CodeGen/X86/GlobalISel/x86_64-fallback.ll +++ b/test/CodeGen/X86/GlobalISel/x86_64-fallback.ll @@ -16,3 +16,14 @@ define void @test_x86_fp80_dump(x86_fp80* %ptr){ ret void } +; Check that we fallback on byVal argument +; FALLBACK-WITH-REPORT-ERR: remark: :0:0: unable to translate instruction: call: ' call void @ScaleObjectOverwrite_3(%struct.PointListStruct* %index, %struct.PointListStruct* byval %index)' (in function: ScaleObjectOverwrite_2) +; FALLBACK-WITH-REPORT-ERR: warning: Instruction selection used fallback path for ScaleObjectOverwrite_2 +; FALLBACK-WITH-REPORT-OUT-LABEL: ScaleObjectOverwrite_2: +%struct.PointListStruct = type { i8*, i8* } +declare void @ScaleObjectOverwrite_3(%struct.PointListStruct* %index, %struct.PointListStruct* byval %index2) +define void @ScaleObjectOverwrite_2(%struct.PointListStruct* %index) { +entry: + call void @ScaleObjectOverwrite_3(%struct.PointListStruct* %index, %struct.PointListStruct* byval %index) + ret void +}