[llvm] [LoopInterchange] Fix overflow in cost calculation (PR #111807)
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 04:12:56 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
+
----------------
sjoerdmeijer wrote:
It's a loop-cache-cost test now that prints its analysis. The cost that it prints is the interesting part that we want to check, so don't need to check the IR.
https://github.com/llvm/llvm-project/pull/111807
More information about the llvm-commits
mailing list