[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 24 17:28:04 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
Local.cpp updated: 1.122 -> 1.123
---
Log message:
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.
---
Diffs of the changes: (+11 -1)
Local.cpp | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletion(-)
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.122 llvm/lib/Analysis/DataStructure/Local.cpp:1.123
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.122 Thu Feb 24 13:55:31 2005
+++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Feb 24 19:27:48 2005
@@ -104,6 +104,7 @@
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 @@
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::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();
More information about the llvm-commits
mailing list