[llvm] a63efd2 - Use assert instead of branch-to-unreachable

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 22:01:00 PDT 2023


Author: David Blaikie
Date: 2023-09-16T05:00:18Z
New Revision: a63efd26324066d38724a8fd7fe1d6315c8a790e

URL: https://github.com/llvm/llvm-project/commit/a63efd26324066d38724a8fd7fe1d6315c8a790e
DIFF: https://github.com/llvm/llvm-project/commit/a63efd26324066d38724a8fd7fe1d6315c8a790e.diff

LOG: Use assert instead of branch-to-unreachable

(pretty sure we wrote this down in the style guide at some point)

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86AsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index bb94444525fb89a..73c7450620966cd 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -766,8 +766,8 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
 
     if (FeatureFlagsAnd) {
       // Emit a .note.gnu.property section with the flags.
-      if (!TT.isArch32Bit() && !TT.isArch64Bit())
-        llvm_unreachable("CFProtection used on invalid architecture!");
+      assert((TT.isArch32Bit() || TT.isArch64Bit()) &&
+             "CFProtection used on invalid architecture!");
       MCSection *Cur = OutStreamer->getCurrentSectionOnly();
       MCSection *Nt = MMI->getContext().getELFSection(
           ".note.gnu.property", ELF::SHT_NOTE, ELF::SHF_ALLOC);


        


More information about the llvm-commits mailing list