[llvm] e0282cb - [IPSCCP] Don't add !range metadata for vector returns
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 03:13:06 PDT 2023
Author: Nikita Popov
Date: 2023-03-13T11:12:57+01:00
New Revision: e0282cb4da9402de5712ac7855af6c71a03d0c19
URL: https://github.com/llvm/llvm-project/commit/e0282cb4da9402de5712ac7855af6c71a03d0c19
DIFF: https://github.com/llvm/llvm-project/commit/e0282cb4da9402de5712ac7855af6c71a03d0c19.diff
LOG: [IPSCCP] Don't add !range metadata for vector returns
!range metadata is currenlty not supported on vector types. This
fixes verifier failures exposed by D144467.
Added:
Modified:
llvm/lib/Transforms/IPO/SCCP.cpp
llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/SCCP.cpp b/llvm/lib/Transforms/IPO/SCCP.cpp
index 46a66989c0916..ab6b1c515d2cf 100644
--- a/llvm/lib/Transforms/IPO/SCCP.cpp
+++ b/llvm/lib/Transforms/IPO/SCCP.cpp
@@ -280,7 +280,7 @@ static bool runIPSCCP(
// If there is a known constant range for the return value, add !range
// metadata to the function's call sites.
- if (ReturnValue.isConstantRange() &&
+ if (F->getReturnType()->isIntegerTy() && ReturnValue.isConstantRange() &&
!ReturnValue.getConstantRange().isSingleElement()) {
// Do not add range metadata if the return value may include undef.
if (ReturnValue.isConstantRangeIncludingUndef())
diff --git a/llvm/test/Transforms/SCCP/ip-add-range-to-call.ll b/llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
index 825e44a81860f..4939c3a857974 100644
--- a/llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
+++ b/llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
@@ -169,5 +169,25 @@ define i32 @caller5() {
ret i32 %a
}
+define internal <2 x i64> @ctlz(<2 x i64> %arg) {
+; CHECK-LABEL: @ctlz(
+; CHECK-NEXT: [[RES:%.*]] = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> [[ARG:%.*]], i1 false)
+; CHECK-NEXT: ret <2 x i64> [[RES]]
+;
+ %res = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %arg, i1 false)
+ ret <2 x i64> %res
+}
+
+define <2 x i64> @ctlz_caller(<2 x i64> %arg) {
+; CHECK-LABEL: @ctlz_caller(
+; CHECK-NEXT: [[RES:%.*]] = call <2 x i64> @ctlz(<2 x i64> [[ARG:%.*]])
+; CHECK-NEXT: ret <2 x i64> [[RES]]
+;
+ %res = call <2 x i64> @ctlz(<2 x i64> %arg)
+ ret <2 x i64> %res
+}
+
+declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)
+
; CHECK: [[RNG0]] = !{i32 0, i32 21}
; CHECK: [[RNG1]] = !{i32 500, i32 601}
More information about the llvm-commits
mailing list