[llvm-commits] [llvm] r165208 - in /llvm/trunk: include/llvm/Instructions.h include/llvm/Support/CallSite.h lib/Transforms/IPO/FunctionAttrs.cpp lib/VMCore/Instructions.cpp

Bill Wendling isanbard at gmail.com
Wed Oct 3 23:52:09 PDT 2012


Author: void
Date: Thu Oct  4 01:52:09 2012
New Revision: 165208

URL: http://llvm.org/viewvc/llvm-project?rev=165208&view=rev
Log:
Add method to query for 'NoAlias' attribute on call/invoke instructions.

Modified:
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/include/llvm/Support/CallSite.h
    llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=165208&r1=165207&r2=165208&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Thu Oct  4 01:52:09 2012
@@ -1279,6 +1279,7 @@
   bool paramHasStructRetAttr(unsigned i) const;
   bool paramHasNestAttr(unsigned i) const;
   bool paramHasByValAttr(unsigned i) const;
+  bool paramHasNoAliasAttr(unsigned i) const;
 
   /// @brief Determine whether the call or the callee has the given attribute.
   bool paramHasAttr(unsigned i, Attributes attr) const;
@@ -3049,6 +3050,7 @@
   bool paramHasStructRetAttr(unsigned i) const;
   bool paramHasNestAttr(unsigned i) const;
   bool paramHasByValAttr(unsigned i) const;
+  bool paramHasNoAliasAttr(unsigned i) const;
 
   /// @brief Determine whether the call or the callee has the given attribute.
   bool paramHasAttr(unsigned i, Attributes attr) const;

Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=165208&r1=165207&r2=165208&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Thu Oct  4 01:52:09 2012
@@ -208,6 +208,9 @@
   bool paramHasByValAttr(unsigned i) const {
     CALLSITE_DELEGATE_GETTER(paramHasByValAttr(i));
   }
+  bool paramHasNoAliasAttr(unsigned i) const {
+    CALLSITE_DELEGATE_GETTER(paramHasNoAliasAttr(i));
+  }
 
   /// paramHasAttr - whether the call or the callee has the given attribute.
   bool paramHasAttr(uint16_t i, Attributes attr) const {

Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=165208&r1=165207&r2=165208&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Thu Oct  4 01:52:09 2012
@@ -520,7 +520,7 @@
         case Instruction::Call:
         case Instruction::Invoke: {
           CallSite CS(RVI);
-          if (CS.paramHasAttr(0, Attribute::NoAlias))
+          if (CS.paramHasNoAliasAttr(0))
             break;
           if (CS.getCalledFunction() &&
               SCCNodes.count(CS.getCalledFunction()))

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=165208&r1=165207&r2=165208&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Oct  4 01:52:09 2012
@@ -390,6 +390,14 @@
   return false;
 }
 
+bool CallInst::paramHasNoAliasAttr(unsigned i) const {
+  if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
+    return true;
+  if (const Function *F = getCalledFunction())
+    return F->getParamAttributes(i).hasNoAliasAttr();
+  return false;
+}
+
 bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
   if (AttributeList.paramHasAttr(i, attr))
     return true;
@@ -658,6 +666,14 @@
   return false;
 }
 
+bool InvokeInst::paramHasNoAliasAttr(unsigned i) const {
+  if (AttributeList.getParamAttributes(i).hasNoAliasAttr())
+    return true;
+  if (const Function *F = getCalledFunction())
+    return F->getParamAttributes(i).hasNoAliasAttr();
+  return false;
+}
+
 bool InvokeInst::paramHasAttr(unsigned i, Attributes attr) const {
   if (AttributeList.paramHasAttr(i, attr))
     return true;





More information about the llvm-commits mailing list