https://bugs.llvm.org/show_bug.cgi?id=47308

            Bug ID: 47308
           Summary: Loop vectorizer causes crash when compiler -
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedb...@nondot.org
          Reporter: praha...@ualberta.ca
                CC: llvm-bugs@lists.llvm.org

compile command:

./clang -Os -mllvm -force-vector-width=4 bug_test.c -S -emit-llvm -o bug_os.ll


source: 

bug_test.c

include <stdio.h>

int a;

int main(void) {

    int d = -1;

#pragma clang loop vectorize(assume_safety)
    for (int i = 0; i < 49; ++i) {
        a |= d;
        d = i;
    }

    return 0;
}


The issue is in LoopVectorize.cpp in
LoopVectorizationPlanner::collectTriviallyDeadInstructions. The induction phi
for variable 'c' is marked as dead code here as it is the only use of induction
phi 'd'. Maybe a fix would add a check to ensure the use is not a phi of a
different induction variable. The phi statement being marked as dead code means
it does not get a vectorization recipe and the vector loop body ends up
referring to the original scalar induction variable %c in the vector loop body.
But %c is not defined yet. This causes the assertion in
InnerLoopVectorizer::fixupIVUsers to fail: "Expected LCSSA form".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to