Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: tests_lit/llvm2ice_tests/addr-opt-multi-def-var.ll

Issue 1161543005: Subzero: Changes needed for LLVM 3.7 integration. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/8bit.pnacl.ll ('k') | tests_lit/llvm2ice_tests/address-mode-opt.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; This is distilled from a real function that led to a bug in the 1 ; This is distilled from a real function that led to a bug in the
2 ; address mode optimization code. It followed assignment chains 2 ; address mode optimization code. It followed assignment chains
3 ; through non-SSA temporaries created from Phi instruction lowering. 3 ; through non-SSA temporaries created from Phi instruction lowering.
4 ; 4 ;
5 ; This test depends to some degree on the stability of "--verbose 5 ; This test depends to some degree on the stability of "--verbose
6 ; addropt" output format. 6 ; addropt" output format.
7 7
8 ; REQUIRES: target_X8632 8 ; REQUIRES: target_X8632
9 ; REQUIRES: allow_dump 9 ; REQUIRES: allow_dump
10 ; RUN: %p2i -i %s --args -O2 --verbose addropt | FileCheck %s 10 ; RUN: %p2i -i %s --args -O2 --verbose addropt | FileCheck %s
11 11
12 declare i32 @_calloc_r(i32, i32, i32) 12 declare i32 @_calloc_r(i32, i32, i32)
13 13
14 define internal i32 @_Balloc(i32 %ptr, i32 %k) { 14 define internal i32 @_Balloc(i32 %ptr, i32 %k) {
15 entry: 15 entry:
16 %gep = add i32 %ptr, 76 16 %gep = add i32 %ptr, 76
17 %gep.asptr = inttoptr i32 %gep to i32* 17 %gep.asptr = inttoptr i32 %gep to i32*
18 %0 = load i32* %gep.asptr, align 1 18 %0 = load i32, i32* %gep.asptr, align 1
19 %cmp = icmp eq i32 %0, 0 19 %cmp = icmp eq i32 %0, 0
20 br i1 %cmp, label %if.then, label %if.end5 20 br i1 %cmp, label %if.then, label %if.end5
21 21
22 if.then: ; preds = %entry 22 if.then: ; preds = %entry
23 %call = tail call i32 @_calloc_r(i32 %ptr, i32 4, i32 33) 23 %call = tail call i32 @_calloc_r(i32 %ptr, i32 4, i32 33)
24 %gep.asptr2 = inttoptr i32 %gep to i32* 24 %gep.asptr2 = inttoptr i32 %gep to i32*
25 store i32 %call, i32* %gep.asptr2, align 1 25 store i32 %call, i32* %gep.asptr2, align 1
26 %cmp3 = icmp eq i32 %call, 0 26 %cmp3 = icmp eq i32 %call, 0
27 br i1 %cmp3, label %return, label %if.end5 27 br i1 %cmp3, label %return, label %if.end5
28 28
29 if.end5: ; preds = %if.then, %entry 29 if.end5: ; preds = %if.then, %entry
30 %1 = phi i32 [ %call, %if.then ], [ %0, %entry ] 30 %1 = phi i32 [ %call, %if.then ], [ %0, %entry ]
31 %gep_array = mul i32 %k, 4 31 %gep_array = mul i32 %k, 4
32 %gep2 = add i32 %1, %gep_array 32 %gep2 = add i32 %1, %gep_array
33 %gep2.asptr = inttoptr i32 %gep2 to i32* 33 %gep2.asptr = inttoptr i32 %gep2 to i32*
34 %2 = load i32* %gep2.asptr, align 1 34 %2 = load i32, i32* %gep2.asptr, align 1
35 ; The above load instruction is a good target for address mode 35 ; The above load instruction is a good target for address mode
36 ; optimization. Correct analysis would lead to dump output like: 36 ; optimization. Correct analysis would lead to dump output like:
37 ; Starting computeAddressOpt for instruction: 37 ; Starting computeAddressOpt for instruction:
38 ; [ 15] %__13 = load i32* %gep2.asptr, align 1 38 ; [ 15] %__13 = load i32, i32* %gep2.asptr, align 1
39 ; Instruction: [ 14] %gep2.asptr = i32 %gep2 39 ; Instruction: [ 14] %gep2.asptr = i32 %gep2
40 ; results in Base=%gep2, Index=<null>, Shift=0, Offset=0 40 ; results in Base=%gep2, Index=<null>, Shift=0, Offset=0
41 ; Instruction: [ 13] %gep2 = add i32 %__9, %gep_array 41 ; Instruction: [ 13] %gep2 = add i32 %__9, %gep_array
42 ; results in Base=%__9, Index=%gep_array, Shift=0, Offset=0 42 ; results in Base=%__9, Index=%gep_array, Shift=0, Offset=0
43 ; Instruction: [ 18] %__9 = i32 %__9_phi 43 ; Instruction: [ 18] %__9 = i32 %__9_phi
44 ; results in Base=%__9_phi, Index=%gep_array, Shift=0, Offset=0 44 ; results in Base=%__9_phi, Index=%gep_array, Shift=0, Offset=0
45 ; Instruction: [ 12] %gep_array = mul i32 %k, 4 45 ; Instruction: [ 12] %gep_array = mul i32 %k, 4
46 ; results in Base=%__9_phi, Index=%k, Shift=2, Offset=0 46 ; results in Base=%__9_phi, Index=%k, Shift=2, Offset=0
47 ; 47 ;
48 ; Incorrect, overly-aggressive analysis would lead to output like: 48 ; Incorrect, overly-aggressive analysis would lead to output like:
49 ; Starting computeAddressOpt for instruction: 49 ; Starting computeAddressOpt for instruction:
50 ; [ 15] %__13 = load i32* %gep2.asptr, align 1 50 ; [ 15] %__13 = load i32, i32* %gep2.asptr, align 1
51 ; Instruction: [ 14] %gep2.asptr = i32 %gep2 51 ; Instruction: [ 14] %gep2.asptr = i32 %gep2
52 ; results in Base=%gep2, Index=<null>, Shift=0, Offset=0 52 ; results in Base=%gep2, Index=<null>, Shift=0, Offset=0
53 ; Instruction: [ 13] %gep2 = add i32 %__9, %gep_array 53 ; Instruction: [ 13] %gep2 = add i32 %__9, %gep_array
54 ; results in Base=%__9, Index=%gep_array, Shift=0, Offset=0 54 ; results in Base=%__9, Index=%gep_array, Shift=0, Offset=0
55 ; Instruction: [ 18] %__9 = i32 %__9_phi 55 ; Instruction: [ 18] %__9 = i32 %__9_phi
56 ; results in Base=%__9_phi, Index=%gep_array, Shift=0, Offset=0 56 ; results in Base=%__9_phi, Index=%gep_array, Shift=0, Offset=0
57 ; Instruction: [ 19] %__9_phi = i32 %__4 57 ; Instruction: [ 19] %__9_phi = i32 %__4
58 ; results in Base=%__4, Index=%gep_array, Shift=0, Offset=0 58 ; results in Base=%__4, Index=%gep_array, Shift=0, Offset=0
59 ; Instruction: [ 12] %gep_array = mul i32 %k, 4 59 ; Instruction: [ 12] %gep_array = mul i32 %k, 4
60 ; results in Base=%__4, Index=%k, Shift=2, Offset=0 60 ; results in Base=%__4, Index=%k, Shift=2, Offset=0
61 ; 61 ;
62 ; CHECK-NOT: results in Base=%__4, 62 ; CHECK-NOT: results in Base=%__4,
63 ; 63 ;
64 ret i32 %2 64 ret i32 %2
65 65
66 return: ; preds = %if.then 66 return: ; preds = %if.then
67 ret i32 0 67 ret i32 0
68 } 68 }
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/8bit.pnacl.ll ('k') | tests_lit/llvm2ice_tests/address-mode-opt.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698