Skip to content

Commit 2c46ca9

Browse files
author
Chen Zheng
committed
[PowerPC] fast isel can lower intrinsics call on AIX.
Reviewed By: qiucf Differential Revision: https://reviews.llvm.org/D114778
1 parent a500f7f commit 2c46ca9

File tree

3 files changed

+58
-11
lines changed

3 files changed

+58
-11
lines changed

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,12 +1775,13 @@ bool FastISel::selectOperator(const User *I, unsigned Opcode) {
17751775
return false;
17761776

17771777
case Instruction::Call:
1778-
// On AIX, call lowering uses the DAG-ISEL path currently so that the
1778+
// On AIX, normal call lowering uses the DAG-ISEL path currently so that the
17791779
// callee of the direct function call instruction will be mapped to the
17801780
// symbol for the function's entry point, which is distinct from the
17811781
// function descriptor symbol. The latter is the symbol whose XCOFF symbol
17821782
// name is the C-linkage name of the source level function.
1783-
if (TM.getTargetTriple().isOSAIX())
1783+
// But fast isel still has the ability to do selection for intrinsics.
1784+
if (TM.getTargetTriple().isOSAIX() && !isa<IntrinsicInst>(I))
17841785
return false;
17851786
return selectCall(I);
17861787

llvm/lib/Target/PowerPC/PPCFastISel.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,15 +1966,6 @@ bool PPCFastISel::fastSelectInstruction(const Instruction *I) {
19661966
return SelectBinaryIntOp(I, ISD::OR);
19671967
case Instruction::Sub:
19681968
return SelectBinaryIntOp(I, ISD::SUB);
1969-
case Instruction::Call:
1970-
// On AIX, call lowering uses the DAG-ISEL path currently so that the
1971-
// callee of the direct function call instruction will be mapped to the
1972-
// symbol for the function's entry point, which is distinct from the
1973-
// function descriptor symbol. The latter is the symbol whose XCOFF symbol
1974-
// name is the C-linkage name of the source level function.
1975-
if (TM.getTargetTriple().isOSAIX())
1976-
break;
1977-
return selectCall(I);
19781969
case Instruction::Ret:
19791970
return SelectRet(I);
19801971
case Instruction::Trunc:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
; RUN: llc < %s -mtriple powerpc64-ibm-aix-xcoff | FileCheck %s --check-prefix=CHECKASM
2+
3+
; This is a case copied from test/DebugInfo/Generic/debug-label-mi.ll. This test
4+
; is to explicitly check that fast isel for XCOFF works as expected for debug
5+
; related intrinsics.
6+
7+
; CHECKASM: DEBUG_LABEL: foo:top
8+
; CHECKASM: DEBUG_LABEL: foo:done
9+
10+
source_filename = "debug-label-mi.c"
11+
12+
; Function Attrs: noinline nounwind optnone
13+
define i32 @foo(i32 signext %a, i32 signext %b) #0 !dbg !4 {
14+
entry:
15+
%a.addr = alloca i32, align 4
16+
%b.addr = alloca i32, align 4
17+
%sum = alloca i32, align 4
18+
store i32 %a, i32* %a.addr, align 4
19+
store i32 %b, i32* %b.addr, align 4
20+
br label %top
21+
22+
top: ; preds = %entry
23+
call void @llvm.dbg.label(metadata !8), !dbg !9
24+
%0 = load i32, i32* %a.addr, align 4
25+
%1 = load i32, i32* %b.addr, align 4
26+
%add = add nsw i32 %0, %1
27+
store i32 %add, i32* %sum, align 4
28+
br label %done
29+
30+
done: ; preds = %top
31+
call void @llvm.dbg.label(metadata !10), !dbg !11
32+
%2 = load i32, i32* %sum, align 4
33+
ret i32 %2
34+
}
35+
36+
; Function Attrs: nounwind readnone speculatable
37+
declare void @llvm.dbg.label(metadata)
38+
39+
attributes #0 = { noinline nounwind optnone uwtable }
40+
41+
!llvm.dbg.cu = !{!0}
42+
!llvm.module.flags = !{!3}
43+
44+
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: FullDebug, enums: !2)
45+
!1 = !DIFile(filename: "debug-label-mi.c", directory: "./")
46+
!2 = !{}
47+
!3 = !{i32 2, !"Debug Info Version", i32 3}
48+
!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
49+
!5 = !DISubroutineType(types: !6)
50+
!6 = !{!7, !7, !7}
51+
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
52+
!8 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
53+
!9 = !DILocation(line: 4, column: 1, scope: !4)
54+
!10 = !DILabel(scope: !4, name: "done", file: !1, line: 7)
55+
!11 = !DILocation(line: 7, column: 1, scope: !4)

0 commit comments

Comments
 (0)