summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChristian Bruel <christian.bruel@st.com>2018-12-05 16:48:00 +0000
committerChristian Bruel <christian.bruel@st.com>2018-12-05 16:48:00 +0000
commit4ead99b3ac2a0ccd5174c35bcf339eb080dd9697 (patch)
tree699e96567456f2052354c47527f7d17714a13234 /llvm/lib/Transforms
parent3998bebc1268982750473528a22297807cb9bce3 (diff)
downloadbcm5719-llvm-4ead99b3ac2a0ccd5174c35bcf339eb080dd9697.tar.gz
bcm5719-llvm-4ead99b3ac2a0ccd5174c35bcf339eb080dd9697.zip
Allow norecurse attribute on functions that have debug infos.
Summary: debug intrinsics might be marked norecurse to enable the caller function to be norecurse and optimized if needed. This avoids code gen optimisation differences when -g is used, as in globalOpt.cpp:processInternalGlobal checks. Reviewers: chandlerc, jmolloy, aprantl Reviewed By: aprantl Subscribers: aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D55187 llvm-svn: 348381
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index f01c6a4e99b..3a04f7a00d4 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -41,6 +41,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
@@ -1307,13 +1308,14 @@ static bool addNoRecurseAttrs(const SCCNodeSet &SCCNodes) {
// If all of the calls in F are identifiable and are to norecurse functions, F
// is norecurse. This check also detects self-recursion as F is not currently
// marked norecurse, so any called from F to F will not be marked norecurse.
- for (Instruction &I : instructions(*F))
- if (auto CS = CallSite(&I)) {
- Function *Callee = CS.getCalledFunction();
- if (!Callee || Callee == F || !Callee->doesNotRecurse())
- // Function calls a potentially recursive function.
- return false;
- }
+ for (auto &BB : *F)
+ for (auto &I : BB.instructionsWithoutDebug())
+ if (auto CS = CallSite(&I)) {
+ Function *Callee = CS.getCalledFunction();
+ if (!Callee || Callee == F || !Callee->doesNotRecurse())
+ // Function calls a potentially recursive function.
+ return false;
+ }
// Every call was to a non-recursive function other than this function, and
// we have no indirect recursion as the SCC size is one. This function cannot
OpenPOWER on IntegriCloud