[PATCH] D124159: [SimplifyCFG] Thread branches on same condition in more cases (PR54980)

Nathan Chancellor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 5 18:23:09 PDT 2022


nathanchance added a comment.

I ended up reducing something down anyways. At the parent commit of dc969061c68e62328607d68215ed8b9ef4a1e4b1 <https://reviews.llvm.org/rGdc969061c68e62328607d68215ed8b9ef4a1e4b1>, there is no crash.

  _Bool fpsimd_context_busy;
  enum { false, true } arch_static_branch_jump() {
    asm goto("" : : : : l_yes);
    return false;
  l_yes:
    return true;
  }
  _Bool __preempt_count_dec_and_test();
  void preempt_schedule_notrace();
  long __percpu_read_8();
  _Bool may_use_simd() {
    return ({ ({ arch_static_branch_jump(); }); }) && ({
             typeof(fpsimd_context_busy) pscr_ret__ = ({
               typeof(fpsimd_context_busy) __retval = __percpu_read_8();
               if (__builtin_expect(__preempt_count_dec_and_test(), 0))
                 preempt_schedule_notrace();
               __retval;
             });
             pscr_ret__;
           });
  }
  void aes_cipher_encrypt() {
    if (may_use_simd())
      preempt_schedule_notrace();
  }



  $ clang --target=aarch64-linux-gnu -O2 -c -o /dev/null aes-ce-glue.i
  clang: /home/nathan/cbl/src/llvm-project/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1136: llvm::BasicBlock *SplitBlockPredecessorsImpl(llvm::BasicBlock *, ArrayRef<llvm::BasicBlock *>, const char *, llvm::DomTreeUpdater *, llvm::DominatorTree *, llvm::LoopInfo *, llvm::MemorySSAUpdater *, bool): Assertion `!isa<CallBrInst>(Preds[i]->getTerminator()) && "Cannot split an edge from a CallBrInst"' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: clang --target=aarch64-linux-gnu -O2 -c -o /dev/null aes-ce-glue.i
  1.      <eof> parser at end of file
  2.      Optimizer
   #0 0x0000aaaad1ad36b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/install/llvm/dc969061c68e62328607d68215ed8b9ef4a1e4b1/bin/clang-15+0x35336b8)
   #1 0x0000aaaad1ad18d8 llvm::sys::RunSignalHandlers() (/home/nathan/tmp/install/llvm/dc969061c68e62328607d68215ed8b9ef4a1e4b1/bin/clang-15+0x35318d8)
   #2 0x0000aaaad1a5e6e4 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
   #3 0x0000aaaad1a5e894 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
   #4 0x0000ffffa099e854 (linux-vdso.so.1+0x854)
   #5 0x0000ffffa04b28a8 __pthread_kill_implementation (/lib64/libc.so.6+0x828a8)
   #6 0x0000ffffa046ae40 gsignal (/lib64/libc.so.6+0x3ae40)
   #7 0x0000ffffa04572f8 abort (/lib64/libc.so.6+0x272f8)
   #8 0x0000ffffa0464538 __assert_fail_base (/lib64/libc.so.6+0x34538)
   #9 0x0000ffffa04645a0 __assert_perror_fail (/lib64/libc.so.6+0x345a0)
  #10 0x0000aaaad1ae30c0 SplitBlockPredecessorsImpl(llvm::BasicBlock*, llvm::ArrayRef<llvm::BasicBlock*>, char const*, llvm::DomTreeUpdater*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::MemorySSAUpdater*, bool) BasicBlockUtils.cpp:0:0
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124159



More information about the cfe-commits mailing list