[llvm] Verifier: Reword range metadata error message (PR #102441)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 02:10:55 PDT 2024
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/102441
This was using the same message for the case where the type
doesn't match the instruction, and the types didn't match each other.
Make it clear which one the issue is.
>From fd9758c5e934f706d992ef52ddcd5cbe9efa3b0f Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 7 Aug 2024 23:39:19 +0400
Subject: [PATCH] Verifier: Reword range metadata error message
This was using the same message for the case where the type
doesn't match the instruction, and the types didn't match each other.
Make it clear which one the issue is.
---
llvm/lib/IR/Verifier.cpp | 6 ++++--
llvm/test/Verifier/absolute_symbol.ll | 4 ++--
llvm/test/Verifier/range-1.ll | 4 ++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4bcd799718c4e..402af376651eb 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -4142,8 +4142,10 @@ void Verifier::verifyRangeMetadata(const Value &I, const MDNode *Range,
ConstantInt *High =
mdconst::dyn_extract<ConstantInt>(Range->getOperand(2 * i + 1));
Check(High, "The upper limit must be an integer!", High);
- Check(High->getType() == Low->getType() &&
- High->getType() == Ty->getScalarType(),
+
+ Check(High->getType() == Low->getType(), "Range pair types must match!",
+ &I);
+ Check(High->getType() == Ty->getScalarType(),
"Range types must match instruction type!", &I);
APInt HighV = High->getValue();
diff --git a/llvm/test/Verifier/absolute_symbol.ll b/llvm/test/Verifier/absolute_symbol.ll
index 631f35585f288..df3da8e547cb3 100644
--- a/llvm/test/Verifier/absolute_symbol.ll
+++ b/llvm/test/Verifier/absolute_symbol.ll
@@ -58,11 +58,11 @@ define void @absolute_func_empty_arguments() !absolute_symbol !0 {
; CHECK-NEXT: ptr @absolute_two_arguments_wrong_width
!4 = !{i32 256, i32 512}
-; CHECK-NEXT: Range types must match instruction type!
+; CHECK-NEXT: Range pair types must match!
; CHECK-NEXT: ptr @absolute_two_arguments_one_wrong_width0
!5 = !{i32 256, i64 512}
-; CHECK-NEXT: Range types must match instruction type!
+; CHECK-NEXT: Range pair types must match!
; CHECK-NEXT: ptr @absolute_two_arguments_one_wrong_width1
!6 = !{i64 256, i32 512}
diff --git a/llvm/test/Verifier/range-1.ll b/llvm/test/Verifier/range-1.ll
index ed1b6dc60fa67..d81f3a430749a 100644
--- a/llvm/test/Verifier/range-1.ll
+++ b/llvm/test/Verifier/range-1.ll
@@ -47,7 +47,7 @@ entry:
ret i8 %y
}
!5 = !{i32 0, i8 0}
-; CHECK: Range types must match instruction type!
+; CHECK: Range pair types must match!
; CHECK: %y = load
define i8 @f7(ptr %x) {
@@ -56,7 +56,7 @@ entry:
ret i8 %y
}
!6 = !{i8 0, i32 0}
-; CHECK: Range types must match instruction type!
+; CHECK: Range pair types must match!
; CHECK: %y = load
define i8 @f8(ptr %x) {
More information about the llvm-commits
mailing list