llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Loop-Interchange crashes if the first phi node of a header is not an induction node

Open N-SysR opened this issue 6 years ago • 2 comments

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

N-SysR avatar Nov 18 '20 10:11 N-SysR

Here is a proposed fix: https://reviews.llvm.org/D102743

CongzheUalberta avatar May 19 '21 03:05 CongzheUalberta

*** This bug has been marked as a duplicate of bug llvm/llvm-project#42671 ***

N-SysR avatar Nov 18 '20 10:11 N-SysR