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

Side by Side Diff: tests_lit/llvm2ice_tests/phi.ll

Issue 557953007: Subzero: Fix incorrect address mode inference involving Phi temporaries. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add check against Var2->getIsMultidef() Created 6 years, 3 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 | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; This tests some of the subtleties of Phi lowering. In particular, 1 ; This tests some of the subtleties of Phi lowering. In particular,
2 ; it tests that it does the right thing when it tries to enable 2 ; it tests that it does the right thing when it tries to enable
3 ; compare/branch fusing. 3 ; compare/branch fusing.
4 4
5 ; RUN: %llvm2ice -O2 --verbose none --no-phi-edge-split %s \ 5 ; RUN: %llvm2ice -O2 --verbose none --no-phi-edge-split %s \
6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ 6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s 7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s
8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ; CHECK: mov {{.*}}, 12345 51 ; CHECK: mov {{.*}}, 12345
52 ; CHECK: cmp {{.*}}, 0 52 ; CHECK: cmp {{.*}}, 0
53 ; CHECK-NEXT: jg 53 ; CHECK-NEXT: jg
54 ; CHECK: : 54 ; CHECK: :
55 ; CHECK: mov [[PHI:.*]], 54321 55 ; CHECK: mov [[PHI:.*]], 54321
56 ; CHECK: : 56 ; CHECK: :
57 ; CHECK: mov {{.*}}, [[PHI]] 57 ; CHECK: mov {{.*}}, [[PHI]]
58 58
59 ; ERRORS-NOT: ICE translation error 59 ; ERRORS-NOT: ICE translation error
60 ; DUMP-NOT: SZ 60 ; DUMP-NOT: SZ
61
62 ; Test that address mode inference doesn't extend past
63 ; multi-definition, non-SSA Phi temporaries.
64 define internal i32 @testPhi3(i32 %arg) {
65 entry:
66 br label %body
67 body:
68 %merge = phi i32 [ %arg, %entry ], [ %elt, %body ]
69 %interior = add i32 %merge, 1000
70 %__4 = inttoptr i32 %interior to i32*
71 %elt = load i32* %__4, align 1
72 %cmp = icmp eq i32 %elt, 0
73 br i1 %cmp, label %exit, label %body
74 exit:
75 %__6 = inttoptr i32 %interior to i32*
76 store i32 %arg, i32* %__6, align 1
77 ret i32 %arg
78 }
79 ; I can't figure out how to reliably test this for correctness, so I
80 ; will just include patterns for the entire current O2 sequence. This
81 ; may need to be changed when meaningful optimizations are added.
82 ; The key is to avoid the "bad" pattern like this:
83 ;
84 ; testPhi3:
85 ; .LtestPhi3$entry:
86 ; mov eax, dword ptr [esp+4]
87 ; mov ecx, eax
88 ; .LtestPhi3$body:
89 ; mov ecx, dword ptr [ecx+1000]
90 ; cmp ecx, 0
91 ; jne .LtestPhi3$body
92 ; .LtestPhi3$exit:
93 ; mov dword ptr [ecx+1000], eax
94 ; ret
95 ;
96 ; This is bad because the final store address is supposed to be the
97 ; same as the load address in the loop, but it has clearly been
98 ; over-optimized into a null pointer dereference.
99
100 ; CHECK-LABEL: testPhi3
101 ; CHECK: push [[EBX:.*]]
102 ; CHECK: mov {{.*}}, dword ptr [esp
103 ; CHECK: jmp
104 ; CHECK: mov
105 ; CHECK: mov {{.*}}[[ADDR:.*1000]]
106 ; CHECK: cmp {{.*}}, 0
107 ; CHECK: je
108 ; CHECK: jmp
109 ; CHECK: mov {{.*}}[[ADDR]]
110 ; CHECK: pop [[EBX]]
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698