Quick Compiler: pointer/boolean cleanup

More minor code cleanup - follow the Art convention of not treating
pointers as booleans in "for" loop tests.

Change-Id: I2fcd06efe6a51d1195c0900f7fa110fc01110001
diff --git a/src/compiler/codegen/arm/assemble_arm.cc b/src/compiler/codegen/arm/assemble_arm.cc
index f89915b..8cb0b97 100644
--- a/src/compiler/codegen/arm/assemble_arm.cc
+++ b/src/compiler/codegen/arm/assemble_arm.cc
@@ -993,7 +993,7 @@
   LIR* lir;
   AssemblerStatus res = kSuccess;  // Assume success
 
-  for (lir = cu->first_lir_insn; lir; lir = NEXT_LIR(lir)) {
+  for (lir = cu->first_lir_insn; lir != NULL; lir = NEXT_LIR(lir)) {
 
     if (lir->opcode < 0) {
       /* 1 means padding is needed */
@@ -1374,7 +1374,7 @@
   LIR* arm_lir;
   int offset = 0;
 
-  for (arm_lir = cu->first_lir_insn; arm_lir; arm_lir = NEXT_LIR(arm_lir)) {
+  for (arm_lir = cu->first_lir_insn; arm_lir != NULL; arm_lir = NEXT_LIR(arm_lir)) {
     arm_lir->offset = offset;
     if (arm_lir->opcode >= 0) {
       if (!arm_lir->flags.is_nop) {
diff --git a/src/compiler/codegen/codegen_util.cc b/src/compiler/codegen/codegen_util.cc
index 9373291..9af5578 100644
--- a/src/compiler/codegen/codegen_util.cc
+++ b/src/compiler/codegen/codegen_util.cc
@@ -312,10 +312,10 @@
   LOG(INFO) << "expansion factor: "
             << static_cast<float>(cu->total_size) / static_cast<float>(insns_size * 2);
   DumpPromotionMap(cu);
-  for (lir_insn = cu->first_lir_insn; lir_insn; lir_insn = lir_insn->next) {
+  for (lir_insn = cu->first_lir_insn; lir_insn != NULL; lir_insn = lir_insn->next) {
     DumpLIRInsn(cu, lir_insn, 0);
   }
-  for (lir_insn = cu->literal_list; lir_insn; lir_insn = lir_insn->next) {
+  for (lir_insn = cu->literal_list; lir_insn != NULL; lir_insn = lir_insn->next) {
     LOG(INFO) << StringPrintf("%x (%04x): .word (%#x)", lir_insn->offset, lir_insn->offset,
                               lir_insn->operands[0]);
   }
diff --git a/src/compiler/codegen/local_optimizations.cc b/src/compiler/codegen/local_optimizations.cc
index d1a7444..cf04b21 100644
--- a/src/compiler/codegen/local_optimizations.cc
+++ b/src/compiler/codegen/local_optimizations.cc
@@ -78,9 +78,7 @@
 
   if (head_lir == tail_lir) return;
 
-  for (this_lir = PREV_LIR(tail_lir);
-      this_lir != head_lir;
-      this_lir = PREV_LIR(this_lir)) {
+  for (this_lir = PREV_LIR(tail_lir); this_lir != head_lir; this_lir = PREV_LIR(this_lir)) {
     int sink_distance = 0;
 
     /* Skip non-interesting instructions */
@@ -124,9 +122,7 @@
         stop_use_reg_mask = (GetPCUseDefEncoding() | this_lir->use_mask) & ~ENCODE_MEM;
     }
 
-    for (check_lir = NEXT_LIR(this_lir);
-        check_lir != tail_lir;
-        check_lir = NEXT_LIR(check_lir)) {
+    for (check_lir = NEXT_LIR(this_lir); check_lir != tail_lir; check_lir = NEXT_LIR(check_lir)) {
 
       /*
        * Skip already dead instructions (whose dataflow information is
@@ -275,9 +271,7 @@
   if (head_lir == tail_lir) return;
 
   /* Start from the second instruction */
-  for (this_lir = NEXT_LIR(head_lir);
-     this_lir != tail_lir;
-     this_lir = NEXT_LIR(this_lir)) {
+  for (this_lir = NEXT_LIR(head_lir); this_lir != tail_lir; this_lir = NEXT_LIR(this_lir)) {
 
     /* Skip non-interesting instructions */
     if ((this_lir->flags.is_nop == true) ||
@@ -308,9 +302,7 @@
     bool stop_here = false;
 
     /* Try to hoist the load to a good spot */
-    for (check_lir = PREV_LIR(this_lir);
-        check_lir != head_lir;
-        check_lir = PREV_LIR(check_lir)) {
+    for (check_lir = PREV_LIR(this_lir); check_lir != head_lir; check_lir = PREV_LIR(check_lir)) {
 
       /*
        * Skip already dead instructions (whose dataflow information is
diff --git a/src/compiler/codegen/method_bitcode.cc b/src/compiler/codegen/method_bitcode.cc
index cedf3b7..7a9446f 100644
--- a/src/compiler/codegen/method_bitcode.cc
+++ b/src/compiler/codegen/method_bitcode.cc
@@ -1856,7 +1856,7 @@
     return false;
   }
 
-  for (MIR* mir = bb->first_mir_insn; mir; mir = mir->next) {
+  for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
 
     SetDexOffset(cu, mir->offset);
 
@@ -3385,8 +3385,7 @@
     static_cast<LIR*>(NewMem(cu, sizeof(LIR) * num_basic_blocks, true, kAllocLIR));
   LIR* label_list = cu->block_label_list;
   int next_label = 0;
-  for (llvm::Function::iterator i = func->begin(),
-       e = func->end(); i != e; ++i) {
+  for (llvm::Function::iterator i = func->begin(), e = func->end(); i != e; ++i) {
     cu->block_to_label_map.Put(static_cast<llvm::BasicBlock*>(i),
                                &label_list[next_label++]);
   }
@@ -3397,8 +3396,7 @@
    */
   cu->loc_map.clear();  // Start fresh
   cu->reg_location = NULL;
-  for (int i = 0; i < cu->num_dalvik_registers + cu->num_compiler_temps + 1;
-       i++) {
+  for (int i = 0; i < cu->num_dalvik_registers + cu->num_compiler_temps + 1; i++) {
     cu->promotion_map[i].core_location = kLocDalvikFrame;
     cu->promotion_map[i].fp_location = kLocDalvikFrame;
   }
@@ -3416,8 +3414,7 @@
    * be the first instruction we encounter, so we won't have to iterate
    * through everything.
    */
-  for (llvm::inst_iterator i = llvm::inst_begin(func),
-       e = llvm::inst_end(func); i != e; ++i) {
+  for (llvm::inst_iterator i = llvm::inst_begin(func), e = llvm::inst_end(func); i != e; ++i) {
     llvm::CallInst* call_inst = llvm::dyn_cast<llvm::CallInst>(&*i);
     if (call_inst != NULL) {
       llvm::Function* callee = call_inst->getCalledFunction();
@@ -3489,8 +3486,7 @@
     CreateLocFromValue(cu, val);
   }
   // Create RegLocations for all non-argument defintions
-  for (llvm::inst_iterator i = llvm::inst_begin(func),
-       e = llvm::inst_end(func); i != e; ++i) {
+  for (llvm::inst_iterator i = llvm::inst_begin(func), e = llvm::inst_end(func); i != e; ++i) {
     llvm::Value* val = &*i;
     if (val->hasName() && (val->getName().str().c_str()[0] == 'v')) {
       CreateLocFromValue(cu, val);
@@ -3498,8 +3494,7 @@
   }
 
   // Walk the blocks, generating code.
-  for (llvm::Function::iterator i = cu->func->begin(),
-       e = cu->func->end(); i != e; ++i) {
+  for (llvm::Function::iterator i = cu->func->begin(), e = cu->func->end(); i != e; ++i) {
     BitcodeBlockCodeGen(cu, static_cast<llvm::BasicBlock*>(i));
   }
 
diff --git a/src/compiler/codegen/method_codegen_driver.cc b/src/compiler/codegen/method_codegen_driver.cc
index 9f7f692..fe5d522 100644
--- a/src/compiler/codegen/method_codegen_driver.cc
+++ b/src/compiler/codegen/method_codegen_driver.cc
@@ -729,7 +729,7 @@
     GenExitSequence(cu);
   }
 
-  for (mir = bb->first_mir_insn; mir; mir = mir->next) {
+  for (mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
     ResetRegPool(cu);
     if (cu->disable_opt & (1 << kTrackLiveTemps)) {
       ClobberAllRegs(cu);
diff --git a/src/compiler/codegen/mips/assemble_mips.cc b/src/compiler/codegen/mips/assemble_mips.cc
index b80784f..933cb60 100644
--- a/src/compiler/codegen/mips/assemble_mips.cc
+++ b/src/compiler/codegen/mips/assemble_mips.cc
@@ -520,7 +520,7 @@
   LIR *lir;
   AssemblerStatus res = kSuccess;  // Assume success
 
-  for (lir = cu->first_lir_insn; lir; lir = NEXT_LIR(lir)) {
+  for (lir = cu->first_lir_insn; lir != NULL; lir = NEXT_LIR(lir)) {
     if (lir->opcode < 0) {
       continue;
     }
@@ -723,7 +723,7 @@
   LIR* mips_lir;
   int offset = 0;
 
-  for (mips_lir = cu->first_lir_insn; mips_lir; mips_lir = NEXT_LIR(mips_lir)) {
+  for (mips_lir = cu->first_lir_insn; mips_lir != NULL; mips_lir = NEXT_LIR(mips_lir)) {
     mips_lir->offset = offset;
     if (mips_lir->opcode >= 0) {
       if (!mips_lir->flags.is_nop) {
diff --git a/src/compiler/codegen/x86/assemble_x86.cc b/src/compiler/codegen/x86/assemble_x86.cc
index 78ba331..2363c20 100644
--- a/src/compiler/codegen/x86/assemble_x86.cc
+++ b/src/compiler/codegen/x86/assemble_x86.cc
@@ -1194,7 +1194,7 @@
   AssemblerStatus res = kSuccess;  // Assume success
 
   const bool kVerbosePcFixup = false;
-  for (lir = cu->first_lir_insn; lir; lir = NEXT_LIR(lir)) {
+  for (lir = cu->first_lir_insn; lir != NULL; lir = NEXT_LIR(lir)) {
     if (lir->opcode < 0) {
       continue;
     }
@@ -1420,21 +1420,21 @@
  */
 int AssignInsnOffsets(CompilationUnit* cu)
 {
-    LIR* x86LIR;
+    LIR* x86_lir;
     int offset = 0;
 
-    for (x86LIR = cu->first_lir_insn; x86LIR; x86LIR = NEXT_LIR(x86LIR)) {
-        x86LIR->offset = offset;
-        if (x86LIR->opcode >= 0) {
-            if (!x86LIR->flags.is_nop) {
-                offset += x86LIR->flags.size;
+    for (x86_lir = cu->first_lir_insn; x86_lir != NULL; x86_lir = NEXT_LIR(x86_lir)) {
+        x86_lir->offset = offset;
+        if (x86_lir->opcode >= 0) {
+            if (!x86_lir->flags.is_nop) {
+                offset += x86_lir->flags.size;
             }
-        } else if (x86LIR->opcode == kPseudoPseudoAlign4) {
+        } else if (x86_lir->opcode == kPseudoPseudoAlign4) {
             if (offset & 0x2) {
                 offset += 2;
-                x86LIR->operands[0] = 1;
+                x86_lir->operands[0] = 1;
             } else {
-                x86LIR->operands[0] = 0;
+                x86_lir->operands[0] = 0;
             }
         }
         /* Pseudo opcodes don't consume space */
diff --git a/src/compiler/codegen/x86/target_x86.cc b/src/compiler/codegen/x86/target_x86.cc
index c51e9e9..ee5c215 100644
--- a/src/compiler/codegen/x86/target_x86.cc
+++ b/src/compiler/codegen/x86/target_x86.cc
@@ -512,7 +512,7 @@
   for (int i = 0; i < cu->num_ssa_regs; i++) {
     cu->phi_alias_map[i] = i;
   }
-  for (MIR* phi = cu->phi_list; phi; phi = phi->meta.phi_next) {
+  for (MIR* phi = cu->phi_list; phi != NULL; phi = phi->meta.phi_next) {
     int def_reg = phi->ssa_rep->defs[0];
     for (int i = 0; i < phi->ssa_rep->num_uses; i++) {
       for (int j = 0; j < cu->num_ssa_regs; j++) {