ART: Remove some compile-time info points

Remove no longer needed compile-time info points in the verifier. Only
check-casts are still reliant on support for elision.

This reduces the number of pre-populated register lines in a large
app by 70%, and the number of instructions executed during verification
by about 2%.

Bug: 110852609
Test: m test-art-host
Change-Id: Iefa8253749b1a2750f57360e08ddfb502d0478b1
diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc
index 54f216a..172ec6b 100644
--- a/compiler/dex/verified_method.cc
+++ b/compiler/dex/verified_method.cc
@@ -76,6 +76,7 @@
         continue;
       }
       const verifier::RegisterLine* line = method_verifier->GetRegLine(dex_pc);
+      DCHECK(line != nullptr) << "Did not have line for dex pc 0x" << std::hex << dex_pc;
       const verifier::RegType& reg_type(line->GetRegisterType(method_verifier,
                                                               inst.VRegA_21c()));
       const verifier::RegType& cast_type =
diff --git a/runtime/verifier/instruction_flags.h b/runtime/verifier/instruction_flags.h
index e5e71a4..6cd2865 100644
--- a/runtime/verifier/instruction_flags.h
+++ b/runtime/verifier/instruction_flags.h
@@ -102,11 +102,6 @@
     return (flags_ & (1 << kReturn)) != 0;
   }
 
-  void SetCompileTimeInfoPointAndReturn() {
-    SetCompileTimeInfoPoint();
-    SetReturn();
-  }
-
   std::string ToString() const;
 
  private:
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index e838e3a..ee91efa 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -97,8 +97,6 @@
       case kTrackRegsBranches:
         interesting = flags[i].IsBranchTarget();
         break;
-      default:
-        break;
     }
     if (interesting) {
       register_lines_[i].reset(RegisterLine::Create(registers_size, allocator, reg_types));
@@ -1031,31 +1029,20 @@
 template <bool kVerifierDebug>
 template <bool kAllowRuntimeOnlyInstructions>
 bool MethodVerifier<kVerifierDebug>::VerifyInstructions() {
-  /* Flag the start of the method as a branch target, and a GC point due to stack overflow errors */
+  // Flag the start of the method as a branch target.
   GetModifiableInstructionFlags(0).SetBranchTarget();
-  GetModifiableInstructionFlags(0).SetCompileTimeInfoPoint();
   for (const DexInstructionPcPair& inst : code_item_accessor_) {
     const uint32_t dex_pc = inst.DexPc();
     if (!VerifyInstruction<kAllowRuntimeOnlyInstructions>(&inst.Inst(), dex_pc)) {
       DCHECK_NE(failures_.size(), 0U);
       return false;
     }
-    /* Flag instructions that are garbage collection points */
-    // All invoke points are marked as "Throw" points already.
-    // We are relying on this to also count all the invokes as interesting.
-    if (inst->IsBranch()) {
+    // Flag some interesting instructions.
+    if (inst->IsReturn()) {
+      GetModifiableInstructionFlags(dex_pc).SetReturn();
+    } else if (inst->Opcode() == Instruction::CHECK_CAST) {
+      // The dex-to-dex compiler wants type information to elide check-casts.
       GetModifiableInstructionFlags(dex_pc).SetCompileTimeInfoPoint();
-      // The compiler also needs safepoints for fall-through to loop heads.
-      // Such a loop head must be a target of a branch.
-      int32_t offset = 0;
-      bool cond, self_ok;
-      bool target_ok = GetBranchOffset(dex_pc, &offset, &cond, &self_ok);
-      DCHECK(target_ok);
-      GetModifiableInstructionFlags(dex_pc + offset).SetCompileTimeInfoPoint();
-    } else if (inst->IsSwitch() || inst->IsThrow()) {
-      GetModifiableInstructionFlags(dex_pc).SetCompileTimeInfoPoint();
-    } else if (inst->IsReturn()) {
-      GetModifiableInstructionFlags(dex_pc).SetCompileTimeInfoPointAndReturn();
     }
   }
   return true;
@@ -1588,7 +1575,10 @@
   const uint16_t registers_size = code_item_accessor_.RegistersSize();
 
   /* Create and initialize table holding register status */
-  reg_table_.Init(fill_register_lines_ ? kTrackRegsAll : kTrackCompilerInterestPoints,
+  RegisterTrackingMode base_mode = Runtime::Current()->IsAotCompiler()
+                                       ? kTrackCompilerInterestPoints
+                                       : kTrackRegsBranches;
+  reg_table_.Init(fill_register_lines_ ? kTrackRegsAll : base_mode,
                   insn_flags_.get(),
                   code_item_accessor_.InsnsSizeInCodeUnits(),
                   registers_size,