reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
; RUN: opt -S -newgvn %s | FileCheck %s

; CHECK: define i32 @main() {
; CHECK-NEXT: entry:
; CHECK-NEXT:   %tmp = load i32, i32* @d, align 4
; CHECK-NEXT:   %tmp1 = load i32, i32* @c, align 4
; CHECK-NEXT:   %tobool = icmp eq i32 %tmp1, -1
; CHECK-NEXT:   br i1 %tobool, label %if.end, label %if.then
; CHECK: if.then:
; CHECK-NEXT:   br label %L
; CHECK: L:
; CHECK-NEXT:   %e.0 = phi i32 [ 0, %if.then ], [ %e.1, %if.then4 ]
; CHECK-NEXT:   br label %if.end
; CHECK: if.end:
; CHECK-NEXT:   %e.1 = phi i32 [ %e.0, %L ], [ %tmp, %entry ]
; CHECK-NEXT:   store i32 %e.1, i32* @a, align 4
; CHECK-NEXT:   %tmp2 = load i32, i32* @b, align 4
; CHECK-NEXT:   store i32 0, i32* @b, align 4
; CHECK-NEXT:   %sext = shl i32 %tmp2, 16
; CHECK-NEXT:   %conv1 = ashr exact i32 %sext, 16
; CHECK-NEXT:   %add = add nsw i32 %conv1, %tmp1
; CHECK-NEXT:   %add2 = add nsw i32 %add, %e.1
; CHECK-NEXT:   store i32 %add2, i32* @a, align 4
; CHECK-NEXT:   %tobool3 = icmp eq i32 %add2, 0
; CHECK-NEXT:   br i1 %tobool3, label %if.end5, label %if.then4
; CHECK: if.then4:
; CHECK-NEXT:   br label %L
; CHECK: if.end5:
; CHECK-NEXT:   ret i32 0
; CHECK-NEXT: }

@d = global i32 1, align 4
@c = common global i32 0, align 4
@a = common global i32 0, align 4
@b = common global i32 0, align 4

define i32 @main() {
entry:
  %tmp = load i32, i32* @d, align 4
  %tmp1 = load i32, i32* @c, align 4
  %tobool = icmp eq i32 %tmp1, -1
  br i1 %tobool, label %if.end, label %if.then

if.then:                                          ; preds = %entry
  br label %L

L:                                                ; preds = %if.then4, %if.then
  %e.0 = phi i32 [ 0, %if.then ], [ %e.1, %if.then4 ]
  br label %if.end

if.end:                                           ; preds = %L, %entry
  %e.1 = phi i32 [ %e.0, %L ], [ %tmp, %entry ]
  store i32 %e.1, i32* @a, align 4
  %tmp2 = load i32, i32* @b, align 4
  store i32 0, i32* @b, align 4
  %sext = shl i32 %tmp2, 16
  %conv1 = ashr exact i32 %sext, 16
  %tmp3 = load i32, i32* @c, align 4
  %add = add nsw i32 %conv1, %tmp3
  %tmp4 = load i32, i32* @a, align 4
  %and = and i32 %tmp4, %e.1
  %add2 = add nsw i32 %add, %and
  store i32 %add2, i32* @a, align 4
  %tobool3 = icmp eq i32 %add2, 0
  br i1 %tobool3, label %if.end5, label %if.then4

if.then4:                                         ; preds = %if.end
  br label %L

if.end5:                                          ; preds = %if.end
  ret i32 0
}