[llvm] [DependenceAnalysis] Prevent non-AddRec expressions from reaching testSIV (PR #154980)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 10:21:07 PDT 2025


kasuga-fj wrote:

JFYI: Here is the beginning part of the log:

```
Printing analysis 'Dependence Analysis' for function 'f':
Src:  store i8 0, ptr %idx, align 1 --> Dst:  store i8 0, ptr %idx, align 1
  da analyze -     SrcSCEV = ((4 * (zext i1 {false,+,true}<%loop> to i64))<nuw><nsw> + {%a,+,1}<nuw><%loop>)
    DstSCEV = ((4 * (zext i1 {false,+,true}<%loop> to i64))<nuw><nsw> + {%a,+,1}<nuw><%loop>)
    common nesting levels = 1
    maximum nesting levels = 1
Delinearized subscripts of fixed-size array
SrcGEP:  %idx = getelementptr inbounds [4 x [4 x i8]], ptr %a, i64 0, i64 %and, i64 %i
DstGEP:  %idx = getelementptr inbounds [4 x [4 x i8]], ptr %a, i64 0, i64 %and, i64 %i

SrcSubscripts: (zext i1 {false,+,true}<%loop> to i64){0,+,1}<nuw><nsw><%loop>
DstSubscripts: (zext i1 {false,+,true}<%loop> to i64){0,+,1}<nuw><nsw><%loop>    delinearized
    subscript 0
	src = {false,+,true}<%loop>
	dst = {false,+,true}<%loop>
	class = 1
	loops = {1}
    subscript 1
	src = {0,+,1}<nuw><nsw><%loop>
	dst = {0,+,1}<nuw><nsw><%loop>
	class = 1
	loops = {1}
    Separable = {}
    Coupled = {1}
starting on coupled subscripts
MaxLevels + 1 = 2
testing subscript group 1 { 0 1 }
testing subscript 0, SIV
SIV
    src = (sext i1 {false,+,true}<%loop> to i64)
    dst = (sext i1 {false,+,true}<%loop> to i64)
SIV test expected at least one AddRec
UNREACHABLE executed at /root/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp:2284!
```

Just after the delinearization, the first subscript is `(zext i1 {false,+,true}<%loop> to i64)`, but before the SIV test it has somehow been changed to `(sext i1 {false,+,true}<%loop> to i64)` (`zext` got replaced with `sext` ?!). I think issue #148435 implies several serious defects...

https://github.com/llvm/llvm-project/pull/154980


More information about the llvm-commits mailing list