https://llvm.org/bugs/show_bug.cgi?id=27409
Bug ID: 27409 Summary: ScalarEvolution::getConstantEvolutionLoopExitValue doesn't evualate loops corectly. Product: new-bugs Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: new bugs Assignee: unassignedb...@nondot.org Reporter: willi...@coherentlogix.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16230 --> https://llvm.org/bugs/attachment.cgi?id=16230&action=edit Test Case but write up and output files. When we run the following test case. #include <stdio.h> int main() { int Test[10] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; int i; int Sum = 0; for(i = 0 ; i < 1 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 0 ; i < 2 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 0 ; i < 3 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 3 ; i < 7 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 7 ; i < 10 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 8 ; i < 10 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 9 ; i < 10 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); Sum = 0; for(i = 0 ; i < 10 ; i++) { Sum += Test[i] ; } printf("Sum = %d\n", Sum); return 0; } We expect the following output: Sum = 10 Sum = 19 Sum = 27 Sum = 22 Sum = 6 Sum = 3 Sum = 1 Sum = 55 However when we ran this program with clang using -O3 we got the following output: Sum = 10 Sum = 10 Sum = 19 Sum = 18 Sum = 6 Sum = 3 Sum = 1 Sum = 55 We have tracked the problem down to the following function: onstant * ScalarEvolution::getConstantEvolutionLoopExitValue(PHINode *PN, const APInt &BEs, const Loop *L) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs