Eli,<br><br>  Thanks. So I'm unclear exactly which llvm opt will exhibit copy prop. behavior? <br><br>  It seems to me that codegenprepare is doing a useful thing (for me, since I'm just using the llvm IR and not going to backend, providing it's "exposing" and not simply "adding for layout for CodeGen opts" (or something similar to this)?<br>
<br>Thanks.<br><br><div class="gmail_quote">On Wed, Oct 17, 2012 at 1:44 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Wed, Oct 17, 2012 at 1:22 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>
> I'm curious why I am seeing this:<br>
><br>
>   %uglygep18.sum = add i32 %lsr_iv8, %tmp45<br>
>   %scevgep19 = getelementptr i8* %parBits_017, i32 %uglygep18_sum<br>
>   %scevgep1920 = bitcast i8* %scevgep19 to i16*<br>
>   %tmp78 = load i16* %scevgep1920, align 2<br>
>   %uglygep14.sum = add i32 %lsr_iv8, %tmp45<br>
>   %scevgep15 = getelementptr i8* %extIn_013, i32 %uglygep14_sum<br>
>   %scevgep1516 = bitcast i8* %scevgep15 to i16*<br>
>   %tmp79 = load i16* %scevgep1516, align 2<br>
>   %conv93.i.i = sext i16 %tmp79 to i32<br>
>   %uglygep.sum = add i32 %lsr_iv8, %tmp45<br>
>   %scevgep11 = getelementptr i8* %sysBits_010, i32 %uglygep_sum<br>
><br>
> You can see here that "add i32 %lsr_iv8, %tmp45" is done multiple times,<br>
> appearing that there are two redundant add operations that are not needed<br>
> yet are generated?<br>
<br>
</div></div>CodeGenPrepare manipulates GEPs in a way that can expose redundancy<br>
where it wasn't obvious before.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br>