<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div><br></div><div>This patch implements a simple optimization of redundant insertvalue instructions.</div><div><br></div><div>Here is a small example where it will help:</div><div><div><font face="Consolas">  %0 = insertvalue { i8, i32 } undef, i8 %x, 0</font></div><div><font face="Consolas">  %1 = insertvalue { i8, i32 } %0,    i8 %y, 0</font></div></div><div><br></div><div>In this example, the second instruction inserts values at the same indices, as the first one, and consequently, the first instruction is redundant.</div><div>This code will be transformed to:</div><div><div><font face="Consolas">  %0 = insertvalue { i8, i32 } undef, i8 %y, 0</font></div></div><div><font face="Consolas"><br></font></div><div>This optimization catches nothing on specs and test-suite, but the example was inspired by a real world application.</div><div><br></div><div>As an experiment, I tried a more sophisticated implementation, which was capable of dealing with several users and with partially overlapping indices, but that also caught nothing on specs (and for my application the simple version was enough). If there is an interest, I could share a patch with this more complicated implementation as well.</div><div><br></div><div>Is it ok to commit this patch?</div><div><br></div><div></div></body></html>