<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 5, 2013 at 9:44 PM, Jim Grosbach <span dir="ltr"><<a href="mailto:grosbach@apple.com" target="_blank" class="cremed">grosbach@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":ne">+  // If the allocation has multiple uses, only promote it if we're not<br>
+  // shrinking the amount of memory being allocated.<br>
+  uint64_t AllocElTyStoreSize = TD->getTypeStoreSize(AllocElTy);<br>
+  uint64_t CastElTyStoreSize = TD->getTypeStoreSize(CastElTy);<br>
+  if (!AI.hasOneUse() && CastElTyStoreSize < AllocElTyStoreSize) return 0;<br>
+</div></blockquote></div><br>I may just be missing the point (i've not really thought about it deeply) but I saw this, and hand to ask: why is it safe to shrink the amount of memory being allocated even if the alloca only has one use?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra" style>%a = alloca i32</div><div class="gmail_extra" style>%a2 = bitcast i32* %a to i8*</div><div class="gmail_extra" style>%a3 = bitcast i8* %a2 to i32*</div><div class="gmail_extra" style>
%boom = load i32* %a3</div></div>