summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoadCombine/deadcode.ll
blob: ed72824ffb443299e4fc255bdfa888099938f1c7 (plain)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -load-combine -S < %s | FileCheck %s

; It has been detected that dead loops like the one in this test case can be
; created by -jump-threading (it was detected by a csmith generated program).
;
; According to -verify this is valid input (even if it could be discussed if
; the dead loop really satisfies SSA form).
;
; The problem found was that the -load-combine pass ends up in an infinite loop
; when analysing the 'bb1' basic block.
define void @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT:    ret void
; CHECK:       bb1:
; CHECK-NEXT:    [[_TMP4:%.*]] = load i16, i16* [[_TMP10:%.*]], align 1
; CHECK-NEXT:    [[_TMP10]] = getelementptr i16, i16* [[_TMP10]], i16 1
; CHECK-NEXT:    br label [[BB1:%.*]]
; CHECK:       bb2:
; CHECK-NEXT:    [[_TMP7:%.*]] = load i16, i16* [[_TMP12:%.*]], align 1
; CHECK-NEXT:    [[_TMP12]] = getelementptr i16, i16* [[_TMP12]], i16 1
; CHECK-NEXT:    br label [[BB2:%.*]]
;
  ret void

bb1:
  %_tmp4 = load i16, i16* %_tmp10, align 1
  %_tmp10 = getelementptr i16, i16* %_tmp10, i16 1
  br label %bb1

; A second basic block. Running the test with -debug-pass=Executions shows
; that we only run the Dominator Tree Construction one time for each function,
; also when having multiple basic blocks in the function.
bb2:
  %_tmp7 = load i16, i16* %_tmp12, align 1
  %_tmp12 = getelementptr i16, i16* %_tmp12, i16 1
  br label %bb2

}
OpenPOWER on IntegriCloud