[PATCH] D19526: Allow unsigned comparisons
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 03:51:35 PDT 2016
Meinersbur accepted this revision.
This revision is now accepted and ready to land.
================
Comment at: lib/Analysis/ScopInfo.cpp:1323-1326
@@ +1322,6 @@
+ auto *BB = Stmt.getEntryBlock();
+ S.recordAssumption(UNSIGNED, isl_pw_aff_nonneg_set(isl_pw_aff_copy(LHS)),
+ TI->getDebugLoc(), AS_ASSUMPTION, BB);
+ S.recordAssumption(UNSIGNED, isl_pw_aff_nonneg_set(isl_pw_aff_copy(RHS)),
+ TI->getDebugLoc(), AS_ASSUMPTION, BB);
+ }
----------------
I assume that RTCs checks will always be signed therefor this will check whether the MSB is not 1. Could you add a comment for that?
================
Comment at: test/ScopInfo/simple_loop_unsigned.ll:3-7
@@ +2,7 @@
+
+; void f(int a[], int N) {
+; int i;
+; for (i = 0; i < N; ++i)
+; a[i] = i;
+; }
+
----------------
This has no unsigned comparison. Can you make it represent the IR below? Eg.
for (i = 0; (uint64_t)i < (uint64_t)N; ++i)
%i is of type i64, so I suggest to declare `i` as `int64_t`
================
Comment at: test/ScopInfo/simple_loop_unsigned.ll:13
@@ +12,3 @@
+; CHECK: Arrays {
+; CHECK-NEXT: i64 MemRef_a[*]; // Element size 8
+; CHECK-NEXT: }
----------------
Why is this significant for the test case?
================
Comment at: test/ScopInfo/simple_loop_unsigned_2.ll:36
@@ +35,3 @@
+ store i64 %i, i64* %scevgep
+ %i.dec = add nsw i64 %i, -1
+ %exitcond = icmp ugt i64 %i.dec, 0
----------------
Since `i` is unsigned, why does it have a nsw flag?
http://reviews.llvm.org/D19526
More information about the llvm-commits
mailing list