llvm.org GIT mirror llvm / 8c653ae
Revert "Use llvm::lower_bound. NFC" This reverts commit rL358161. This patch have broken the test: llvm/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358199 91177308-0d34-0410-b5e6-96231b3b80d8 Ali Tamur 1 year, 7 months ago
9 changed file(s) with 45 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
461461 DWARFDie getDIEForOffset(uint32_t Offset) {
462462 extractDIEsIfNeeded(false);
463463 assert(!DieArray.empty());
464 auto it = llvm::lower_bound(
465 DieArray, Offset, [](const DWARFDebugInfoEntry &LHS, uint32_t Offset) {
464 auto it = std::lower_bound(
465 DieArray.begin(), DieArray.end(), Offset,
466 [](const DWARFDebugInfoEntry &LHS, uint32_t Offset) {
466467 return LHS.getOffset() < Offset;
467468 });
468469 if (it != DieArray.end() && it->getOffset() == Offset)
14961496 if (funcName.empty())
14971497 return false;
14981498
1499 std::vector::const_iterator I =
1500 llvm::lower_bound(VectorDescs, funcName, compareWithScalarFnName);
1499 std::vector::const_iterator I = std::lower_bound(
1500 VectorDescs.begin(), VectorDescs.end(), funcName,
1501 compareWithScalarFnName);
15011502 return I != VectorDescs.end() && StringRef(I->ScalarFnName) == funcName;
15021503 }
15031504
15061507 F = sanitizeFunctionName(F);
15071508 if (F.empty())
15081509 return F;
1509 std::vector::const_iterator I =
1510 llvm::lower_bound(VectorDescs, F, compareWithScalarFnName);
1510 std::vector::const_iterator I = std::lower_bound(
1511 VectorDescs.begin(), VectorDescs.end(), F, compareWithScalarFnName);
15111512 while (I != VectorDescs.end() && StringRef(I->ScalarFnName) == F) {
15121513 if (I->VectorizationFactor == VF)
15131514 return I->VectorFnName;
15221523 if (F.empty())
15231524 return F;
15241525
1525 std::vector::const_iterator I =
1526 llvm::lower_bound(ScalarDescs, F, compareWithVectorFnName);
1526 std::vector::const_iterator I = std::lower_bound(
1527 ScalarDescs.begin(), ScalarDescs.end(), F, compareWithVectorFnName);
15271528 if (I == VectorDescs.end() || StringRef(I->VectorFnName) != F)
15281529 return StringRef();
15291530 VF = I->VectorizationFactor;
179179 NewOp = RealVal;
180180 } else {
181181 // Otherwise, look up the placeholder in ResolveConstants.
182 ResolveConstantsTy::iterator It = llvm::lower_bound(
183 ResolveConstants,
182 ResolveConstantsTy::iterator It = std::lower_bound(
183 ResolveConstants.begin(), ResolveConstants.end(),
184184 std::pair(cast(*I), 0));
185185 assert(It != ResolveConstants.end() && It->first == *I);
186186 NewOp = operator[](It->second);
534534 uint64_t Offset = getOffsetFromIndices(U, *DL);
535535 ArrayRef SrcRegs = getOrCreateVRegs(*Src);
536536 ArrayRef Offsets = *VMap.getOffsets(*Src);
537 unsigned Idx = llvm::lower_bound(Offsets, Offset) - Offsets.begin();
537 unsigned Idx = std::lower_bound(Offsets.begin(), Offsets.end(), Offset) -
538 Offsets.begin();
538539 auto &DstRegs = allocateVRegs(U);
539540
540541 for (unsigned i = 0; i < DstRegs.size(); ++i)
22612261 ArrayRef RMS = LIS->getRegMaskSlotsInBlock(BI.MBB->getNumber());
22622262 LLVM_DEBUG(dbgs() << RMS.size() << " regmasks in block:");
22632263 // Constrain to VirtReg's live range.
2264 unsigned ri =
2265 llvm::lower_bound(RMS, Uses.front().getRegSlot()) - RMS.begin();
2264 unsigned ri = std::lower_bound(RMS.begin(), RMS.end(),
2265 Uses.front().getRegSlot()) - RMS.begin();
22662266 unsigned re = RMS.size();
22672267 for (unsigned i = 0; i != NumGaps && ri != re; ++i) {
22682268 // Look for Uses[i] <= RMS <= Uses[i+1].
5656
5757 DWARFDebugLoc::LocationList const *
5858 DWARFDebugLoc::getLocationListAtOffset(uint64_t Offset) const {
59 auto It = llvm::lower_bound(
60 Locations, Offset,
59 auto It = std::lower_bound(
60 Locations.begin(), Locations.end(), Offset,
6161 [](const LocationList &L, uint64_t Offset) { return L.Offset < Offset; });
6262 if (It != Locations.end() && It->Offset == Offset)
6363 return &(*It);
212212
213213 DWARFDebugLoclists::LocationList const *
214214 DWARFDebugLoclists::getLocationListAtOffset(uint64_t Offset) const {
215 auto It = llvm::lower_bound(
216 Locations, Offset,
215 auto It = std::lower_bound(
216 Locations.begin(), Locations.end(), Offset,
217217 [](const LocationList &L, uint64_t Offset) { return L.Offset < Offset; });
218218 if (It != Locations.end() && It->Offset == Offset)
219219 return &(*It);
6161 // Find the first range whose High field is >= R.High,
6262 // then check if the Low field is <= R.Low. If so, we
6363 // have a Range that covers R.
64 auto I = llvm::lower_bound(
65 Ranges, R, [](IntRange A, IntRange B) { return A.High < B.High; });
64 auto I = std::lower_bound(
65 Ranges.begin(), Ranges.end(), R,
66 [](const IntRange &A, const IntRange &B) { return A.High < B.High; });
6667 return I != Ranges.end() && I->Low <= R.Low;
6768 }
6869
486486 unsigned LoadIdx = LBI.getInstructionIndex(LI);
487487
488488 // Find the nearest store that has a lower index than this load.
489 StoresByIndexTy::iterator I = llvm::lower_bound(
490 StoresByIndex,
491 std::make_pair(LoadIdx, static_cast(nullptr)),
492 less_first());
489 StoresByIndexTy::iterator I =
490 std::lower_bound(StoresByIndex.begin(), StoresByIndex.end(),
491 std::make_pair(LoadIdx,
492 static_cast(nullptr)),
493 less_first());
493494 if (I == StoresByIndex.begin()) {
494495 if (StoresByIndex.empty())
495496 // If there are no stores, the load takes the undef value.
756757 // them from the Preds list.
757758 for (unsigned i = 0, e = SomePHI->getNumIncomingValues(); i != e; ++i) {
758759 // Do a log(n) search of the Preds list for the entry we want.
759 SmallVectorImpl::iterator EntIt = llvm::lower_bound(
760 Preds, SomePHI->getIncomingBlock(i), CompareBBNumbers);
760 SmallVectorImpl::iterator EntIt = std::lower_bound(
761 Preds.begin(), Preds.end(), SomePHI->getIncomingBlock(i),
762 CompareBBNumbers);
761763 assert(EntIt != Preds.end() && *EntIt == SomePHI->getIncomingBlock(i) &&
762764 "PHI node has entry for a block which is not a predecessor!");
763765
2020 static constexpr const char kIntegerPrefix[] = "i_0x";
2121 static constexpr const char kDoublePrefix[] = "f_";
2222 static constexpr const char kInvalidOperand[] = "INVALID";
23 static constexpr llvm::StringLiteral kNoRegister("%noreg");
2324
2425 namespace llvm {
2526
4647 llvm::StringMap
4748 generateRegNameToRegNoMapping(const llvm::MCRegisterInfo &RegInfo) {
4849 llvm::StringMap Map(RegInfo.getNumRegs());
49 for (unsigned I = 0, E = RegInfo.getNumRegs(); I < E; ++I)
50 // Special-case RegNo 0, which would otherwise be spelled as ''.
51 Map[kNoRegister] = 0;
52 for (unsigned I = 1, E = RegInfo.getNumRegs(); I < E; ++I)
5053 Map[RegInfo.getName(I)] = I;
5154 assert(Map.size() == RegInfo.getNumRegs() && "Size prediction failed");
5255 return Map;
8285 llvm::raw_string_ostream &getErrorStream() { return ErrorStream; }
8386
8487 llvm::StringRef getRegName(unsigned RegNo) {
88 // Special case: RegNo 0 is NoRegister. We have to deal with it explicitly.
89 if (RegNo == 0)
90 return kNoRegister;
8591 const llvm::StringRef RegName = State->getRegInfo().getName(RegNo);
8692 if (RegName.empty())
8793 ErrorStream << "No register with enum value '" << RegNo << "'\n";
8894 return RegName;
8995 }
9096
91 unsigned getRegNo(llvm::StringRef RegName) {
97 llvm::Optional getRegNo(llvm::StringRef RegName) {
9298 auto Iter = RegNameToRegNo.find(RegName);
9399 if (Iter != RegNameToRegNo.end())
94100 return Iter->second;
95101 ErrorStream << "No register with name '" << RegName << "'\n";
96 return 0;
102 return llvm::None;
97103 }
98104
99105 private:
141147 return llvm::MCOperand::createImm(IntValue);
142148 if (tryDeserializeFPOperand(String, DoubleValue))
143149 return llvm::MCOperand::createFPImm(DoubleValue);
144 if (unsigned RegNo = getRegNo(String))
145 return llvm::MCOperand::createReg(RegNo);
150 if (auto RegNo = getRegNo(String))
151 return llvm::MCOperand::createReg(*RegNo);
146152 if (String != kInvalidOperand)
147153 ErrorStream << "Unknown Operand: '" << String << "'\n";
148154 return {};
257263 String.split(Pieces, "=0x", /* MaxSplit */ -1,
258264 /* KeepEmpty */ false);
259265 YamlContext &Context = getTypedContext(Ctx);
260 if (Pieces.size() == 2) {
261 RV.Register = Context.getRegNo(Pieces[0]);
266 llvm::Optional RegNo;
267 if (Pieces.size() == 2 && (RegNo = Context.getRegNo(Pieces[0]))) {
268 RV.Register = *RegNo;
262269 const unsigned BitsNeeded = llvm::APInt::getBitsNeeded(Pieces[1], kRadix);
263270 RV.Value = llvm::APInt(BitsNeeded, Pieces[1], kRadix);
264271 } else {