Changeset View
Standalone View
llvm/tools/opt/opt.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include "llvm/Support/TargetRegistry.h" | #include "llvm/Support/TargetRegistry.h" | ||||
#include "llvm/Support/TargetSelect.h" | #include "llvm/Support/TargetSelect.h" | ||||
#include "llvm/Support/ToolOutputFile.h" | #include "llvm/Support/ToolOutputFile.h" | ||||
#include "llvm/Support/YAMLTraits.h" | #include "llvm/Support/YAMLTraits.h" | ||||
#include "llvm/Target/TargetMachine.h" | #include "llvm/Target/TargetMachine.h" | ||||
#include "llvm/Transforms/Coroutines.h" | #include "llvm/Transforms/Coroutines.h" | ||||
#include "llvm/Transforms/IPO/AlwaysInliner.h" | #include "llvm/Transforms/IPO/AlwaysInliner.h" | ||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h" | #include "llvm/Transforms/IPO/PassManagerBuilder.h" | ||||
#include "llvm/Transforms/IPO/WholeProgramDevirt.h" | |||||
#include "llvm/Transforms/Utils/Cloning.h" | #include "llvm/Transforms/Utils/Cloning.h" | ||||
#include "llvm/Transforms/Utils/Debugify.h" | #include "llvm/Transforms/Utils/Debugify.h" | ||||
#include <algorithm> | #include <algorithm> | ||||
#include <memory> | #include <memory> | ||||
using namespace llvm; | using namespace llvm; | ||||
using namespace opt_tool; | using namespace opt_tool; | ||||
// The OptimizationList is automatically populated with registered Passes by the | // The OptimizationList is automatically populated with registered Passes by the | ||||
▲ Show 20 Lines • Show All 555 Lines • ▼ Show 20 Lines | #endif | ||||
// pass pipelines. Otherwise we can crash on broken code during | // pass pipelines. Otherwise we can crash on broken code during | ||||
// doInitialization(). | // doInitialization(). | ||||
if (!NoVerify && verifyModule(*M, &errs())) { | if (!NoVerify && verifyModule(*M, &errs())) { | ||||
errs() << argv[0] << ": " << InputFilename | errs() << argv[0] << ": " << InputFilename | ||||
<< ": error: input module is broken!\n"; | << ": error: input module is broken!\n"; | ||||
return 1; | return 1; | ||||
} | } | ||||
// Enable testing of whole program devirtualization on this module by invoking | |||||
// the facility for updating public visibility to linkage unit visibility when | |||||
// specified by an internal option. This is normally done during LTO which is | |||||
// not performed via opt. | |||||
updateVCallVisibilityInModule(*M, | |||||
evgeny777: Hm, looks like I don't fully understand this. I have following concerns:
1) According to your… | |||||
No, it wouldn't be needed if the tests contained !vcall_visibility metadata indicating hidden LTO visibility (see my earlier comment response).
I could do that. What it would mean though is that we would be unable to use opt for any future testing of vtables intended to have public vcall visibility (either through a lack of that metadata, or explicit vcall_vsibility metadata indicating public). Which might be ok - in fact all my new testing of this behavior is via llvm-lto2 or the linkers. I suppose that would obviate this change as well as all the opt based test changes to pass the flag. Do you think that is better? tejohnson: > According to your changes every time I use opt -wholeprogramdevirt I also have to pass -whole… | |||||
Thanks for explanation. I think it's okay to have this extra option for devirtualization to work with legacy IR files using opt. But please add comment somewhere documenting why exactly this option is needed (probably near its definition in WholeProgramDevirt.cpp) evgeny777: > I could do that. What it would mean though is that we would be unable to use opt for any… | |||||
Added a comment documenting the need to where the option is defined. tejohnson: Added a comment documenting the need to where the option is defined. | |||||
/* WholeProgramVisibilityEnabledInLTO */ false); | |||||
// Figure out what stream we are supposed to write to... | // Figure out what stream we are supposed to write to... | ||||
std::unique_ptr<ToolOutputFile> Out; | std::unique_ptr<ToolOutputFile> Out; | ||||
std::unique_ptr<ToolOutputFile> ThinLinkOut; | std::unique_ptr<ToolOutputFile> ThinLinkOut; | ||||
if (NoOutput) { | if (NoOutput) { | ||||
if (!OutputFilename.empty()) | if (!OutputFilename.empty()) | ||||
errs() << "WARNING: The -o (output filename) option is ignored when\n" | errs() << "WARNING: The -o (output filename) option is ignored when\n" | ||||
"the --disable-output option is used.\n"; | "the --disable-output option is used.\n"; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 345 Lines • Show Last 20 Lines |
Hm, looks like I don't fully understand this. I have following concerns: