<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hi All,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It seems to me that there is potential for doing some target independent loop invariant optimizations in the back end, but prior to instruction selection. For instance, I noticed that the loop invariant constant generated for a loop bounds check is still stuck inside the loop. Likewise constant address generated for globals accessed within a loop are generated on each iteration, even though they are invariant.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm most familiar with LLVM's target interface and code gen and I'm not fully up to speed on the optimization framework. Is there an existing optimization pass that handles these cases that I've failed to properly enable or hook into? Is there something that inherently prevents these from being target independent optimizations, requiring a target specific opt pass? Is this simply an optimization pass that hasn't been implemented yet, but is a good idea?</DIV><DIV><BR class="khtml-block-placeholder"></DIV>Thanks<BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Christopher Lamb</DIV><DIV><A href="mailto:christopher.lamb@gmail.com">christopher.lamb@gmail.com</A></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>