summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/Chapter6
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-03-30 11:19:20 +0000
committerJay Foad <jay.foad@gmail.com>2011-03-30 11:19:20 +0000
commite0938d8a87a6c8b12f68fbe784a270dd2d552331 (patch)
tree98d4fbcf8ebe8ec03e205e22d98469b177234a95 /llvm/examples/Kaleidoscope/Chapter6
parent27e20c3c586da61e5fe9218aa9fe5733e34c18c2 (diff)
downloadbcm5719-llvm-e0938d8a87a6c8b12f68fbe784a270dd2d552331.tar.gz
bcm5719-llvm-e0938d8a87a6c8b12f68fbe784a270dd2d552331.zip
(Almost) always call reserveOperandSpace() on newly created PHINodes.
llvm-svn: 128535
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter6')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/toy.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
index 838125ae77d..5316b80be54 100644
--- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -656,6 +656,7 @@ Value *IfExprAST::Codegen() {
Builder.SetInsertPoint(MergeBB);
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
"iftmp");
+ PN->reserveOperandSpace(2);
PN->addIncoming(ThenV, ThenBB);
PN->addIncoming(ElseV, ElseBB);
@@ -697,6 +698,7 @@ Value *ForExprAST::Codegen() {
// Start the PHI node with an entry for Start.
PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
+ Variable->reserveOperandSpace(2);
Variable->addIncoming(StartVal, PreheaderBB);
// Within the loop, the variable is defined equal to the PHI node. If it
OpenPOWER on IntegriCloud