search for: clang_scev_surprise

Displaying 1 result from an estimated 1 matches for "clang_scev_surprise".

2012 Dec 28
1
[LLVMdev] Surprising SCEV / Constant folding result
...++i) { // The kind of things that SCEV can recognize is quite astounding... // It wins over gcc for this one. //res = res + i*i; // Also, the kind of things it can't recognize... res = res * i; } dont_optimize_away(res); } // Compile using $ clang -Wall -std=c99 -O2 -c clang_scev_surprise.c -S -o - -emit-llvm In this loop, the value res is always zero, yet LLVM does not optimize the loop away at -O2 (contrary to GCC). Is there a simple explanation for this? Is this a case that is general enough that we could include it in LLVM? It looks like something that ScalarEvolution could re...