[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Mar 13 11:05:18 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.196 -> 1.197
---
Log message:
Replace linear search with logrithmic one.
---
Diffs of the changes: (+1 -4)
DataStructure.cpp | 5 +----
1 files changed, 1 insertion(+), 4 deletions(-)
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.196 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.197
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.196 Sat Mar 12 08:58:28 2005
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sun Mar 13 13:05:05 2005
@@ -443,10 +443,7 @@
case Type::StructTyID: {
const StructType *STy = cast<StructType>(SubType);
const StructLayout &SL = *TD.getStructLayout(STy);
-
- unsigned i = 0, e = SL.MemberOffsets.size();
- for (; i+1 < e && SL.MemberOffsets[i+1] <= Offset-O; ++i)
- /* empty */;
+ unsigned i = SL.getElementContainingOffset(Offset-O);
// The offset we are looking for must be in the i'th element...
SubType = STy->getElementType(i);
More information about the llvm-commits
mailing list