================ @@ -44,3 +47,44 @@ void foo(const void* ptr, size_t len, long disp_addr, } } +//--- b.cpp +// COM: Prior to the introduction of the FatLTO cleanup pass, this used to cause +// COM: the backend to crash, either due to an assertion failure, or because +// COM: the CFI instructions couldn't be correctly generated. So, check to make +// COM: sure that the FatLTO pipeline used by clang does not regress. + +// COM: Check the generated IR doesn't contain llvm.type.checked.load in the final IR. +// RUN: %clang_cc1 -triple=x86_64-unknown-fuchsia -O1 -emit-llvm -o - \ +// RUN: -ffat-lto-objects -fvisibility=hidden \ +// RUN: -fno-rtti -fsanitize=cfi-icall,cfi-mfcall,cfi-nvcall,cfi-vcall \ +// RUN: -fsanitize-trap=cfi-icall,cfi-mfcall,cfi-nvcall,cfi-vcall \ +// RUN: -fwhole-program-vtables %t/b.cpp 2>&1 | FileCheck %s --check-prefix=NO_CHECKED_LOAD + +// RUN: %clang_cc1 -triple=x86_64-unknown-fuchsia -O1 -emit-llvm -o - \ +// RUN: -ffat-lto-objects -fvisibility=hidden -fexperimental-relative-c++-abi-vtables \ +// RUN: -fno-rtti -fsanitize=cfi-icall,cfi-mfcall,cfi-nvcall,cfi-vcall \ +// RUN: -fsanitize-trap=cfi-icall,cfi-mfcall,cfi-nvcall,cfi-vcall \ +// RUN: -fwhole-program-vtables %t/b.cpp 2>&1 | FileCheck %s --check-prefix=NO_CHECKED_LOAD + +// COM: Note that the embedded bitcode section will contain references to +// COM: llvm.type.checked.load, so we need to match the function body first. +// NO_CHECKED_LOAD-LABEL: entry: +// NO_CHECKED_LOAD-NEXT: %vtable = load ptr, ptr %p1 +// NO_CHECKED_LOAD-NOT: llvm.type.checked.load ---------------- PiJoules wrote:
Clang should technically emit a `llvm.type.checked.load.relative` here, but that's because of something I missed. I'll send out a patch that fixes this. https://github.com/llvm/llvm-project/pull/125911 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits