[PATCH] D159160: [SCEV] Fix potentially empty set for unsigned ranges
Tejas Joshi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 3 20:31:08 PDT 2023
tejas updated this revision to Diff 555648.
tejas edited the summary of this revision.
tejas added a comment.
Added the github issue link for the fix.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159160/new/
https://reviews.llvm.org/D159160
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/malloc.ll
Index: llvm/test/Analysis/ScalarEvolution/malloc.ll
===================================================================
--- llvm/test/Analysis/ScalarEvolution/malloc.ll
+++ llvm/test/Analysis/ScalarEvolution/malloc.ll
@@ -23,4 +23,15 @@
ret ptr %alloc
}
+define ptr @undefined_max() {
+; CHECK-LABEL: 'undefined_max'
+; CHECK-NEXT: Classifying expressions for: @undefined_max
+; CHECK-NEXT: %alloc = call nonnull ptr @malloc(i64 -1)
+; CHECK-NEXT: --> %alloc U: full-set S: full-set
+; CHECK-NEXT: Determining loop execution counts for: @undefined_max
+;
+ %alloc = call nonnull ptr @malloc(i64 -1)
+ ret ptr %alloc
+}
+
declare noalias noundef ptr @malloc(i64 noundef) allockind("alloc,uninitialized") allocsize(0)
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6843,7 +6843,7 @@
if (llvm::isKnownNonZero(V, DL))
MinVal = Align;
ConservativeResult = ConservativeResult.intersectWith(
- {MinVal, MaxVal + 1}, RangeType);
+ ConstantRange::getNonEmpty(MinVal, MaxVal + 1), RangeType);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159160.555648.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230904/37f8d461/attachment.bin>
More information about the llvm-commits
mailing list