Skip to content

Commit 0ddf227

Browse files
committed
Add test for incorrect predicate
1 parent 6dd18a6 commit 0ddf227

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/test/Transforms/FunctionAttrs/nocapture.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,23 @@ define i1 @captureICmpRev(ptr %x) {
771771
ret i1 %1
772772
}
773773

774+
define i1 @captureICmpWrongPred(ptr %x) {
775+
; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
776+
; FNATTRS-LABEL: define i1 @captureICmpWrongPred
777+
; FNATTRS-SAME: (ptr readnone captures(address) [[X:%.*]]) #[[ATTR0]] {
778+
; FNATTRS-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
779+
; FNATTRS-NEXT: ret i1 [[TMP1]]
780+
;
781+
; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
782+
; ATTRIBUTOR-LABEL: define i1 @captureICmpWrongPred
783+
; ATTRIBUTOR-SAME: (ptr nofree readnone [[X:%.*]]) #[[ATTR0]] {
784+
; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = icmp slt ptr [[X]], null
785+
; ATTRIBUTOR-NEXT: ret i1 [[TMP1]]
786+
;
787+
%1 = icmp slt ptr %x, null
788+
ret i1 %1
789+
}
790+
774791
define i1 @nocaptureInboundsGEPICmp(ptr %x) {
775792
; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
776793
; FNATTRS-LABEL: define i1 @nocaptureInboundsGEPICmp

0 commit comments

Comments
 (0)