[PATCH] D122207: [IROutliner][IRSim] Add all outlined region basic blocks to canonical numbering to add basic blocks to generated PHINode numbering generation.

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 16 10:49:58 PDT 2022


bjope added a comment.

Seen assertion failures downstream with this patch. Here is a reproducer:

  ; ModuleID = 'irsimilarity_crash.ll'
  source_filename = "irsimilarity_crash.ll"
  
  @v_13 = external dso_local global ptr, align 1
  
  ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
  declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
  
  define dso_local i16 @main() {
  entry:
    %indirect-arg-temp537 = alloca { float, float }, align 1
    %0 = load ptr, ptr @v_13, align 1
    br label %for.cond108
  
  for.cond108:                                      ; preds = %for.body110, %entry
    br i1 undef, label %for.body110, label %for.end122
  
  for.body110:                                      ; preds = %for.cond108
    br label %for.cond108
  
  for.end122:                                       ; preds = %for.cond108
    call void @llvm.dbg.declare(metadata ptr undef, metadata !1, metadata !DIExpression()), !dbg !11
    store i32 30, ptr undef, align 1
    br label %for.cond123
  
  for.cond123:                                      ; preds = %for.end122
    br i1 undef, label %for.body125, label %for.end146
  
  for.body125:                                      ; preds = %for.cond123
    unreachable
  
  for.end146:                                       ; preds = %for.cond123
    br label %for.cond148
  
  for.cond148:                                      ; preds = %for.end146
    br label %for.cond167
  
  for.cond167:                                      ; preds = %for.body169, %for.cond148
    br i1 undef, label %for.body169, label %for.end246
  
  for.body169:                                      ; preds = %for.cond167
    br label %for.cond167
  
  for.end246:                                       ; preds = %for.cond167
    store i32 0, ptr undef, align 1
    unreachable
  }
  
  attributes #0 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
  
  !llvm.dbg.cu = !{}
  !llvm.module.flags = !{!0}
  
  !0 = !{i32 2, !"Debug Info Version", i32 3}
  !1 = !DILocalVariable(name: "v_68", scope: !2, file: !3, line: 522, type: !10)
  !2 = distinct !DILexicalBlock(scope: !4, file: !3, line: 522, column: 9)
  !3 = !DIFile(filename: "41097217.c", directory: "rt.outdir")
  !4 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 480, type: !5, scopeLine: 481, spFlags: DISPFlagDefinition, unit: !8, retainedNodes: !9)
  !5 = !DISubroutineType(types: !6)
  !6 = !{!7}
  !7 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
  !8 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0.prerel", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !9, globals: !9, splitDebugInlining: false, nameTableKind: None)
  !9 = !{}
  !10 = !DIBasicType(name: "long", size: 32, encoding: DW_ATE_signed)
  !11 = !DILocation(line: 522, column: 23, scope: !2)

Hits an assertion if using a build with asserts when running

  opt -passes='require<ir-similarity>' -S -o - irsimilarity_crash.ll

Part of stack trace:

  opt: ../include/llvm/ADT/Optional.h:195: T &llvm::optional_detail::OptionalStorage<unsigned int, true>::getValue() & [T = unsigned int]: Assertion `hasVal' failed.
  Stack dump:
  0.      Program arguments: build-all/bin/opt -passes=require<ir-similarity> -S -o - irsimilarity_crash.ll
   #0 0x0000000002f2be08 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x2f2be08)
   #1 0x0000000002f29a7e llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x2f29a7e)
   #2 0x0000000002f2c4a6 SignalHandler(int) Signals.cpp:0:0
   #3 0x00007f76ba600630 __restore_rt sigaction.c:0:0
   #4 0x00007f76b7d47387 raise (/lib64/libc.so.6+0x36387)
   #5 0x00007f76b7d48a78 abort (/lib64/libc.so.6+0x37a78)
   #6 0x00007f76b7d401a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
   #7 0x00007f76b7d40252 (/lib64/libc.so.6+0x2f252)
   #8 0x0000000001d57f8c llvm::IRSimilarity::IRSimilarityCandidate::createCanonicalRelationFrom(llvm::IRSimilarity::IRSimilarityCandidate&, llvm::DenseMap<unsigned int, llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int, void> >, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int, void> > > >&, llvm::DenseMap<unsigned int, llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int, void> >, llvm::DenseMapInfo<unsigned int, void>, llvm::detail::DenseMapPair<unsigned int, llvm::DenseSet<unsigned int, llvm::DenseMapInfo<unsigned int, void> > > >&) (build-all/bin/opt+0x1d57f8c)
   #9 0x0000000001d59141 llvm::IRSimilarity::IRSimilarityIdentifier::findCandidates(std::vector<llvm::IRSimilarity::IRInstructionData*, std::allocator<llvm::IRSimilarity::IRInstructionData*> >&, std::vector<unsigned int, std::allocator<unsigned int> >&) (build-all/bin/opt+0x1d59141)
  #10 0x0000000001d59fbc llvm::IRSimilarity::IRSimilarityIdentifier::findSimilarity(llvm::Module&) (build-all/bin/opt+0x1d59fbc)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122207



More information about the llvm-commits mailing list