[llvm-commits] [llvm] r171627 - in /llvm/trunk/lib/Transforms: InstCombine/InstCombineLoadStoreAlloca.cpp Scalar/LICM.cpp Utils/MetaRenamer.cpp

Chris Lattner sabre at nondot.org
Sat Jan 5 08:44:07 PST 2013


Author: lattner
Date: Sat Jan  5 10:44:07 2013
New Revision: 171627

URL: http://llvm.org/viewvc/llvm-project?rev=171627&view=rev
Log:
switch from pointer equality comparison to MDNode::getMostGenericTBAA 
when merging two TBAA tags, pointed out by Nuno.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
    llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=171627&r1=171626&r2=171627&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Sat Jan  5 10:44:07 2013
@@ -803,10 +803,10 @@
   NewSI->setDebugLoc(OtherStore->getDebugLoc()); 
 
   // If the two stores had the same TBAA tag, preserve it.
-  if (MDNode *TBAATag1 = SI.getMetadata(LLVMContext::MD_tbaa))
-    if (MDNode *TBAATag2 = OtherStore->getMetadata(LLVMContext::MD_tbaa))
-      if (TBAATag1 == TBAATag2)
-        NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag1);
+  if (MDNode *TBAATag = SI.getMetadata(LLVMContext::MD_tbaa))
+    if ((TBAATag = MDNode::getMostGenericTBAA(TBAATag,
+                               OtherStore->getMetadata(LLVMContext::MD_tbaa))))
+      NewSI->setMetadata(LLVMContext::MD_tbaa, TBAATag);
 
   
   // Nuke the old stores.

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=171627&r1=171626&r2=171627&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sat Jan  5 10:44:07 2013
@@ -46,6 +46,7 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Metadata.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
@@ -816,10 +817,11 @@
       if (LoopUses.empty()) {
         // On the first load/store, just take its TBAA tag.
         TBAATag = Use->getMetadata(LLVMContext::MD_tbaa);
-      } else if (TBAATag && TBAATag != Use->getMetadata(LLVMContext::MD_tbaa)) {
-        TBAATag = 0;
+      } else if (TBAATag) {
+        TBAATag = MDNode::getMostGenericTBAA(TBAATag,
+                                       Use->getMetadata(LLVMContext::MD_tbaa));
       }
-    
+      
       LoopUses.push_back(Use);
     }
   }

Modified: llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp?rev=171627&r1=171626&r2=171627&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/MetaRenamer.cpp Sat Jan  5 10:44:07 2013
@@ -22,7 +22,6 @@
 #include "llvm/IR/Type.h"
 #include "llvm/Pass.h"
 #include "llvm/TypeFinder.h"
-
 using namespace llvm;
 
 namespace {





More information about the llvm-commits mailing list