[llvm] Verifier: Reword range metadata error message (PR #102441)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 02:12:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/102441.diff
3 Files Affected:
- (modified) llvm/lib/IR/Verifier.cpp (+4-2)
- (modified) llvm/test/Verifier/absolute_symbol.ll (+2-2)
- (modified) llvm/test/Verifier/range-1.ll (+2-2)
``````````diff
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4bcd799718c4e5..402af376651eb6 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 631f35585f288b..df3da8e547cb37 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 ed1b6dc60fa678..d81f3a430749ab 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) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/102441
More information about the llvm-commits
mailing list