[Hexagon] Do not create passes in the constructor of HexagonPassConfig

When running mir tests, a pass created in that constructor would not be
freed, leading to memory leaks.

llvm-svn: 271043
This commit is contained in:
Krzysztof Parzyszek 2016-05-27 20:48:39 +00:00
parent 681d717219
commit d0f8e1cf0d
1 changed files with 5 additions and 9 deletions

View File

@ -195,15 +195,7 @@ namespace {
class HexagonPassConfig : public TargetPassConfig {
public:
HexagonPassConfig(HexagonTargetMachine *TM, PassManagerBase &PM)
: TargetPassConfig(TM, PM) {
bool NoOpt = (TM->getOptLevel() == CodeGenOpt::None);
if (!NoOpt) {
if (EnableExpandCondsets) {
Pass *Exp = createHexagonExpandCondsets();
insertPass(&RegisterCoalescerID, IdentifyingPassPtr(Exp));
}
}
}
: TargetPassConfig(TM, PM) {}
HexagonTargetMachine &getHexagonTargetMachine() const {
return getTM<HexagonTargetMachine>();
@ -276,6 +268,10 @@ bool HexagonPassConfig::addInstSelector() {
void HexagonPassConfig::addPreRegAlloc() {
if (getOptLevel() != CodeGenOpt::None) {
if (EnableExpandCondsets) {
Pass *Exp = createHexagonExpandCondsets();
insertPass(&RegisterCoalescerID, IdentifyingPassPtr(Exp));
}
if (!DisableStoreWidening)
addPass(createHexagonStoreWidening(), false);
if (!DisableHardwareLoops)