<div dir="ltr"><div><div><div>ping ping.<br><br></div>I've been asked for sample IR where it makes a difference. Here you go:<br><br><pre class="">%A__vtbl = type { i8*, i32 (%A*)* }
%A = type { %A__vtbl* }

@A__vtblZ = constant %A__vtbl { i8* null, i32 (%A*)* @A.foo }
@A__initZ = constant %A { %A__vtbl* @A__vtblZ }

define i32 @_Dmain() {
body:
  %0 = tail call i8* @_d_allocmemory(i64 8)
  %1 = bitcast i8* %0 to %A*
  store %A { %A__vtbl* @A__vtblZ }, %A* %1, align 8
  %2 = getelementptr inbounds %A* %1, i32 0, i32 0
  %vtbl.i = load %A__vtbl** %2, align 8
  %3 = getelementptr inbounds %A__vtbl* %vtbl.i, i64 0, i32 1
  %4 = load i32 (%A*)** %3, align 8
  %5 = tail call i32 %4(%A* %1)
  ret i32 %5
}

define i32 @A.foo(%A* nocapture %this) nounwind readnone {
body:
  ret i32 42
}</pre><br></div>Basically, any frontend that uses aggregate store will benefit greatly from this patch. Right now, if you store an aggregate and load from the aggregate, LLVM do not optimize at all.<br><br></div>As far as i'm aware, it is considered a bug by clang devs to use aggregate stores/loads, and they aren't used as a result, so the optimization won't improve things for clang.<br>

<div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-22 22:40 GMT-07:00 deadal nix <span dir="ltr"><<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I can't find the thread where this was discussed. I made a diff some time ago. Here is the same updated and with improved test coverage.<br>

<br></div>Currently, LLVM really misoptimize aggregate load/store. This diff is a big improvement on that side.<br>
<br></div>Amaury SECHET<br></div>
</blockquote></div><br></div>