Skip to content

Commit 51c22ad

Browse files
committed
implement feedback; reset polly test
1 parent 71352be commit 51c22ad

File tree

5 files changed

+69
-66
lines changed

5 files changed

+69
-66
lines changed

llvm/docs/LangRef.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9704,8 +9704,7 @@ This instruction requires several arguments:
97049704
indicates the function accepts a variable number of arguments, the
97059705
extra arguments can be specified.
97069706
#. '``fallthrough label``': the label reached when the inline assembly's
9707-
execution exits the bottom. In case of an intrinsic call, the semantic
9708-
depends on the semantic of the intrinsic.
9707+
execution exits the bottom / the intrinsic call terminates.
97099708
#. '``indirect labels``': the labels reached when a callee transfers control
97109709
to a location other than the '``fallthrough label``'. Label constraints
97119710
refer to these destinations.
@@ -9723,7 +9722,7 @@ flow goes after the call.
97239722
The output values of a '``callbr``' instruction are available both in the
97249723
the '``fallthrough``' block, and any '``indirect``' blocks(s).
97259724

9726-
The only uses of this today are:
9725+
The only current uses of this are:
97279726

97289727
#. implement the "goto" feature of gcc inline assembly where additional
97299728
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
@@ -3048,16 +3048,16 @@ bool IRTranslator::translateCallBr(const User &U,
30483048
// FIXME: inline asm not yet supported for callbr in GlobalISel As soon as we
30493049
// add support, we need to handle the indirect asm targets, see
30503050
// SelectionDAGBuilder::visitCallBr().
3051+
Intrinsic::ID IID = I.getIntrinsicID();
30513052
if (I.isInlineAsm())
30523053
return false;
3053-
if (I.getIntrinsicID() == Intrinsic::not_intrinsic)
3054+
if (IID == Intrinsic::not_intrinsic)
30543055
return false;
3055-
if (!translateTargetIntrinsic(I, I.getIntrinsicID(), MIRBuilder))
3056+
if (!translateTargetIntrinsic(I, IID, MIRBuilder))
30563057
return false;
30573058

30583059
// Retrieve successors.
3059-
SmallPtrSet<BasicBlock *, 8> Dests;
3060-
Dests.insert(I.getDefaultDest());
3060+
SmallPtrSet<BasicBlock *, 8> Dests = {I.getDefaultDest()};
30613061
MachineBasicBlock *Return = &getMBB(*I.getDefaultDest());
30623062

30633063
// Update successor info.
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)