Skip to content

Commit 459c008

Browse files
committed
implement feedback; reset polly test
1 parent ba9e6db commit 459c008

File tree

6 files changed

+74
-77
lines changed

6 files changed

+74
-77
lines changed

llvm/docs/LangRef.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9678,8 +9678,7 @@ This instruction requires several arguments:
96789678
indicates the function accepts a variable number of arguments, the
96799679
extra arguments can be specified.
96809680
#. '``fallthrough label``': the label reached when the inline assembly's
9681-
execution exits the bottom. In case of an intrinsic call, the semantic
9682-
depends on the semantic of the intrinsic.
9681+
execution exits the bottom / the intrinsic call terminates.
96839682
#. '``indirect labels``': the labels reached when a callee transfers control
96849683
to a location other than the '``fallthrough label``'. Label constraints
96859684
refer to these destinations.
@@ -9697,7 +9696,7 @@ flow goes after the call.
96979696
The output values of a '``callbr``' instruction are available both in the
96989697
the '``fallthrough``' block, and any '``indirect``' blocks(s).
96999698

9700-
The only uses of this today are:
9699+
The only current uses of this are:
97019700

97029701
#. implement the "goto" feature of gcc inline assembly where additional
97039702
labels can be provided as locations for the inline assembly to jump to.

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,16 +3037,16 @@ bool IRTranslator::translateCallBr(const User &U,
30373037
// FIXME: inline asm not yet supported for callbr in GlobalISel As soon as we
30383038
// add support, we need to handle the indirect asm targets, see
30393039
// SelectionDAGBuilder::visitCallBr().
3040+
Intrinsic::ID IID = I.getIntrinsicID();
30403041
if (I.isInlineAsm())
30413042
return false;
3042-
if (I.getIntrinsicID() == Intrinsic::not_intrinsic)
3043+
if (IID == Intrinsic::not_intrinsic)
30433044
return false;
3044-
if (!translateTargetIntrinsic(I, I.getIntrinsicID(), MIRBuilder))
3045+
if (!translateTargetIntrinsic(I, IID, MIRBuilder))
30453046
return false;
30463047

30473048
// Retrieve successors.
3048-
SmallPtrSet<BasicBlock *, 8> Dests;
3049-
Dests.insert(I.getDefaultDest());
3049+
SmallPtrSet<BasicBlock *, 8> Dests = {I.getDefaultDest()};
30503050
MachineBasicBlock *Return = &getMBB(*I.getDefaultDest());
30513051

30523052
// Update successor info.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5422,17 +5422,11 @@ SDVTList SelectionDAGBuilder::getTargetIntrinsicVTList(const CallBase &I,
54225422
SDValue SelectionDAGBuilder::getTargetNonMemIntrinsicNode(
54235423
const CallBase &I, bool HasChain, SmallVector<SDValue, 8> &Ops,
54245424
SDVTList &VTs) {
5425-
SDValue Result;
5426-
5427-
if (!HasChain) {
5428-
Result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurSDLoc(), VTs, Ops);
5429-
} else if (!I.getType()->isVoidTy()) {
5430-
Result = DAG.getNode(ISD::INTRINSIC_W_CHAIN, getCurSDLoc(), VTs, Ops);
5431-
} else {
5432-
Result = DAG.getNode(ISD::INTRINSIC_VOID, getCurSDLoc(), VTs, Ops);
5433-
}
5434-
5435-
return Result;
5425+
if (!HasChain)
5426+
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, getCurSDLoc(), VTs, Ops);
5427+
if (!I.getType()->isVoidTy())
5428+
return DAG.getNode(ISD::INTRINSIC_W_CHAIN, getCurSDLoc(), VTs, Ops);
5429+
return DAG.getNode(ISD::INTRINSIC_VOID, getCurSDLoc(), VTs, Ops);
54365430
}
54375431

