<div dir="ltr"><div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> I'm not familiar with how LLVM will optimize or behave given:</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">></span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> struct F { int }</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">></span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> Struct G { int, int }</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">></span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> Struct H { F, int }</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">></span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">> Is there a difference between G & H w.r.t to optimizations?</span><br></div><div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px"><br></span></div><div style="font-size:12.8000001907349px">%struct.F = type { i32 }<br></div><div style="font-size:12.8000001907349px">%struct.G = type { i32, i32 }</div><div style="font-size:12.8000001907349px">%struct.H = type { %struct.F, i32 }</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Without optimizations you will get something like the above.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">It may be worthwhile to cook up a small example using the structs, and then run:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">clang -emit-llvm -S -O0 experiment.cpp -o WithO0.ll<br></div><div style="font-size:12.8000001907349px">clang -emit-llvm -S -O3 experiment.cpp -o WithO3.ll</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">(Or you can use opt and -whatever_optimization) to see the output for specific optimizations.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Then you can compare what the outputs are.</div><div style="font-size:12.8000001907349px">I then like using diff to compare:<br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">diff -y W 80 With WithO0.ll WithO3.ll</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">If you need more help building an example to see how optimizations propagate, I can try to make a small example to explore this.</div><div><div class="gmail_signature"><div dir="ltr"><div>_______________________________</div><div><div>Mike Shah<br>Ph.D. Student</div><div>Tufts University</div><div><a href="http://michaeldshah.net/" target="_blank">http://michaeldshah.net</a></div></div></div></div></div>
</div>