summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Reg2Mem.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-10-13 19:26:58 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-10-13 19:26:58 +0000
commitbe4d8cba1ccf6f0611db50e8c7ba366ce3a3137d (patch)
tree4f4f4b1bd5dddda9e75f4258b2e80104f17cd2b8 /llvm/lib/Transforms/Scalar/Reg2Mem.cpp
parentea244fcb84c807a7d213754657e452d30acfcab8 (diff)
downloadbcm5719-llvm-be4d8cba1ccf6f0611db50e8c7ba366ce3a3137d.tar.gz
bcm5719-llvm-be4d8cba1ccf6f0611db50e8c7ba366ce3a3137d.zip
Scalar: Remove remaining ilist iterator implicit conversions
Remove remaining `ilist_iterator` implicit conversions from LLVMScalarOpts. This change exposed some scary behaviour in lib/Transforms/Scalar/SCCP.cpp around line 1770. This patch changes a call from `Function::begin()` to `&Function::front()`, since the return was immediately being passed into another function that takes a `Function*`. `Function::front()` started to assert, since the function was empty. Note that `Function::end()` does not point at a legal `Function*` -- it points at an `ilist_half_node` -- so the other function was getting garbage before. (I added the missing check for `Function::isDeclaration()`.) Otherwise, no functionality change intended. llvm-svn: 250211
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reg2Mem.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/Reg2Mem.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reg2Mem.cpp b/llvm/lib/Transforms/Scalar/Reg2Mem.cpp
index 1b46727c17b..915f89780c0 100644
--- a/llvm/lib/Transforms/Scalar/Reg2Mem.cpp
+++ b/llvm/lib/Transforms/Scalar/Reg2Mem.cpp
@@ -82,10 +82,9 @@ bool RegToMem::runOnFunction(Function &F) {
BasicBlock::iterator I = BBEntry->begin();
while (isa<AllocaInst>(I)) ++I;
- CastInst *AllocaInsertionPoint =
- new BitCastInst(Constant::getNullValue(Type::getInt32Ty(F.getContext())),
- Type::getInt32Ty(F.getContext()),
- "reg2mem alloca point", I);
+ CastInst *AllocaInsertionPoint = new BitCastInst(
+ Constant::getNullValue(Type::getInt32Ty(F.getContext())),
+ Type::getInt32Ty(F.getContext()), "reg2mem alloca point", &*I);
// Find the escaped instructions. But don't create stack slots for
// allocas in entry block.
@@ -95,7 +94,7 @@ bool RegToMem::runOnFunction(Function &F) {
for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end();
iib != iie; ++iib) {
if (!(isa<AllocaInst>(iib) && iib->getParent() == BBEntry) &&
- valueEscapes(iib)) {
+ valueEscapes(&*iib)) {
WorkList.push_front(&*iib);
}
}
OpenPOWER on IntegriCloud