[llvm-commits] [PATCH] Clear unknown mem ops when merging stack slots (pr14090)

Nadav Rotem nrotem at apple.com
Wed Oct 17 11:45:36 PDT 2012


Looking good!  Please commit.  I have a small comment below. 

+        const Value *UO = GetUnderlyingObject(V);
+
+        // Update value if it is in our map. Otherwise we may need to clear it
+        // if we don't know for sure that it doesn't alias a merged alloca.
+        DenseMap<const Value*, const Value*>::iterator NewV = Allocas.find(UO);
+        if (NewV != Allocas.end())

Why do you use 'find' and not count ? 

+          V = NewV->second;
+        else if (!UO || !isa<AllocaInst>(UO))
+          V = 0;

Are you checking if UO is zero after searching the map because you assume that it is less likely to happen ?

+
+        MMO->setValue(V);
+        FixedMemOp += (V != 0);

Thanks,
Nadav

On Oct 17, 2012, at 11:40 AM, Matthew Curtis <mcurtis at codeaurora.org> wrote:

> Hello Nadav,
> 
> Attached is a fix for pr14090.
> 
> Please review.
> 
> Thanks,
> Matthew Curtis
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
> 
> <0001-Clear-unknown-mem-ops-when-merging-stack-slots-pr140.patch>




More information about the llvm-commits mailing list