Convert a few lit tests that use "lc2i | llvm-mc | llvm-objdump" to use p2i.

Makes it more uniform for a later bulk refactoring of
"p2i | llvm-mc | llvm-objdump", so it only needs to match p2i
and not lc2i. Some of the test expectations change though.

Also there was a stray XCHECK that I don't remember why
it was XCHECK... change that to CHECK.

BUG= none
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/927433002
diff --git a/tests_lit/llvm2ice_tests/8bit.pnacl.ll b/tests_lit/llvm2ice_tests/8bit.pnacl.ll
index 2e65d5b..319e684 100644
--- a/tests_lit/llvm2ice_tests/8bit.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/8bit.pnacl.ll
@@ -37,7 +37,7 @@
   ret i32 %ret
 }
 ; CHECK-LABEL: sub8Bit
-; XCHECK: sub {{[abcd]l}}
+; CHECK: sub {{[abcd]l}}
 
 define internal i32 @sub8BitConst(i32 %a) {
 entry:
@@ -47,7 +47,7 @@
   ret i32 %ret
 }
 ; CHECK-LABEL: sub8BitConst
-; XCHECK: sub {{[abcd]l}}
+; CHECK: sub {{[abcd]l}}
 
 define internal i32 @mul8Bit(i32 %a, i32 %b) {
 entry:
diff --git a/tests_lit/llvm2ice_tests/align-spill-locations.ll b/tests_lit/llvm2ice_tests/align-spill-locations.ll
index e87488e..fc7ac2b 100644
--- a/tests_lit/llvm2ice_tests/align-spill-locations.ll
+++ b/tests_lit/llvm2ice_tests/align-spill-locations.ll
@@ -1,11 +1,9 @@
 ; This checks to ensure that Subzero aligns spill slots.
 
-; TODO(kschimpf) Find out why lc2i needed.
-; REQUIRES: allow_llvm_ir_as_input
-; RUN: %lc2i -i %s --args --verbose none \
+; RUN: %p2i -i %s --args --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
-; RUN: %lc2i -i %s --args -O2 --verbose none \
+; RUN: %p2i -i %s --args -O2 --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
 
diff --git a/tests_lit/llvm2ice_tests/ebp_args.ll b/tests_lit/llvm2ice_tests/ebp_args.ll
index a66693f..03959bb 100644
--- a/tests_lit/llvm2ice_tests/ebp_args.ll
+++ b/tests_lit/llvm2ice_tests/ebp_args.ll
@@ -3,9 +3,7 @@
 ; adjustment was incorrectly added to the stack/frame offset for
 ; ebp-based frames.
 
-; TODO(kschimpf) Find out why lc2i is needed.
-; REQUIRES: allow_llvm_ir_as_input
-; RUN: %lc2i -i %s --args -Om1 --target=x8632 --verbose none \
+; RUN: %p2i -i %s --args -Om1 --target=x8632 --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
 
@@ -13,10 +11,10 @@
 
 define i32 @memcpy_helper(i32 %buf, i32 %n) {
 entry:
-  %n.arg_trunc = trunc i32 %n to i8
   %buf2 = alloca i8, i32 128, align 4
-  %buf2.asint = ptrtoint i8* %buf2 to i32
+  %n.arg_trunc = trunc i32 %n to i8
   %arg_ext = zext i8 %n.arg_trunc to i32
+  %buf2.asint = ptrtoint i8* %buf2 to i32
   %call = call i32 @memcpy_helper2(i32 %buf, i32 %buf2.asint, i32 %arg_ext)
   ret i32 %call
 }
@@ -29,19 +27,17 @@
 ; CHECK:  push  ebp
 ; CHECK:  mov   ebp, esp
 ; CHECK:  sub   esp, 24
-; CHECK:  mov   eax, dword ptr [ebp + 12]
-; CHECK:  mov   dword ptr [ebp - 4], eax
 ; CHECK:  sub   esp, 128
-; CHECK:  mov   dword ptr [ebp - 8], esp
-; CHECK:  mov   eax, dword ptr [ebp - 8]
+; CHECK:  mov   dword ptr [ebp - 4], esp
+; CHECK:  mov   eax, dword ptr [ebp + 12]
+; CHECK:  mov   dword ptr [ebp - 8], eax
+; CHECK:  movzx eax, byte ptr [ebp - 8]
 ; CHECK:  mov   dword ptr [ebp - 12], eax
-; CHECK:  movzx eax, byte ptr [ebp - 4]
-; CHECK:  mov   dword ptr [ebp - 16], eax
 ; CHECK:  sub   esp, 16
 ; CHECK:  mov   eax, dword ptr [ebp + 8]
 ; CHECK:  mov   dword ptr [esp], eax
-; CHECK:  mov   eax, dword ptr [ebp - 12]
+; CHECK:  mov   eax, dword ptr [ebp - 4]
 ; CHECK:  mov   dword ptr [esp + 4], eax
-; CHECK:  mov   eax, dword ptr [ebp - 16]
+; CHECK:  mov   eax, dword ptr [ebp - 12]
 ; CHECK:  mov   dword ptr [esp + 8], eax
 ; CHECK:  call  memcpy_helper2
diff --git a/tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll b/tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll
index 76badce..c16f7c0 100644
--- a/tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll
+++ b/tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll
@@ -1,19 +1,18 @@
 ; This tests each of the supported NaCl atomic instructions for every
 ; size allowed.
 
-; TODO(kschimpf) Find out why lc2i is needed.
-; RUN: %lc2i -i %s --args -O2 --verbose none \
+; RUN: %p2i -i %s --args -O2 --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \
-; RUN:   | %iflc FileCheck %s
+; RUN:   | FileCheck %s
 ; RUN: %p2i -i %s --args -O2 --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \
 ; RUN:   | FileCheck --check-prefix=CHECKO2 %s
-; RUN: %lc2i -i %s --args -Om1 --verbose none \
+; RUN: %p2i -i %s --args -Om1 --verbose none \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \
-; RUN:   | %iflc FileCheck %s
+; RUN:   | FileCheck %s
 
 declare i8 @llvm.nacl.atomic.load.i8(i8*, i32)
 declare i16 @llvm.nacl.atomic.load.i16(i16*, i32)
@@ -714,11 +713,11 @@
   ret i32 %old_ext
 }
 ; CHECK-LABEL: test_atomic_cmpxchg_8
