[llvm] 54f14d9 - [FunctionAttrs] Add test for incorrect predicate in capture analysis (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 04:08:53 PST 2025
Author: Nikita Popov
Date: 2025-02-20T13:08:45+01:00
New Revision: 54f14d96bb275a129321f9377987efcb43d773fa
URL: https://github.com/llvm/llvm-project/commit/54f14d96bb275a129321f9377987efcb43d773fa
DIFF: https://github.com/llvm/llvm-project/commit/54f14d96bb275a129321f9377987efcb43d773fa.diff
LOG: [FunctionAttrs] Add test for incorrect predicate in capture analysis (NFC)
Added:
Modified:
llvm/test/Transforms/FunctionAttrs/nocapture.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
index 6164f2adbf5b9..51a79702a5655 100644
--- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -771,6 +771,40 @@ define i1 @captureICmpRev(ptr %x) {
ret i1 %1
}
+define i1 @captureICmpWrongPred(ptr %x) {
+; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; FNATTRS-LABEL: define i1 @captureICmpWrongPred
+; FNATTRS-SAME: (ptr readnone [[X:%.*]]) #[[ATTR0]] {
+; FNATTRS-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
+; FNATTRS-NEXT: ret i1 [[TMP1]]
+;
+; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; ATTRIBUTOR-LABEL: define i1 @captureICmpWrongPred
+; ATTRIBUTOR-SAME: (ptr nofree readnone [[X:%.*]]) #[[ATTR0]] {
+; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
+; ATTRIBUTOR-NEXT: ret i1 [[TMP1]]
+;
+ %1 = icmp slt ptr %x, null
+ ret i1 %1
+}
+
+define i1 @captureICmpWrongPredDereferenceableOrNull(ptr dereferenceable_or_null(1) %x) {
+; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; FNATTRS-LABEL: define noundef i1 @captureICmpWrongPredDereferenceableOrNull
+; FNATTRS-SAME: (ptr readnone captures(none) dereferenceable_or_null(1) [[X:%.*]]) #[[ATTR0]] {
+; FNATTRS-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
+; FNATTRS-NEXT: ret i1 [[TMP1]]
+;
+; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; ATTRIBUTOR-LABEL: define i1 @captureICmpWrongPredDereferenceableOrNull
+; ATTRIBUTOR-SAME: (ptr nofree readnone dereferenceable_or_null(1) [[X:%.*]]) #[[ATTR0]] {
+; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
+; ATTRIBUTOR-NEXT: ret i1 [[TMP1]]
+;
+ %1 = icmp slt ptr %x, null
+ ret i1 %1
+}
+
define i1 @nocaptureInboundsGEPICmp(ptr %x) {
; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; FNATTRS-LABEL: define i1 @nocaptureInboundsGEPICmp
More information about the llvm-commits
mailing list