[llvm-commits] [llvm] r46206 - /llvm/trunk/lib/VMCore/Instructions.cpp

Duncan Sands baldrick at free.fr
Mon Jan 21 03:28:00 PST 2008


Author: baldrick
Date: Mon Jan 21 05:27:55 2008
New Revision: 46206

URL: http://llvm.org/viewvc/llvm-project?rev=46206&view=rev
Log:
Be consistent with other attribute methods, and
check the callee also if it is known.

Modified:
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=46206&r1=46205&r2=46206&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jan 21 05:27:55 2008
@@ -406,7 +406,13 @@
 
 /// @brief Determine if any call argument is an aggregate passed by value.
 bool CallInst::hasByValArgument() const {
-  return ParamAttrs && ParamAttrs->hasAttrSomewhere(ParamAttr::ByVal);
+  if (ParamAttrs && ParamAttrs->hasAttrSomewhere(ParamAttr::ByVal))
+    return true;
+  // Be consistent with other methods and check the callee too.
+  if (const Function *F = getCalledFunction())
+    if (const ParamAttrsList *PAL = F->getParamAttrs())
+      return PAL->hasAttrSomewhere(ParamAttr::ByVal);
+  return false;
 }
 
 void CallInst::setDoesNotThrow(bool doesNotThrow) {





More information about the llvm-commits mailing list