[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 9 17:05:01 PST 2003


Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.48 -> 1.49

---
Log message:

Don't insert null entries into the scalar map for constexpr (cast null to Ty)


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.48 llvm/lib/Analysis/DataStructure/Local.cpp:1.49
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.48	Sat Feb  8 14:18:39 2003
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sun Feb  9 17:04:12 2003
@@ -174,16 +174,22 @@
       return NH = getValueDest(*CPR->getValue());
     } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
       if (CE->getOpcode() == Instruction::Cast)
-        return NH = getValueDest(*CE->getOperand(0));
-      if (CE->getOpcode() == Instruction::GetElementPtr) {
+        NH = getValueDest(*CE->getOperand(0));
+      else if (CE->getOpcode() == Instruction::GetElementPtr) {
         visitGetElementPtrInst(*CE);
         hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.find(CE);
         assert(I != ScalarMap.end() && "GEP didn't get processed right?");
-        return NH = I->second;
+        NH = I->second;
+      } else {
+        // This returns a conservative unknown node for any unhandled ConstExpr
+        return NH = createNode(DSNode::UnknownNode);
       }
+      if (NH.getNode() == 0) {  // (getelementptr null, X) returns null
+        ScalarMap.erase(V);
+        return 0;
+      }
+      return NH;
 
-      // This returns a conservative unknown node for any unhandled ConstExpr
-      return NH = createNode(DSNode::UnknownNode);
     } else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(C)) {
       // Random constants are unknown mem
       return NH = createNode(DSNode::UnknownNode);





More information about the llvm-commits mailing list