annotate test/Transforms/InstCombine/pr33689_same_bitwidth.ll @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents 803732b1fca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 ; RUN: opt -S -instcombine %s -o - | FileCheck %s
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 ; All the "useless" instructions should be removed and we shouldn't crash.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 target datalayout = "p:16:16"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 %i64_t = type i64
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 @a = external global i16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 @b = external global i16*
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 define void @f() {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 ; CHECK-LABEL: @f(
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 ; CHECK-NEXT: bb0:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 ; CHECK-NEXT: [[TMP12:%.*]] = alloca [2 x i32], align 8
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 ; CHECK-NEXT: [[TMP12_SUB:%.*]] = getelementptr inbounds [2 x i32], [2 x i32]* [[TMP12]], i16 0, i16 0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 ; CHECK-NEXT: br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 ; CHECK: bb1:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 ; CHECK-NEXT: [[TMP8:%.*]] = ptrtoint [2 x i32]* [[TMP12]] to i16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 ; CHECK-NEXT: store i16 [[TMP8]], i16* @a, align 2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 ; CHECK-NEXT: unreachable
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23 ; CHECK: bb2:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 ; CHECK-NEXT: [[TMP9:%.*]] = load i16*, i16** @b, align 2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 ; CHECK-NEXT: store i16 0, i16* [[TMP9]], align 2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 ; CHECK-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP12_SUB]], align 8
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 ; CHECK-NEXT: [[TMP11:%.*]] = add i32 [[TMP10]], -1
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 ; CHECK-NEXT: store i32 [[TMP11]], i32* [[TMP12_SUB]], align 8
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 ; CHECK-NEXT: ret void
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 ;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 bb0:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 %tmp1 = alloca %i64_t
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 %tmp2 = bitcast %i64_t* %tmp1 to i32*
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 %useless3 = bitcast %i64_t* %tmp1 to i16*
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 %useless4 = getelementptr inbounds i16, i16* %useless3, i16 undef
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36 %useless5 = bitcast i16* %useless4 to i32*
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 br i1 undef, label %bb1, label %bb2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39 bb1: ; preds = %bb0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 %useless6 = insertvalue [1 x i32*] undef, i32* %tmp2, 0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 %useless7 = insertvalue [1 x i32*] %useless6, i32* null, 0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42 %tmp8 = ptrtoint i32* %tmp2 to i16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 store i16 %tmp8, i16* @a
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 unreachable
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 bb2: ; preds = %bb0
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
47 %tmp9 = load i16*, i16** @b
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
48 store i16 0, i16* %tmp9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
49 %tmp10 = load i32, i32* %tmp2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
50 %tmp11 = sub i32 %tmp10, 1
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
51 store i32 %tmp11, i32* %tmp2
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
52 ret void
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
53 }