File: pr33689_same_bitwidth.ll

package info (click to toggle)
llvm-toolchain-6.0 1:6.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 594,652 kB
  • sloc: cpp: 3,044,500; ansic: 595,051; asm: 271,890; python: 128,923; objc: 106,554; sh: 21,854; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,214; cs: 2,027; xml: 686; php: 212; csh: 117
file content (53 lines) | stat: -rw-r--r-- 1,873 bytes parent folder | download | duplicates (13)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instcombine %s -o - | FileCheck %s

; All the "useless" instructions should be removed and we shouldn't crash.

target datalayout = "p:16:16"

%i64_t = type i64

@a = external global i16
@b = external global i16*

define void @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT:  bb0:
; CHECK-NEXT:    [[TMP12:%.*]] = alloca [2 x i32], align 8
; CHECK-NEXT:    [[TMP12_SUB:%.*]] = getelementptr inbounds [2 x i32], [2 x i32]* [[TMP12]], i16 0, i16 0
; CHECK-NEXT:    br i1 undef, label [[BB1:%.*]], label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    [[TMP8:%.*]] = ptrtoint [2 x i32]* [[TMP12]] to i16
; CHECK-NEXT:    store i16 [[TMP8]], i16* @a, align 2
; CHECK-NEXT:    unreachable
; CHECK:       bb2:
; CHECK-NEXT:    [[TMP9:%.*]] = load i16*, i16** @b, align 2
; CHECK-NEXT:    store i16 0, i16* [[TMP9]], align 2
; CHECK-NEXT:    [[TMP10:%.*]] = load i32, i32* [[TMP12_SUB]], align 8
; CHECK-NEXT:    [[TMP11:%.*]] = add i32 [[TMP10]], -1
; CHECK-NEXT:    store i32 [[TMP11]], i32* [[TMP12_SUB]], align 8
; CHECK-NEXT:    ret void
;
bb0:
  %tmp1 = alloca %i64_t
  %tmp2 = bitcast %i64_t* %tmp1 to i32*
  %useless3 = bitcast %i64_t* %tmp1 to i16*
  %useless4 = getelementptr inbounds i16, i16* %useless3, i16 undef
  %useless5 = bitcast i16* %useless4 to i32*
  br i1 undef, label %bb1, label %bb2

bb1:                                              ; preds = %bb0
  %useless6 = insertvalue [1 x i32*] undef, i32* %tmp2, 0
  %useless7 = insertvalue [1 x i32*] %useless6, i32* null, 0
  %tmp8 = ptrtoint i32* %tmp2 to i16
  store i16 %tmp8, i16* @a
  unreachable

bb2:                                              ; preds = %bb0
  %tmp9 = load i16*, i16** @b
  store i16 0, i16* %tmp9
  %tmp10 = load i32, i32* %tmp2
  %tmp11 = sub i32 %tmp10, 1
  store i32 %tmp11, i32* %tmp2
  ret void
}