[llvm-bugs] [Bug 47308] New: Loop vectorizer causes crash when compiler -

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 25 14:09:23 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: praharen at ualberta.ca
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200825/d9dd11b7/attachment.html>


More information about the llvm-bugs mailing list