<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 17, 2012, at 1:22 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I'm curious why I am seeing this: <br><br>  <b>%uglygep18.sum = add i32 %lsr_iv8, %tmp45</b><br>  %scevgep19 = getelementptr i8* %parBits_017, i32 %uglygep18_sum<br>  %scevgep1920 = bitcast i8* %scevgep19 to i16*<br>  %tmp78 = load i16* %scevgep1920, align 2<br>
 <b> %uglygep14.sum = add i32 %lsr_iv8, %tmp45</b><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>
  <b>%uglygep.sum = add i32 %lsr_iv8, %tmp45</b><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, appearing that there are two redundant add operations that are not needed yet are generated?<br></blockquote></div><br><div>That's LSR, as you can see from the variable names ;) It might think that load(Base + Index) is a legal addressing mode for your target. -disable-lsr might be the right thing for you anyway.</div><div><br></div><div>Incidentally, MachineCSE could clean this up if it doesn't get folded into the address, but like LSR, it tries hard not to increase register pressure.</div><div><br></div><div>-Andy</div></body></html>