-; CHECK: mov al, {{.*}}
+; CHECK: mov eax, {{.*}}
 ; Need to check that eax isn't used as the address register or the desired.
 ; since it is already used as the *expected* register.
 ; CHECK: lock
-; CHECK-NEXT: cmpxchg byte ptr [e{{[^a].}}], {{[^a]}}
+; CHECK-NEXT: cmpxchg byte ptr [e{{[^a].}}], {{[^a]}}l
 
 define i32 @test_atomic_cmpxchg_16(i32 %iptr, i32 %expected, i32 %desired) {
 entry:
@@ -731,9 +730,9 @@
   ret i32 %old_ext
 }
 ; CHECK-LABEL: test_atomic_cmpxchg_16
-; CHECK: mov ax, {{.*}}
+; CHECK: mov eax, {{.*}}
 ; CHECK: lock
-; CHECK-NEXT: cmpxchg word ptr [e{{[^a].}}], {{[^a]}}
+; CHECK-NEXT: cmpxchg word ptr [e{{[^a].}}], {{[^a]}}x
 
 define i32 @test_atomic_cmpxchg_32(i32 %iptr, i32 %expected, i32 %desired) {
 entry:
@@ -784,8 +783,8 @@
 ; CHECK-DAG: mov ebx
 ; CHECK: lock
 ; CHECK-NEXT: cmpxchg8b qword ptr [e{{.[^x]}}]
-; CHECK: mov {{.*}}, edx
-; CHECK: mov {{.*}}, eax
+; CHECK-DAG: mov {{.*}}, edx
+; CHECK-DAG: mov {{.*}}, eax
 
 ; Test with some more register pressure. When we have an alloca, ebp is
 ; used to manage the stack frame, so it cannot be used as a register either.
diff --git a/tests_lit/llvm2ice_tests/phi.ll b/tests_lit/llvm2ice_tests/phi.ll
index 0099fed..83fdee5 100644
--- a/tests_lit/llvm2ice_tests/phi.ll
+++ b/tests_lit/llvm2ice_tests/phi.ll
@@ -2,9 +2,7 @@
 ; it tests that it does the right thing when it tries to enable
 ; compare/branch fusing.
 
-; TODO(kschimpf) Find out why lc2i must be used.
-; REQUIRES: allow_llvm_ir_as_input
-; RUN: %lc2i -i %s --args -O2 --verbose none --phi-edge-split=0 \
+; RUN: %p2i -i %s --args -O2 --verbose none --phi-edge-split=0 \
 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
 ; RUN:   | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s
 
@@ -58,12 +56,17 @@
 body:
   %merge = phi i32 [ %arg, %entry ], [ %elt, %body ]
   %interior = add i32 %merge, 1000
-  %__4 = inttoptr i32 %interior to i32*
+  ; Trick to make a basic block local copy of interior for
+  ; addressing mode optimization.
+  %interior__4 = add i32 %interior, 0
+  %__4 = inttoptr i32 %interior__4 to i32*
   %elt = load i32* %__4, align 1
   %cmp = icmp eq i32 %elt, 0
   br i1 %cmp, label %exit, label %body
 exit:
-  %__6 = inttoptr i32 %interior to i32*
+  ; Same trick (making a basic block local copy).
+  %interior__6 = add i32 %interior, 0
+  %__6 = inttoptr i32 %interior__6 to i32*
   store i32 %arg, i32* %__6, align 1
   ret i32 %arg
 }
@@ -92,8 +95,8 @@
 ; CHECK: push [[EBX:.*]]
 ; CHECK: mov {{.*}}, dword ptr [esp
 ; CHECK: mov
-; CHECK: mov {{.*}}[[ADDR:.*1000]]
+; CHECK: mov {{.*}}, dword ptr [[ADDR:.*1000]]
 ; CHECK: cmp {{.*}}, 0
 ; CHECK: jne
-; CHECK: mov {{.*}}[[ADDR]]
+; CHECK: mov dword ptr [[ADDR]]
 ; CHECK: pop [[EBX]]
diff --git a/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll b/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
index b3e4e36..4789d88 100644
--- a/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
+++ b/tests_lit/llvm2ice_tests/struct-arith.pnacl.ll
@@ -1,9 +1,8 @@
 ; This test is lowered from C code that does some simple aritmetic
 ; with struct members.
 
-; TODO(kschimpf) Find out why lc2i is needed.
-; REQUIRES: allow_llvm_ir_as_input
-; RUN: %lc2i -i %s --args --verbose inst -threads=0 | FileCheck %s
+; REQUIRES: allow_dump
+; RUN: %p2i -i %s --args --verbose inst -threads=0 | FileCheck %s
 
 define internal i32 @compute_important_function(i32 %v1, i32 %v2) {
 entry:
@@ -11,7 +10,6 @@
   %_v0 = load i32* %__2, align 1
 
 ; CHECK:        entry:
-; CHECK-NEXT:       %__2 = i32 %v1
 ; CHECK-NEXT:       %_v0 = load i32* {{.*}}, align 1
 
   %__4 = inttoptr i32 %v2 to i32*