54385432
/// Set root, convert return type if necessaey and check alignment.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
; RUN: not opt -S %s -passes=verify 2>&1 | FileCheck %s
2+
3+
declare void @llvm.amdgcn.kill(i1)
4+
5+
; CHECK: Callbr amdgcn_kill only supports one indirect dest
6+
define void @test_callbr_intrinsic_indirect0(i1 %c) {
7+
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont []
8+
kill:
9+
unreachable
10+
cont:
11+
ret void
12+
}
13+
14+
; CHECK-NEXT: Callbr amdgcn_kill only supports one indirect dest
15+
define void @test_callbr_intrinsic_indirect2(i1 %c) {
16+
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill1, label %kill2]
17+
kill1:
18+
unreachable
19+
kill2:
20+
unreachable
21+
cont:
22+
ret void
23+
}
24+
25+
; CHECK-NEXT: Callbr amdgcn_kill indirect dest needs to be unreachable
26+
define void @test_callbr_intrinsic_no_unreachable(i1 %c) {
27+
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
28+
kill:
29+
ret void
30+
cont:
31+
ret void
32+
}
33+
34+
; CHECK-NEXT: Callbr currently only supports asm-goto and selected intrinsics
35+
declare i32 @llvm.amdgcn.workitem.id.x()
36+
define void @test_callbr_intrinsic_unsupported() {
37+
callbr i32 @llvm.amdgcn.workitem.id.x() to label %cont []
38+
cont:
39+
ret void
40+
}
41+
42+
; CHECK-NEXT: Callbr: indirect function / invalid signature
43+
define void @test_callbr_intrinsic_wrong_signature(ptr %ptr) {
44+
%func = load ptr, ptr %ptr, align 8
45+
callbr void %func() to label %cont []
46+
cont:
47+
ret void
48+
}
49+
50+
; CHECK-NEXT: Callbr for intrinsics currently doesn't support operand bundles
51+
define void @test_callbr_intrinsic_no_operand_bundles(i1 %c) {
52+
callbr void @llvm.amdgcn.kill(i1 %c) [ "foo"(i1 %c) ] to label %cont [label %kill]
53+
kill:
54+
unreachable
55+
cont:
56+
ret void
57+
}

llvm/test/Verifier/callbr.ll

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -120,59 +120,3 @@ landingpad:
120120
%out = call i32 @llvm.callbr.landingpad.i32(i32 %0)
121121
ret i32 %out
122122
}
123-
124-
declare void @llvm.amdgcn.kill(i1)
125-
126-
; CHECK-NEXT: Callbr amdgcn_kill only supports one indirect dest
127-
define void @test_callbr_intrinsic_indirect0(i1 %c) {
128-
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont []
129-
kill:
130-
unreachable
131-
cont:
132-
ret void
133-
}
134-
135-
; CHECK-NEXT: Callbr amdgcn_kill only supports one indirect dest
136-
define void @test_callbr_intrinsic_indirect2(i1 %c) {
137-
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill1, label %kill2]
138-
kill1:
139-
unreachable
140-
kill2:
141-
unreachable
142-
cont:
143-
ret void
144-
}
145-
146-
; CHECK-NEXT: Callbr amdgcn_kill indirect dest needs to be unreachable
147-
define void @test_callbr_intrinsic_no_unreachable(i1 %c) {
148-
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
149-
kill:
150-
ret void
151-
cont:
152-
ret void
153-
}
154-
155-
; CHECK-NEXT: Callbr currently only supports asm-goto and selected intrinsics
156-
declare i32 @llvm.amdgcn.workitem.id.x()
157-
define void @test_callbr_intrinsic_unsupported() {
158-
callbr i32 @llvm.amdgcn.workitem.id.x() to label %cont []
159-
cont:
160-
ret void
161-
}
162-
163-
; CHECK-NEXT: Callbr: indirect function / invalid signature
164-
define void @test_callbr_intrinsic_wrong_signature(ptr %ptr) {
165-
%func = load ptr, ptr %ptr, align 8
166-
callbr void %func() to label %cont []
167-
cont:
168-
ret void
169-
}
170-
171-
; CHECK-NEXT: Callbr for intrinsics currently doesn't support operand bundles
172-
define void @test_callbr_intrinsic_no_operand_bundles(i1 %c) {
173-
callbr void @llvm.amdgcn.kill(i1 %c) [ "foo"(i1 %c) ] to label %cont [label %kill]
174-
kill:
175-
unreachable
176-
cont:
177-
ret void
178-
}

polly/test/ScopDetect/callbr.ll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
; RUN: opt %loadNPMPolly '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s
1+
; RUN: opt %loadNPMPolly '-passes=print<polly-detect>' -polly-detect-track-failures -disable-output -pass-remarks-missed=polly-detect < %s 2>&1 | FileCheck %s --check-prefix=REMARK
2+
; RUN: opt %loadNPMPolly '-passes=print<polly-detect>' -polly-detect-track-failures -disable-output -stats < %s 2>&1 | FileCheck %s --check-prefix=STAT
3+
; REQUIRES: asserts
24

3-
; CHECK-LABEL: func
4-
; CHECK-NOT: Valid
5+
; REMARK: Branch from indirect terminator.
6+
7+
; STAT: 1 polly-detect - Number of rejected regions: Branch from indirect terminator
58

69

710
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)