Loop-Interchange crashes if the first phi node of a header is not an induction node
| Bugzilla Link | 48212 |
| Resolution | DUPLICATE |
| Resolved on | May 18, 2021 20:57 |
| Version | 11.0 |
| OS | Linux |
| Attachments | IR file that causes the crash to happen. |
| CC | @CongzheUalberta |
Extended Description
$ clang test.c -Xclang -disable-O0-optnone -emit-llvm -O0 -S -o test.ll $ opt -mem2reg -loop-rotate -loop-interchange test.ll
opt: llvm-project/llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1583: bool (anonymous namespace)::LoopInterchangeTransform::adjustLoopBranches(): Assertion `OuterInnerReductions.find(PHI) != OuterInnerReductions.end() && "Expected a reduction PHI node"' failed.
And then there is the stacktrace.
test.c :
void foo (int filter[5][5]){ int k1, k2; int temp, mul; L1:for (k1=0;k1<5;k1++){ L2:for (k2=0;k2<3;k2++){ mul = filter[k2][k1]; temp += mul; } } }
int main() { int filter[5][5]; foo(filter); }
Build :
LLVM (http://llvm.org/): LLVM version 11.0.0git DEBUG build with assertions. Default target: x86_64-unknown-linux-gnu Host CPU: skylake
Here is a proposed fix: https://reviews.llvm.org/D102743
*** This bug has been marked as a duplicate of bug llvm/llvm-project#42671 ***