From 09091ee78267865d16ff9780cd6fbba2324a5d9e Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 29 Jul 2003 19:42:32 +0000 Subject: Don't require a BB to look-up live variables, unless they may need to be recomputed. llvm-svn: 7388 --- llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Analysis/LiveVar') diff --git a/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp index 63c20194df0..0e8e0ac41bf 100644 --- a/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp +++ b/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp @@ -180,28 +180,29 @@ void FunctionLiveVarInfo::releaseMemory() { const ValueSet & FunctionLiveVarInfo::getLiveVarSetBeforeMInst(const MachineInstr *MInst, const BasicBlock *BB) { - if (const ValueSet *LVSet = MInst2LVSetBI[MInst]) { - return *LVSet; // if found, just return the set - } else { - calcLiveVarSetsForBB(BB); // else, calc for all instrs in BB - return *MInst2LVSetBI[MInst]; + const ValueSet *LVSet = MInst2LVSetBI[MInst]; + if (LVSet == NULL && BB != NULL) { // if not found and BB provided + calcLiveVarSetsForBB(BB); // calc LVSet for all instrs in BB + LVSet = MInst2LVSetBI[MInst]; } + return *LVSet; } //----------------------------------------------------------------------------- // Gives live variable information after a machine instruction //----------------------------------------------------------------------------- + const ValueSet & FunctionLiveVarInfo::getLiveVarSetAfterMInst(const MachineInstr *MI, const BasicBlock *BB) { - if (const ValueSet *LVSet = MInst2LVSetAI[MI]) { - return *LVSet; // if found, just return the set - } else { - calcLiveVarSetsForBB(BB); // else, calc for all instrs in BB + const ValueSet *LVSet = MInst2LVSetAI[MI]; + if (LVSet == NULL && BB != NULL) { // if not found and BB provided + calcLiveVarSetsForBB(BB); // calc LVSet for all instrs in BB return *MInst2LVSetAI[MI]; } + return *LVSet; } // This function applies a machine instr to a live var set (accepts OutSet) and -- cgit v1.2.3