[llvm-commits] CVS: llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp

Vikram Adve vadve at cs.uiuc.edu
Tue Jul 29 14:43:01 PDT 2003


Changes in directory llvm/lib/Analysis/LiveVar:

FunctionLiveVarInfo.cpp updated: 1.43 -> 1.44

---
Log message:

Don't require a BB to look-up live variables, unless they may need to
be recomputed.


---
Diffs of the changes:

Index: llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
diff -u llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.43 llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.44
--- llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.43	Mon May 26 19:06:00 2003
+++ llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp	Tue Jul 29 14:42:32 2003
@@ -180,28 +180,29 @@
 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





More information about the llvm-commits mailing list