https://llvm.org/bugs/show_bug.cgi?id=31439
Bug ID: 31439 Summary: LLVM consider GEP(a + i - 1) could not be zero Product: libraries Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Global Analyses Assignee: unassignedb...@nondot.org Reporter: evstu...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified char *foo() { return 0; } int main(int argc, char *argv[]) { if(foo() + argc - 1) return 1; return 0; } clang test.c -O0 ./a.out; echo $? 0 clang test.c -O3 ./a.out; echo $? 1 The transformation that leads to this is Early CSE: ValueTracking.cpp: isGEPKnownNonNull consider GEP is not null if one of its operands is constant. That way LLVMoptimize "if(foo() + argc - 1)" to always true. -- 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