<div>Fixed.</div><div>š</div><div>-Stepan</div><div>š</div><div>15.01.2014, 23:48, "Manman Ren" <manman.ren@gmail.com>:</div><blockquote type="cite"><div><div>Nits:</div><div>š</div><div>- š šreturn LHS.OffsetFromBase < RHS.OffsetFromBase;</div><div>+ š šif (LHS.OffsetFromBase < RHS.OffsetFromBase)</div><div>+ š š šreturn true;</div><div>+ š šif (LHS.OffsetFromBase == RHS.OffsetFromBase)</div><div>+ š š šreturn LHS.SequenceNum > RHS.SequenceNum;</div><div>+ š šreturn false;</div><div>š</div><div>return (LHS.OffsetFromBase < RHS.OffsetFromBase) || (LHS.OffsetFromBase == RHS.OffsetFromBase && LHS.SequenceNum > RHS.SequenceNum); ?</div><div>š</div><div><div>+; Function Attrs: nounwind uwtable</div><div>+; CHECK-LABEL: f</div><div>+define void @f() {</div><div>+entry:</div></div><div>š</div><div>remove "Function Attrs"?</div><div>š</div><div>Thanks,</div><div>Manman</div><div>š</div></div><div><br /><br /><div>On Wed, Jan 15, 2014 at 7:04 AM, Stepan Dyatkovskiy <span><<a href="mailto:stpworld@narod.ru" target="_blank">stpworld@narod.ru</a>></span> wrote:<br /><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex;">Fixed test<br /> <br /> Stepan Dyatkovskiy wrote:<br /><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div>Hi all.<br /> <br /> I think, trouble was in DAGCombiner::<u></u>MergeConsequtiveStores.<br /> <br /> Consider, how it works for next example:<br /> <br /> store i8 1, a[0]<br /> store i8 2, a[1]<br /> store i8 3, a[1] š ; a[1] again.<br /> return š ; DAG starts here<br /> <br /> 1. Method will collect all the 3 stores.<br /> 2. It sorts them by distance from the base pointer (farthest with<br /> highest index).<br /> 3. It takes first consecutive non-overlapping stores and (if possible)<br /> replaces them with a single store instruction.<br /> <br /> The point is, we can't determine here which 'store' instruction<br /> would be the second after sorting ('store 2' or 'store 3').<br /> It happens that 'store 3' would be the second, and 'store 2' would be<br /> the third.<br /> <br /> So after merging we have the next result:<br /> <br /> store i16 (1 | 3 << 8), base š ; is a[0] but bit-casted to i16<br /> store i8 2, a[1]<br /> <br /> So actually we swapped 'store 3' and 'store 2' and got wrong contents in<br /> a[1].<br /> <br /> Fix: In sort routine just also take into account mem-op sequence number.<br /> <br /> -Stepan<br /> <br /> </div></div>______________________________<u></u>_________________<br /> llvm-commits mailing list<br /> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br /> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br /> </blockquote><br /> <br />_______________________________________________<br /> llvm-commits mailing list<br /> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br /> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br /> </blockquote></div></div></blockquote>