https://llvm.org/bugs/show_bug.cgi?id=27509
Bug ID: 27509
Summary: Function Passes inadvertently skipped
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: opt
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
In opt.cpp, if there are any passes specified in the argument list after an
optimizaton level is specified, the OptLevelO<x> is set to false by code like
this:
if (OptLevelO3 && OptLevelO3.getPosition() < PassList.getPosition(i)) {
AddOptimizationPasses(Passes, *FPasses, 3, 0);
OptLevelO3 = false;
}
This seems to be done to avoid rerunning AddOptimizationPasses(). But later,
FPasses is run only if any of these OptLevels are true:
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
FPasses->doInitialization();
for (Function &F : *M)
FPasses->run(F);
FPasses->doFinalization();
}
Thus FPasses is not run and I consider that a bug. My suggestion for a bugfix
is simple:
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -598,7 +598,7 @@ int main(int argc, char **argv) {
if (OptLevelO3)
AddOptimizationPasses(Passes, *FPasses, 3, 0);
- if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
+ if (FPasses) {
FPasses->doInitialization();
for (Function &F : *M)
FPasses->run(F);
BR,
Jesper Antonsson, Ericsson AB
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs