summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-09 23:04:12 +0000
committerChris Lattner <sabre@nondot.org>2003-02-09 23:04:12 +0000
commit43df2886c5e74e9efdca8d8ed62f2888e44a4ad8 (patch)
tree0bab17efe6d2ca48af19fdc6b0799415e48e86fb /llvm/lib/Analysis/DataStructure/Local.cpp
parent893dfda486d51b2f03c73fdb035be8a60aa0f1c0 (diff)
downloadbcm5719-llvm-43df2886c5e74e9efdca8d8ed62f2888e44a4ad8.tar.gz
bcm5719-llvm-43df2886c5e74e9efdca8d8ed62f2888e44a4ad8.zip
Don't insert null entries into the scalar map for constexpr (cast null to Ty)
llvm-svn: 5523
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--llvm/lib/Analysis/DataStructure/Local.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp
index 559d79aa8fa..b54827699ed 100644
--- a/llvm/lib/Analysis/DataStructure/Local.cpp
+++ b/llvm/lib/Analysis/DataStructure/Local.cpp
@@ -174,16 +174,22 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
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);
OpenPOWER on IntegriCloud