Open llvmbot opened 13 years ago
Here you go. (I know that the unoptimized code is overly verbose and redundant, that will be fixed eventually)
Bitcode after O3 on LLVM 2.8+ The conditional br in bb1.b.cgf should not jump to entry.a.cgf but rather to itself. In entry.a.cgf the terminator indirectbr prevents this from happening. Notice that bb1.b.cgf is part of a loop with a known iteration count; the above problems prevents other opts from turning the loop in a single addition.
IR before O3 on LLVM 2.8+ Bitcode before opt -O3
Please reopen when you have additional information, such as a testcase, thanks!
Hi Carlo,
Please attach a complete testcase. We've made progress in this area after 2.9, it may already be done on mainline.
Extended Description
Consider this IR fragment produced by opt -O3:
the br in %19 should be optimized to branch directly to itself rather than going back to %7 (note that the arg %8 to the indirectbr will always be the address of %19 when coming from %19). While this might or might not be so big of a problem per-se, notice how %19 is a loop body that simply adds 1 to the same variable at each iteration. Because the br is still pointing to %7 instead of %18, other passes are not able to recognize that the loop has a constant iteration count and could therefore be replaced entirely by a