[llvm] a7e20dd - LowLevelType: replace a reachable llvm_unreachable with assert

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 14:58:58 PDT 2023


Author: Fangrui Song
Date: 2023-08-18T14:58:53-07:00
New Revision: a7e20dd664bbce6e87b1fdad88d719e497902a42

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

LOG: LowLevelType: replace a reachable llvm_unreachable with assert

assert is more appropriate here and fixes
`runtime error: execution reached an unreachable program point` in a
-DLLVM_USE_SANITIZER=Undefined build (-fno-sanitize-recover=all causes
llc to exit instead of crash (report_fatal_error)) when testing
MachineVerifier/test_g_assert_[sz]ext.mir.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/LowLevelType.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/LowLevelType.h b/llvm/include/llvm/CodeGen/LowLevelType.h
index 2924f475ac8500..a1e778cd718f6e 100644
--- a/llvm/include/llvm/CodeGen/LowLevelType.h
+++ b/llvm/include/llvm/CodeGen/LowLevelType.h
@@ -238,10 +238,9 @@ class LLT {
         return getFieldValue(VectorSizeFieldInfo);
       else
         return getFieldValue(PointerVectorSizeFieldInfo);
-    } else if (IsPointer)
-      return getFieldValue(PointerSizeFieldInfo);
-    else
-      llvm_unreachable("unexpected LLT");
+    }
+    assert(IsPointer && "unexpected LLT");
+    return getFieldValue(PointerSizeFieldInfo);
   }
 
   constexpr unsigned getAddressSpace() const {


        


More information about the llvm-commits mailing list