• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -mem2reg -simplifycfg -S | FileCheck -enable-var-scope %s
2
3define i32 @test(i32 %x) {
4; CHECK-LABEL: @test
5entry:
6  %y = alloca i32, align 4
7  %tobool = icmp ne i32 %x, 0
8  br i1 %tobool, label %if.then, label %if.else
9
10if.then:
11; CHECK: if.then:
12; CHECK: [[ASM1:%.*]] = call i32 asm "mov $0, #1", "=r"()
13  %tmp1 = call i32 asm "mov $0, #1", "=r"() nounwind readnone
14  store i32 %tmp1, i32* %y, align 4
15  br label %if.end
16
17if.else:
18; CHECK: if.else:
19; CHECK: [[ASM2:%.*]] = call i32 asm "mov $0, #2", "=r"()
20  %tmp2 = call i32 asm "mov $0, #2", "=r"() nounwind readnone
21  store i32 %tmp2, i32* %y, align 4
22  br label %if.end
23
24if.end:
25; CHECK: if.end:
26; CHECK: {{%.*}} = phi i32 [ [[ASM1]], %if.then ], [ [[ASM2]], %if.else ]
27  %tmp3 = load i32, i32* %y, align 4
28  ret i32 %tmp3
29}
30