[PATCH] D63972: [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 15:30:06 PDT 2019


fedor.sergeev added a comment.

This reproducer fails with assertion:

  ] cat reduced.ll
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
  target triple = "x86_64-unknown-linux-gnu"
  
  define void @Init(i8 addrspace(1)* %this, i8 addrspace(1)* %0) #0 gc "statepoint-example" personality i32* ()* @personality_function !prof !1 {
  bci_0:
    %xored = xor i64 0, -1
    %1 = inttoptr i64 %xored to i8*
    %2 = addrspacecast i8* %1 to i8 addrspace(1)*
    %result.i.i = select i1 false, i8 addrspace(1)* null, i8 addrspace(1)* %2
    switch i32 undef, label %mismatch [
      i32 2119, label %not_zero53
      i32 2122, label %not_zero53
      i32 2125, label %not_zero56
      i32 2128, label %not_zero53
    ]
  not_zero53:
    fence release
    ret void
  
  not_zero56:                                       ; preds = %bci_0
    %3 = icmp eq i8 addrspace(1)* %result.i.i, null
    br i1 %3, label %exit, label %not_zero59, !make.implicit !11
  
  not_zero59:                                       ; preds = %not_zero56
    store atomic i8 1, i8 addrspace(1)* undef unordered, align 1
    br label %not_zero53
  
  mismatch:                                         ; preds = %bci_0
    %statepoint_token18 = invoke token (i64, i32, i32 (i32, i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i32i32p1i8f(i64 1, i32 16, i32 (i32, i8 addrspace(1)*)* null, i32 2, i32 0, i32 undef, i8 addrspace(1)* %this, i32 0, i32 13, i32 0, i32 0, i32 0, i32 66, i32 0, i32 3, i32 0, i32 0, i8 addrspace(1)* %this, i32 0, i8 addrspace(1)* nonnull %0, i32 7, i8* null)
            to label %"exit" unwind label %exceptional_return46
  
  "exit":
    unreachable
  exceptional_return46:
    %lpad_token = landingpad token
            cleanup
    unreachable
  }
  
  declare i32* @personality_function() 
  declare token @llvm.experimental.gc.statepoint.p0f_i32i32p1i8f(i64 immarg, i32 immarg, i32 (i32, i8 addrspace(1)*)*, i32 immarg, i32 immarg, ...)
  
  !1 = !{!"function_entry_count", i64 32768}
  !11 = !{}
  ] bin/llc -enable-implicit-null-checks reduced.ll
  llc: /home/fsergeev/ws/llvm-upstream/llvm-mono/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1837: void llvm::AsmPrinter::EmitJumpTableEntry(const llvm::MachineJumpTableInfo*, const llvm::MachineBasicBlock*, unsigned int) const: Assertion `MBB && MBB->getNumber() >= 0 && "Invalid basic block"' failed.
  ...

It starts passing after the revert.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63972





More information about the llvm-commits mailing list