aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-09-02 09:10:45 +0200
committerNikita Popov <npopov@redhat.com>2025-09-03 11:12:11 +0200
commitcd7f7cf5cca6fa425523a5af9fd42f82c6566ebf (patch)
treec8a427383e767538b1ea388984c00f451c48bd8f /llvm/lib
parent73bed64433072338d11ebf770d6db99c2ce810aa (diff)
downloadllvm-cd7f7cf5cca6fa425523a5af9fd42f82c6566ebf.zip
llvm-cd7f7cf5cca6fa425523a5af9fd42f82c6566ebf.tar.gz
llvm-cd7f7cf5cca6fa425523a5af9fd42f82c6566ebf.tar.bz2
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.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/CommandLine.cpp1
-rw-r--r--llvm/lib/Support/DebugOptions.h1
-rw-r--r--llvm/lib/Support/TypeSize.cpp40
3 files changed, 2 insertions, 40 deletions
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<bool>(
- "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<cl::opt<bool>, 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();