1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[IR] Use range-based for loops (NFC)

This commit is contained in:
Kazu Hirata 2021-03-01 23:40:32 -08:00
parent e503e87089
commit 99066de18c
4 changed files with 10 additions and 14 deletions

View File

@ -4373,9 +4373,8 @@ void AssemblyWriter::writeMDNode(unsigned Slot, const MDNode *Node) {
void AssemblyWriter::writeAllMDNodes() { void AssemblyWriter::writeAllMDNodes() {
SmallVector<const MDNode *, 16> Nodes; SmallVector<const MDNode *, 16> Nodes;
Nodes.resize(Machine.mdn_size()); Nodes.resize(Machine.mdn_size());
for (SlotTracker::mdn_iterator I = Machine.mdn_begin(), E = Machine.mdn_end(); for (auto &I : llvm::make_range(Machine.mdn_begin(), Machine.mdn_end()))
I != E; ++I) Nodes[I.second] = cast<MDNode>(I.first);
Nodes[I->second] = cast<MDNode>(I->first);
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) { for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
writeMDNode(i, Nodes[i]); writeMDNode(i, Nodes[i]);

View File

@ -3280,9 +3280,8 @@ unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch) {
void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) { void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers) {
CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch); CatchSwitchInst *CSI = unwrap<CatchSwitchInst>(CatchSwitch);
for (CatchSwitchInst::handler_iterator I = CSI->handler_begin(), for (const BasicBlock *H : CSI->handlers())
E = CSI->handler_end(); I != E; ++I) *Handlers++ = wrap(H);
*Handlers++ = wrap(*I);
} }
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad) { LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad) {

View File

@ -292,10 +292,9 @@ void ModuleSummaryIndex::propagateAttributes(
if (!IsDSOLocal) if (!IsDSOLocal)
// Mark the flag in all summaries false so that we can do quick check // Mark the flag in all summaries false so that we can do quick check
// without going through the whole list. // without going through the whole list.
llvm::for_each(P.second.SummaryList, for (const std::unique_ptr<GlobalValueSummary> &Summary :
[](const std::unique_ptr<GlobalValueSummary> &Summary) { P.second.SummaryList)
return Summary->setDSOLocal(false); Summary->setDSOLocal(false);
});
} }
setWithAttributePropagation(); setWithAttributePropagation();
setWithDSOLocalPropagation(); setWithDSOLocalPropagation();

View File

@ -3671,10 +3671,9 @@ void Verifier::visitStoreInst(StoreInst &SI) {
/// Check that SwiftErrorVal is used as a swifterror argument in CS. /// Check that SwiftErrorVal is used as a swifterror argument in CS.
void Verifier::verifySwiftErrorCall(CallBase &Call, void Verifier::verifySwiftErrorCall(CallBase &Call,
const Value *SwiftErrorVal) { const Value *SwiftErrorVal) {
unsigned Idx = 0; for (const auto &I : llvm::enumerate(Call.args())) {
for (auto I = Call.arg_begin(), E = Call.arg_end(); I != E; ++I, ++Idx) { if (I.value() == SwiftErrorVal) {
if (*I == SwiftErrorVal) { Assert(Call.paramHasAttr(I.index(), Attribute::SwiftError),
Assert(Call.paramHasAttr(Idx, Attribute::SwiftError),
"swifterror value when used in a callsite should be marked " "swifterror value when used in a callsite should be marked "
"with swifterror attribute", "with swifterror attribute",
SwiftErrorVal, Call); SwiftErrorVal, Call);