1 ; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
3 define i16 @test1(i8 %x) {
5 %B = sext i12 %A to i16
6 ; CHECK: zext i8 %x to i16
10 define i8 @test2(i8 %x) {
11 %A = zext i8 %x to i16
13 %C = trunc i16 %B to i8
18 define i8 @test3(i8 %x) {
19 %A = zext i8 %x to i16
21 %C = trunc i16 %B to i8
26 define void @test4(i32 %x, i32 %y) {
31 %A = phi i32 [0, %entry], [%I, %loop]
32 %rand1 = icmp sgt i32 %A, %Y
33 %Z1 = select i1 %rand1, i32 %A, i32 %Y
34 %rand2 = icmp ugt i32 %A, %Z1
35 %Z2 = select i1 %rand2, i32 %A, i32 %Z1
37 ; CHECK-NEXT: --> ([[EXPR:.*]]){{ +}}Exits: 20
38 %B = trunc i32 %Z2 to i16
39 %C = sext i16 %B to i30
41 ; CHECK-NEXT: (trunc i32 ([[EXPR]]) to i30)
42 %D = sext i16 %B to i32
44 ; CHECK-NEXT: ([[EXPR]])
45 %E = sext i16 %B to i34
47 ; CHECK-NEXT: (zext i32 ([[EXPR]]) to i34)
48 %F = zext i16 %B to i30
50 ; CHECK-NEXT: (trunc i32 ([[EXPR]]) to i30
51 %G = zext i16 %B to i32
53 ; CHECK-NEXT: ([[EXPR]])
54 %H = zext i16 %B to i34
56 ; CHECK-NEXT: (zext i32 ([[EXPR]]) to i34)
58 %0 = icmp ne i32 %A, 20
59 br i1 %0, label %loop, label %exit