diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-02-25 01:27:48 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-02-25 01:27:48 +0000 |
| commit | e99ee2b35dd8355309db8139edb911151b591e95 (patch) | |
| tree | 2d5d89bbf9e3b5d520ebe8ff84b9024aeecab397 /llvm/lib/Analysis/DataStructure/Local.cpp | |
| parent | e447fce542a176081572296abf57049b6af7ad58 (diff) | |
| download | bcm5719-llvm-e99ee2b35dd8355309db8139edb911151b591e95.tar.gz bcm5719-llvm-e99ee2b35dd8355309db8139edb911151b591e95.zip | |
Handle null a bit more carefully.
Actually teach dsa about select instructions. This doesn't affect the
graph in any way other than not setting a spurious U marker on pointer
nodes that are selected.
llvm-svn: 20324
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 642de036975..b2a905e0e59 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -104,6 +104,7 @@ namespace { void handleAlloc(AllocationInst &AI, bool isHeap); void visitPHINode(PHINode &PN); + void visitSelectInst(SelectInst &SI); void visitGetElementPtrInst(User &GEP); void visitReturnInst(ReturnInst &RI); @@ -316,6 +317,14 @@ void GraphBuilder::visitPHINode(PHINode &PN) { PNDest.mergeWith(getValueDest(*PN.getIncomingValue(i))); } +void GraphBuilder::visitSelectInst(SelectInst &SI) { + if (!isPointerType(SI.getType())) return; // Only pointer Selects + + DSNodeHandle &Dest = ScalarMap[&SI]; + Dest.mergeWith(getValueDest(*SI.getOperand(1))); + Dest.mergeWith(getValueDest(*SI.getOperand(2))); +} + void GraphBuilder::visitGetElementPtrInst(User &GEP) { DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.isNull()) @@ -430,7 +439,8 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { void GraphBuilder::visitLoadInst(LoadInst &LI) { DSNodeHandle Ptr = getValueDest(*LI.getOperand(0)); - if (Ptr.getNode() == 0) return; + if (Ptr.isNull()) + Ptr = createNode(); // Make that the node is read from... Ptr.getNode()->setReadMarker(); |

