[llvm] [LoopInterchange] Fix overflow in cost calculation (PR #111807)
Madhur Amilkanthwar via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 03:28:46 PDT 2024
================
@@ -0,0 +1,44 @@
+; REQUIRES: asserts
+
+; RUN: opt < %s -passes=loop-interchange -S -debug 2>&1 | FileCheck %s
+
+; For a loop with a very large iteration count, make sure the cost
+; calculation does not overflow:
+;
+; void a(int b) {
+; for (int c;; c += b)
+; for (long d = 0; d < -3ULL; d += 2ULL)
+; A[c][d][d] = 0;
+; }
+
+; CHECK: Access is not consecutive: RefCost=922337203685477580700
+; CHECK: Loop 'for.cond' has cost=9223372036854775807
+; CHECK: TripCount=9223372036854775807
+; CHECK: Access is not consecutive: RefCost=9223372036854775807
+
----------------
madhur13490 wrote:
Want to check anything from the emitted IR?
https://github.com/llvm/llvm-project/pull/111807
More information about the llvm-commits
mailing list