r252358 - CodeGen: Remove implicit ilist iterator conversions, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 15:00:41 PST 2015
Author: dexonsmith
Date: Fri Nov 6 17:00:41 2015
New Revision: 252358
URL: http://llvm.org/viewvc/llvm-project?rev=252358&view=rev
Log:
CodeGen: Remove implicit ilist iterator conversions, NFC
Make ilist iterator conversions explicit in clangCodeGen. Eventually
I'll remove them everywhere.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGCleanup.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Nov 6 17:00:41 2015
@@ -1264,10 +1264,9 @@ CodeGenFunction::GenerateBlockFunction(G
continue;
}
- DI->EmitDeclareOfBlockDeclRefVariable(variable, BlockPointerDbgLoc,
- Builder, blockInfo,
- entry_ptr == entry->end()
- ? nullptr : entry_ptr);
+ DI->EmitDeclareOfBlockDeclRefVariable(
+ variable, BlockPointerDbgLoc, Builder, blockInfo,
+ entry_ptr == entry->end() ? nullptr : &*entry_ptr);
}
}
// Recover location if it was changed in the above loop.
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Nov 6 17:00:41 2015
@@ -2350,7 +2350,7 @@ void CodeGenFunction::EmitFunctionEpilog
if (RetAI.getInAllocaSRet()) {
llvm::Function::arg_iterator EI = CurFn->arg_end();
--EI;
- llvm::Value *ArgStruct = EI;
+ llvm::Value *ArgStruct = &*EI;
llvm::Value *SRet = Builder.CreateStructGEP(
nullptr, ArgStruct, RetAI.getInAllocaFieldIndex());
RV = Builder.CreateAlignedLoad(SRet, getPointerAlign(), "sret");
@@ -2365,7 +2365,7 @@ void CodeGenFunction::EmitFunctionEpilog
case TEK_Complex: {
ComplexPairTy RT =
EmitLoadOfComplex(MakeAddrLValue(ReturnValue, RetTy), EndLoc);
- EmitStoreOfComplex(RT, MakeNaturalAlignAddrLValue(AI, RetTy),
+ EmitStoreOfComplex(RT, MakeNaturalAlignAddrLValue(&*AI, RetTy),
/*isInit*/ true);
break;
}
@@ -2374,7 +2374,7 @@ void CodeGenFunction::EmitFunctionEpilog
break;
case TEK_Scalar:
EmitStoreOfScalar(Builder.CreateLoad(ReturnValue),
- MakeNaturalAlignAddrLValue(AI, RetTy),
+ MakeNaturalAlignAddrLValue(&*AI, RetTy),
/*isInit*/ true);
break;
}
Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Fri Nov 6 17:00:41 2015
@@ -945,8 +945,8 @@ void CodeGenFunction::PopCleanupBlock(bo
if (CleanupEndBB) {
EHStack.popPadEnd();
if (CleanupEndBB->hasNUsesOrMore(1)) {
- CurFn->getBasicBlockList().insertAfter(Builder.GetInsertBlock(),
- CleanupEndBB);
+ CurFn->getBasicBlockList().insertAfter(
+ Builder.GetInsertBlock()->getIterator(), CleanupEndBB);
} else {
delete CleanupEndBB;
}
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Fri Nov 6 17:00:41 2015
@@ -1577,7 +1577,7 @@ void CodeGenFunction::EmitCapturedLocals
// second parameter.
auto AI = CurFn->arg_begin();
++AI;
- ParentFP = AI;
+ ParentFP = &*AI;
}
// Create llvm.localrecover calls for all captures.
@@ -1732,8 +1732,7 @@ void CodeGenFunction::EmitSEHExceptionCo
// __exception_info intrinsic.
if (CGM.getTarget().getTriple().getArch() != llvm::Triple::x86) {
// On Win64, the info is passed as the first parameter to the filter.
- auto AI = CurFn->arg_begin();
- SEHInfo = AI;
+ SEHInfo = &*CurFn->arg_begin();
SEHCodeSlotStack.push_back(
CreateMemTemp(getContext().IntTy, "__exception_code"));
} else {
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Nov 6 17:00:41 2015
@@ -86,7 +86,7 @@ void CodeGenFunction::InitTempAlloca(Add
auto *Store = new llvm::StoreInst(Init, Var.getPointer());
Store->setAlignment(Var.getAlignment().getQuantity());
llvm::BasicBlock *Block = AllocaInsertPt->getParent();
- Block->getInstList().insertAfter(&*AllocaInsertPt, Store);
+ Block->getInstList().insertAfter(AllocaInsertPt->getIterator(), Store);
}
Address CodeGenFunction::CreateIRTemp(QualType Ty, const Twine &Name) {
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Nov 6 17:00:41 2015
@@ -2375,9 +2375,9 @@ Value *ScalarExprEmitter::EmitOverflowCh
// Branch in case of overflow.
llvm::BasicBlock *initialBB = Builder.GetInsertBlock();
- llvm::Function::iterator insertPt = initialBB;
+ llvm::Function::iterator insertPt = initialBB->getIterator();
llvm::BasicBlock *continueBB = CGF.createBasicBlock("nooverflow", CGF.CurFn,
- std::next(insertPt));
+ &*std::next(insertPt));
llvm::BasicBlock *overflowBB = CGF.createBasicBlock("overflow", CGF.CurFn);
Builder.CreateCondBr(overflow, overflowBB, continueBB);
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Nov 6 17:00:41 2015
@@ -347,7 +347,7 @@ void CodeGenFunction::SimplifyForwarding
return;
// Can only simplify empty blocks.
- if (BI != BB->begin())
+ if (BI->getIterator() != BB->begin())
return;
BB->replaceAllUsesWith(BI->getSuccessor(0));
@@ -369,7 +369,7 @@ void CodeGenFunction::EmitBlock(llvm::Ba
// Place the block after the current block, if possible, or else at
// the end of the function.
if (CurBB && CurBB->getParent())
- CurFn->getBasicBlockList().insertAfter(CurBB, BB);
+ CurFn->getBasicBlockList().insertAfter(CurBB->getIterator(), BB);
else
CurFn->getBasicBlockList().push_back(BB);
Builder.SetInsertPoint(BB);
@@ -396,7 +396,8 @@ void CodeGenFunction::EmitBlockAfterUses
bool inserted = false;
for (llvm::User *u : block->users()) {
if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(u)) {
- CurFn->getBasicBlockList().insertAfter(insn->getParent(), block);
+ CurFn->getBasicBlockList().insertAfter(insn->getParent()->getIterator(),
+ block);
inserted = true;
break;
}
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Fri Nov 6 17:00:41 2015
@@ -175,14 +175,16 @@ CodeGenFunction::GenerateVarArgsThunk(ll
// Find the first store of "this", which will be to the alloca associated
// with "this".
Address ThisPtr(&*AI, CGM.getClassPointerAlignment(MD->getParent()));
- llvm::BasicBlock *EntryBB = Fn->begin();
- llvm::Instruction *ThisStore =
+ llvm::BasicBlock *EntryBB = &Fn->front();
+ llvm::BasicBlock::iterator ThisStore =
std::find_if(EntryBB->begin(), EntryBB->end(), [&](llvm::Instruction &I) {
- return isa<llvm::StoreInst>(I) && I.getOperand(0) == ThisPtr.getPointer();
- });
- assert(ThisStore && "Store of this should be in entry block?");
+ return isa<llvm::StoreInst>(I) &&
+ I.getOperand(0) == ThisPtr.getPointer();
+ });
+ assert(ThisStore != EntryBB->end() &&
+ "Store of this should be in entry block?");
// Adjust "this", if necessary.
- Builder.SetInsertPoint(ThisStore);
+ Builder.SetInsertPoint(&*ThisStore);
llvm::Value *AdjustedThisPtr =
CGM.getCXXABI().performThisAdjustment(*this, ThisPtr, Thunk.This);
ThisStore->setOperand(0, AdjustedThisPtr);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Nov 6 17:00:41 2015
@@ -763,14 +763,14 @@ void CodeGenFunction::StartFunction(Glob
auto AI = CurFn->arg_begin();
if (CurFnInfo->getReturnInfo().isSRetAfterThis())
++AI;
- ReturnValue = Address(AI, CurFnInfo->getReturnInfo().getIndirectAlign());
+ ReturnValue = Address(&*AI, CurFnInfo->getReturnInfo().getIndirectAlign());
} else if (CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::InAlloca &&
!hasScalarEvaluationKind(CurFnInfo->getReturnType())) {
// Load the sret pointer from the argument struct and return into that.
unsigned Idx = CurFnInfo->getReturnInfo().getInAllocaFieldIndex();
llvm::Function::arg_iterator EI = CurFn->arg_end();
--EI;
- llvm::Value *Addr = Builder.CreateStructGEP(nullptr, EI, Idx);
+ llvm::Value *Addr = Builder.CreateStructGEP(nullptr, &*EI, Idx);
Addr = Builder.CreateAlignedLoad(Addr, getPointerAlign(), "agg.result");
ReturnValue = Address(Addr, getNaturalTypeAlignment(RetTy));
} else {
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov 6 17:00:41 2015
@@ -235,7 +235,8 @@ void CodeGenModule::applyReplacements()
OldF->replaceAllUsesWith(Replacement);
if (NewF) {
NewF->removeFromParent();
- OldF->getParent()->getFunctionList().insertAfter(OldF, NewF);
+ OldF->getParent()->getFunctionList().insertAfter(OldF->getIterator(),
+ NewF);
}
OldF->eraseFromParent();
}
Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=252358&r1=252357&r2=252358&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri Nov 6 17:00:41 2015
@@ -779,7 +779,7 @@ CodeGenPGO::applyFunctionAttributes(llvm
void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S) {
if (!CGM.getCodeGenOpts().ProfileInstrGenerate || !RegionCounterMap)
return;
- if (!Builder.GetInsertPoint())
+ if (!Builder.GetInsertBlock())
return;
unsigned Counter = (*RegionCounterMap)[S];
More information about the cfe-commits
mailing list