diff options
author | Duncan Sands <baldrick@free.fr> | 2009-11-03 09:40:08 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-11-03 09:40:08 +0000 |
commit | 674fdc9a289c56edeb799bf5a8d4668f7e22bf73 (patch) | |
tree | 0e89e866838e44d7d5fc19fa35c80bc6faed1068 /include/llvm | |
parent | 8fd64a5e27bba6f8d1b87682beb6639d1223556d (diff) | |
download | external_llvm-674fdc9a289c56edeb799bf5a8d4668f7e22bf73.zip external_llvm-674fdc9a289c56edeb799bf5a8d4668f7e22bf73.tar.gz external_llvm-674fdc9a289c56edeb799bf5a8d4668f7e22bf73.tar.bz2 |
Run the functionattrs pass after the inliner, and not before.
This makes both logical sense (see below) and increases the
number of functions marked readnone/readonly by about 1-2%
in practice. The number of functions marked nocapture goes
up by about 5-10%. The reason it makes sense is shown by
the following example: if you run -functionattrs -inline on
it, then no attributes are assigned. But if you instead run
-inline -functionattrs then @f is marked readnone because the
simplifications produced by the inliner eliminate the store.
@x = external global i32
define void @w(i1 %b) {
br i1 %b, label %write, label %return
write:
store i32 1, i32 *@x
br label %return
return:
ret void
}
define void @f() {
call void @w(i1 0)
ret void
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Support/StandardPasses.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/llvm/Support/StandardPasses.h b/include/llvm/Support/StandardPasses.h index 6a79b5d..a539444 100644 --- a/include/llvm/Support/StandardPasses.h +++ b/include/llvm/Support/StandardPasses.h @@ -107,13 +107,12 @@ namespace llvm { PM->add(createCFGSimplificationPass()); // Clean up after IPCP & DAE // Start of CallGraph SCC passes. - if (UnitAtATime) { - if (HaveExceptions) - PM->add(createPruneEHPass()); // Remove dead EH info - PM->add(createFunctionAttrsPass()); // Set readonly/readnone attrs - } + if (UnitAtATime && HaveExceptions) + PM->add(createPruneEHPass()); // Remove dead EH info if (InliningPass) PM->add(InliningPass); + if (UnitAtATime) + PM->add(createFunctionAttrsPass()); // Set readonly/readnone attrs if (OptimizationLevel > 2) PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args |