• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -simplifycfg < %s | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5@GV = external constant i64*
6
7define i64* @test1(i1 %cond, i8* %P) {
8entry:
9  br i1 %cond, label %if, label %then
10
11then:
12  %bc = bitcast i8* %P to i64*
13  br label %join
14
15if:
16  %load = load i64*, i64** @GV, align 8, !dereferenceable !0
17  br label %join
18
19join:
20  %phi = phi i64* [ %bc, %then ], [ %load, %if ]
21  ret i64* %phi
22}
23
24; CHECK-LABEL: define i64* @test1(
25; CHECK: %[[bc:.*]] = bitcast i8* %P to i64*
26; CHECK: %[[load:.*]] = load i64*, i64** @GV, align 8{{$}}
27; CHECK: %[[phi:.*]] = select i1 %cond, i64* %[[load]], i64* %[[bc]]
28; CHECK: ret i64* %[[phi]]
29
30
31!0 = !{i64 8}
32