xref: /llvm-project/llvm/test/CodeGen/NVPTX/calls-with-phi.ll (revision b279f6b098d3849f7f1c1f539b108307d5f8ae2d)
1; RUN: llc < %s -mtriple=nvptx64 2>&1 | FileCheck %s
2; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 | %ptxas-verify %}
3
4; Make sure the example doesn't crash with segfault
5
6; CHECK: .visible .func ({{.*}}) loop
7define i32 @loop(i32, i32) {
8entry:
9  br label %loop
10
11loop:
12  %i = phi i32 [ %0, %entry ], [ %res, %loop ]
13  %res = call i32 @div(i32 %i, i32 %1)
14
15  %exitcond = icmp eq i32 %res, %0
16  br i1 %exitcond, label %exit, label %loop
17
18exit:
19  ret i32 %res
20}
21
22define i32 @div(i32, i32) {
23  ret i32 0
24}
25