[llvm] [DA] Fix the check between Subscript and Size after delinearization (PR #151326)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 06:43:53 PDT 2025
================
@@ -594,14 +594,15 @@ for.end12: ; preds = %for.inc10, %entry
}
+; FIXME? It seems that we cannot prove that %N is non-negative...
define void @nonnegative(ptr nocapture %A, i32 %N) {
; CHECK-LABEL: 'nonnegative'
; CHECK-NEXT: Src: store i32 1, ptr %arrayidx, align 4 --> Dst: store i32 1, ptr %arrayidx, align 4
-; CHECK-NEXT: da analyze - none!
+; CHECK-NEXT: da analyze - output [* *]!
; CHECK-NEXT: Src: store i32 1, ptr %arrayidx, align 4 --> Dst: store i32 2, ptr %arrayidx, align 4
-; CHECK-NEXT: da analyze - consistent output [0 0|<]!
+; CHECK-NEXT: da analyze - output [* *|<]!
; CHECK-NEXT: Src: store i32 2, ptr %arrayidx, align 4 --> Dst: store i32 2, ptr %arrayidx, align 4
-; CHECK-NEXT: da analyze - none!
+; CHECK-NEXT: da analyze - output [* *]!
----------------
Meinersbur wrote:
The original result is correct in the sense that `%N` should be be interpreted as an unsigned integer, i.e. always non-negative. It is compared to `%add19` which has an nuw flag which means `%i.043` will never have the same value in different iterations (and since `%mul` and `%A` are invariant, also `%add` and `%arrayidx`).
%N can be larger than INT32_MAX which woud indeed be negative in a signed interpretation. But do we want to only consider signed loop indiction variables?
https://github.com/llvm/llvm-project/pull/151326
More information about the llvm-commits
mailing list