[PATCH] D106989: [IRSim] Finding Branch Similarity

Yvan Roux via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 02:42:52 PDT 2021


yroux added a comment.

I found an issue with the IROutliner while testing this patch which I don't easily catch, when pruning icompatible regions there is an assert violation at llvm/include/llvm/ADT/ilist_iterator.h:138
The problem can be reproduce with this reduce testcase:

  opt -S -iroutliner ~/test.ll -o -

test.ll:

  @a = global i8* null
  
  define void @foo() {
  entry:
    br label %for.cond
  
  for.cond:
    %c.0 = phi i32 [ undef, %entry ], [ %inc3, %for.end ]
    %d.0 = phi i32 [ undef, %entry ], [ %d.1, %for.end ]
    %conv = trunc i32 %c.0 to i8
    br label %for.cond1
  
  for.cond1:
    %d.1 = phi i32 [ %d.0, %for.cond ], [ %inc, %for.body ]
    %cmp = icmp slt i32 %d.1, 0
    br i1 %cmp, label %for.body, label %for.end
  
  for.body:
    %0 = load i8*, i8** @a
    %arrayidx = getelementptr inbounds i8, i8* %0, i32 %d.1
    store i8 %conv, i8* %arrayidx
    %inc = add nsw i32 %d.1, 1
    br label %for.cond1
  
  for.end:
    %inc3 = add nsw i32 %c.0, 1
    br label %for.cond
  }





================
Comment at: llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp:754
+  ASSERT_EQ(UnsignedVec.size(), static_cast<unsigned>(3));
+  ASSERT_TRUE(UnsignedVec[1] > UnsignedVec[0]);
+  ASSERT_TRUE(UnsignedVec[1] < UnsignedVec[2]);
----------------
Maybe use ASSERT_GT and ASSERT_LT here and in the rest of the testcase


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106989/new/

https://reviews.llvm.org/D106989



More information about the llvm-commits mailing list