diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-04-06 21:27:31 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-04-06 21:27:31 +0000 |
commit | 9ac527037c0aca9c94cf853ba66f43bdaa949dd3 (patch) | |
tree | 0b01b03bc5bfa102f719592e7dd2428470482fab /llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | |
parent | 0ac129903ab033fff3103b55f2c7d2a1058b397d (diff) | |
download | llvm-9ac527037c0aca9c94cf853ba66f43bdaa949dd3.zip llvm-9ac527037c0aca9c94cf853ba66f43bdaa949dd3.tar.gz llvm-9ac527037c0aca9c94cf853ba66f43bdaa949dd3.tar.bz2 |
ArgPromo: Bail out earlier for varargs functions
llvm-svn: 234224
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 430df3d..73e6bf7 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -207,6 +207,13 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) { // Make sure that it is local to this module. if (!F || !F->hasLocalLinkage()) return nullptr; + // Don't promote arguments for variadic functions. Adding, removing, or + // changing non-pack parameters can change the classification of pack + // parameters. Frontends encode that classification at the call site in the + // IR, while in the callee the classification is determined dynamically based + // on the number of registers consumed so far. + if (F->isVarArg()) return nullptr; + // First check: see if there are any pointer arguments! If not, quick exit. SmallVector<Argument*, 16> PointerArgs; for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) @@ -227,12 +234,6 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) { isSelfRecursive = true; } - // Don't promote arguments for variadic functions. Adding, removing, or - // changing non-pack parameters can change the classification of pack - // parameters. Frontends encode that classification at the call site in the - // IR, while in the callee the classification is determined dynamically based - // on the number of registers consumed so far. - if (F->isVarArg()) return nullptr; const DataLayout &DL = F->getParent()->getDataLayout(); // Check to see which arguments are promotable. If an argument is promotable, |