1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - %s -march=nvptx64 -mcpu=sm_35 -run-pass=branch-folder | FileCheck %s
5 ; ModuleID = '/mnt/nas/asavonic/work/llvm/llvm/test/CodeGen/NVPTX/branch-fold.ll'
6 source_filename = "/mnt/nas/asavonic/work/llvm/llvm/test/CodeGen/NVPTX/branch-fold.ll"
7 target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
8 target triple = "nvptx64-nvidia-cuda"
10 define ptx_kernel void @hoge() {
12 br i1 undef, label %bb1.preheader, label %bb4.preheader
14 bb1.preheader: ; preds = %bb
17 bb1: ; preds = %bb1.preheader, %bb1
18 %lsr.iv = phi i64 [ undef, %bb1.preheader ], [ %lsr.iv.next, %bb1 ]
19 %lsr.iv.next = add i64 %lsr.iv, 1
20 %tmp3 = icmp sle i64 %lsr.iv.next, 0
21 br i1 %tmp3, label %bb1, label %bb4.preheader
23 bb4.preheader: ; preds = %bb1, %bb
26 bb4: ; preds = %bb4.preheader, %bb4
34 tracksRegLiveness: true
36 - { id: 0, class: int64regs }
37 - { id: 1, class: int64regs }
38 - { id: 2, class: int1regs }
39 - { id: 3, class: int64regs }
40 - { id: 4, class: int1regs }
41 - { id: 5, class: int64regs }
44 machineFunctionInfo: {}
46 ; CHECK-LABEL: name: hoge
48 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.3(0x40000000)
50 ; CHECK-NEXT: CBranch undef %2:int1regs, %bb.3
52 ; CHECK-NEXT: bb.1.bb1.preheader:
53 ; CHECK-NEXT: successors: %bb.2(0x80000000)
55 ; CHECK-NEXT: [[DEF:%[0-9]+]]:int64regs = IMPLICIT_DEF
57 ; CHECK-NEXT: bb.2.bb1:
58 ; CHECK-NEXT: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
60 ; CHECK-NEXT: [[ADDi64ri:%[0-9]+]]:int64regs = ADDi64ri [[ADDi64ri]], 1
61 ; CHECK-NEXT: [[SETP_s64ri:%[0-9]+]]:int1regs = SETP_s64ri [[ADDi64ri]], 1, 2
62 ; CHECK-NEXT: CBranch [[SETP_s64ri]], %bb.2
64 ; CHECK-NEXT: bb.3.bb4:
65 ; CHECK-NEXT: successors: %bb.3(0x80000000)
67 ; CHECK-NEXT: GOTO %bb.3
69 successors: %bb.1, %bb.3
71 CBranch undef %2:int1regs, %bb.3
74 %5:int64regs = IMPLICIT_DEF
77 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
79 %5:int64regs = ADDi64ri %5, 1
80 %4:int1regs = SETP_s64ri %5, 1, 2