From cd7f7cf5cca6fa425523a5af9fd42f82c6566ebf Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 2 Sep 2025 09:10:45 +0200 Subject: Reapply [IR] Remove options to make scalable TypeSize access a warning (#156336) Reapplying now that buildbot has picked up the new configuration that does not use -treat-scalable-fixed-error-as-warning. ----- This removes the `LLVM_ENABLE_STRICT_FIXED_SIZE_VECTORS` cmake option and the `-treat-scalable-fixed-error-as-warning` opt flag. We stopped treating these as warnings by default a long time ago (62f09d788f9fc540db12f3cfa2f98760071fca96), so I don't think it makes sense to retain these options at this point. Accessing a scalable TypeSize as fixed should always result in an error. --- llvm/lib/Support/CommandLine.cpp | 1 - llvm/lib/Support/DebugOptions.h | 1 - llvm/lib/Support/TypeSize.cpp | 40 ++-------------------------------------- 3 files changed, 2 insertions(+), 40 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 8491633..be232f5 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -2671,7 +2671,6 @@ static void initCommonOptions() { initSignalsOptions(); initStatisticOptions(); initTimerOptions(); - initTypeSizeOptions(); initWithColorOptions(); initDebugOptions(); initRandomSeedOptions(); diff --git a/llvm/lib/Support/DebugOptions.h b/llvm/lib/Support/DebugOptions.h index db727d5..6c3382e 100644 --- a/llvm/lib/Support/DebugOptions.h +++ b/llvm/lib/Support/DebugOptions.h @@ -24,7 +24,6 @@ void initGraphWriterOptions(); void initSignalsOptions(); void initStatisticOptions(); void initTimerOptions(); -void initTypeSizeOptions(); void initWithColorOptions(); void initDebugOptions(); void initRandomSeedOptions(); diff --git a/llvm/lib/Support/TypeSize.cpp b/llvm/lib/Support/TypeSize.cpp index 43346b8..3dbb008 100644 --- a/llvm/lib/Support/TypeSize.cpp +++ b/llvm/lib/Support/TypeSize.cpp @@ -7,49 +7,13 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/TypeSize.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/WithColor.h" - -#include "DebugOptions.h" +#include "llvm/Support/Error.h" using namespace llvm; -#ifndef STRICT_FIXED_SIZE_VECTORS -namespace { -struct CreateScalableErrorAsWarning { - /// The ScalableErrorAsWarning is a temporary measure to suppress errors from - /// using the wrong interface on a scalable vector. - static void *call() { - return new cl::opt( - "treat-scalable-fixed-error-as-warning", cl::Hidden, - cl::desc( - "Treat issues where a fixed-width property is requested from a " - "scalable type as a warning, instead of an error")); - } -}; -} // namespace -static ManagedStatic, CreateScalableErrorAsWarning> - ScalableErrorAsWarning; -void llvm::initTypeSizeOptions() { *ScalableErrorAsWarning; } -#else -void llvm::initTypeSizeOptions() {} -#endif - -void llvm::reportInvalidSizeRequest(const char *Msg) { -#ifndef STRICT_FIXED_SIZE_VECTORS - if (*ScalableErrorAsWarning) { - WithColor::warning() << "Invalid size request on a scalable vector; " << Msg - << "\n"; - return; - } -#endif - report_fatal_error("Invalid size request on a scalable vector."); -} - TypeSize::operator TypeSize::ScalarTy() const { if (isScalable()) { - reportInvalidSizeRequest( + reportFatalInternalError( "Cannot implicitly convert a scalable size to a fixed-width size in " "`TypeSize::operator ScalarTy()`"); return getKnownMinValue(); -- cgit v1.1