1## This reproduces a bug where not registering cold fragment entry points 2## leads to removing blocks and an inconsistent CFG after UCE. 3## Test assembly was obtained using C-Reduce from this C++ code: 4## (compiled with `g++ -O2 -Wl,-q`) 5# 6# #include <stdexcept> 7# int a; 8# int main() { 9# if (a) 10# try { 11# throw std::logic_error(""); 12# } catch (...) {} 13# try { 14# throw std::logic_error(""); 15# } catch (...) {} 16# } 17 18# REQUIRES: system-linux 19 20# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o 21# RUN: %clangxx %cxxflags -no-pie %t.o -o %t.exe -Wl,-q 22# RUN: llvm-bolt %t.exe -o %t.out --dump-dot-all --funcs=main.* \ 23# RUN: 2>&1 | FileCheck %s 24# 25# CHECK-NOT: Assertion `isValid()' failed. 26 27 .globl main 28main: 29 jmp .L3 # jump to the secondary entry point in main.cold.0 30 31 .section a,"ax" 32main.cold.0: 33 .cfi_startproc 34 .cfi_lsda 3,b 35 ud2 36 call __cxa_throw 37.L3: 38 nop 39 .cfi_endproc 40 41 .section .gcc_except_table 42b: 43 .byte 0xff,0x3 44 .uleb128 e-c 45c: 46 .byte 1 47 .uleb128 e-d 48d: 49 .uleb128 0,0,0,0,0 50 .uleb128 .L3-main.cold.0 51 .uleb128 .L3-main.cold.0 52e: 53