OSDN Git Service

ART: Fix IsLinearOrderWellFormed in liveness analysis
authorDavid Brazdil <dbrazdil@google.com>
Tue, 19 Apr 2016 09:10:17 +0000 (10:10 +0100)
committerDavid Brazdil <dbrazdil@google.com>
Tue, 19 Apr 2016 15:02:36 +0000 (16:02 +0100)
Graph may contain nullptr in list of basic blocks when
the basic block is removed. So we must handle nullptr explicitly.

Bug: 28252537
Bug: 27615840
Bug: 27624868

Change-Id: If430939b8fe793e4a9c974936180d06c1a9f90c6
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
(cherry picked from commit fa3091ef031da6c18478fdede12d7762634ee271)

compiler/optimizing/ssa_liveness_analysis.h
test/594-checker-irreducible-linorder/smali/IrreducibleLoop.smali

index 719feec..40dab74 100644 (file)
@@ -971,7 +971,7 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> {
 
   bool IsLinearOrderWellFormed(const HGraph& graph) {
     for (HBasicBlock* header : graph.GetBlocks()) {
-      if (!header->IsLoopHeader()) {
+      if (header == nullptr || !header->IsLoopHeader()) {
         continue;
       }
 
index 8e01084..366c7b9 100644 (file)
    invoke-static {v0}, Ljava/lang/System;->exit(I)V
    goto :body1
 
+   # Trivially dead code to ensure linear order verification skips removed blocks (b/28252537).
+   :dead_code
+   nop
+   goto :dead_code
+
    :header
    mul-int/2addr p3, p3
    if-eqz p1, :body2