aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp2
-rw-r--r--lib/Transforms/Scalar/LICM.cpp5
-rw-r--r--lib/Transforms/Scalar/Reg2Mem.cpp4
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp11
-rw-r--r--lib/Transforms/Scalar/TailDuplication.cpp2
6 files changed, 14 insertions, 20 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index fd87e30..2b7ca6b 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7891,9 +7891,9 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
AllocationInst *New;
if (isa<MallocInst>(AI))
- New = new MallocInst(*Context, CastElTy, Amt, AI.getAlignment());
+ New = new MallocInst(CastElTy, Amt, AI.getAlignment());
else
- New = new AllocaInst(*Context, CastElTy, Amt, AI.getAlignment());
+ New = new AllocaInst(CastElTy, Amt, AI.getAlignment());
InsertNewInstBefore(New, AI);
New->takeName(&AI);
@@ -11368,12 +11368,10 @@ Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
// Create and insert the replacement instruction...
if (isa<MallocInst>(AI))
- New = new MallocInst(*Context, NewTy, 0,
- AI.getAlignment(), AI.getName());
+ New = new MallocInst(NewTy, 0, AI.getAlignment(), AI.getName());
else {
assert(isa<AllocaInst>(AI) && "Unknown type of allocation inst!");
- New = new AllocaInst(*Context, NewTy, 0,
- AI.getAlignment(), AI.getName());
+ New = new AllocaInst(NewTy, 0, AI.getAlignment(), AI.getName());
}
InsertNewInstBefore(New, AI);
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index 86e03c4..f3536c1 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -912,7 +912,7 @@ bool JumpThreading::ThreadEdge(BasicBlock *BB, BasicBlock *PredBB,
// We found a use of I outside of BB. Create a new stack slot to
// break this inter-block usage pattern.
- DemoteRegToStack(*Context, *I);
+ DemoteRegToStack(*I);
}
// We are going to have to map operands from the original BB block to the new
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index aa49b24..52dd06a 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -508,7 +508,7 @@ void LICM::sink(Instruction &I) {
AllocaInst *AI = 0;
if (I.getType() != Type::VoidTy) {
- AI = new AllocaInst(*Context, I.getType(), 0, I.getName(),
+ AI = new AllocaInst(I.getType(), 0, I.getName(),
I.getParent()->getParent()->getEntryBlock().begin());
CurAST->add(AI);
}
@@ -853,8 +853,7 @@ void LICM::FindPromotableValuesInLoop(
continue;
const Type *Ty = cast<PointerType>(V->getType())->getElementType();
- AllocaInst *AI = new AllocaInst(*Context, Ty, 0,
- V->getName()+".tmp", FnStart);
+ AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart);
PromotedValues.push_back(std::make_pair(AI, V));
// Update the AST and alias analysis.
diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp
index 289f08c..ac95d25 100644
--- a/lib/Transforms/Scalar/Reg2Mem.cpp
+++ b/lib/Transforms/Scalar/Reg2Mem.cpp
@@ -89,7 +89,7 @@ namespace {
NumRegsDemoted += worklist.size();
for (std::list<Instruction*>::iterator ilb = worklist.begin(),
ile = worklist.end(); ilb != ile; ++ilb)
- DemoteRegToStack(*Context, **ilb, false, AllocaInsertionPoint);
+ DemoteRegToStack(**ilb, false, AllocaInsertionPoint);
worklist.clear();
@@ -105,7 +105,7 @@ namespace {
NumPhisDemoted += worklist.size();
for (std::list<Instruction*>::iterator ilb = worklist.begin(),
ile = worklist.end(); ilb != ile; ++ilb)
- DemotePHIToStack(*Context, cast<PHINode>(*ilb), AllocaInsertionPoint);
+ DemotePHIToStack(cast<PHINode>(*ilb), AllocaInsertionPoint);
return true;
}
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index d999f9d..7df4eb6 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -302,16 +302,14 @@ bool SROA::performScalarRepl(Function &F) {
DOUT << "CONVERT TO VECTOR: " << *AI << " TYPE = " << *VectorTy <<"\n";
// Create and insert the vector alloca.
- NewAI = new AllocaInst(*Context, VectorTy, 0, "",
- AI->getParent()->begin());
+ NewAI = new AllocaInst(VectorTy, 0, "", AI->getParent()->begin());
ConvertUsesToScalar(AI, NewAI, 0);
} else {
DOUT << "CONVERT TO SCALAR INTEGER: " << *AI << "\n";
// Create and insert the integer alloca.
const Type *NewTy = Context->getIntegerType(AllocaSize*8);
- NewAI = new AllocaInst(*Context, NewTy, 0, "",
- AI->getParent()->begin());
+ NewAI = new AllocaInst(NewTy, 0, "", AI->getParent()->begin());
ConvertUsesToScalar(AI, NewAI, 0);
}
NewAI->takeName(AI);
@@ -336,8 +334,7 @@ void SROA::DoScalarReplacement(AllocationInst *AI,
if (const StructType *ST = dyn_cast<StructType>(AI->getAllocatedType())) {
ElementAllocas.reserve(ST->getNumContainedTypes());
for (unsigned i = 0, e = ST->getNumContainedTypes(); i != e; ++i) {
- AllocaInst *NA = new AllocaInst(*Context,
- ST->getContainedType(i), 0,
+ AllocaInst *NA = new AllocaInst(ST->getContainedType(i), 0,
AI->getAlignment(),
AI->getName() + "." + utostr(i), AI);
ElementAllocas.push_back(NA);
@@ -348,7 +345,7 @@ void SROA::DoScalarReplacement(AllocationInst *AI,
ElementAllocas.reserve(AT->getNumElements());
const Type *ElTy = AT->getElementType();
for (unsigned i = 0, e = AT->getNumElements(); i != e; ++i) {
- AllocaInst *NA = new AllocaInst(*Context, ElTy, 0, AI->getAlignment(),
+ AllocaInst *NA = new AllocaInst(ElTy, 0, AI->getAlignment(),
AI->getName() + "." + utostr(i), AI);
ElementAllocas.push_back(NA);
WorkList.push_back(NA); // Add to worklist for recursive processing
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp
index 5f72210..684b0963 100644
--- a/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/lib/Transforms/Scalar/TailDuplication.cpp
@@ -285,7 +285,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
if (I->isUsedOutsideOfBlock(DestBlock)) {
// We found a use outside of the tail. Create a new stack slot to
// break this inter-block usage pattern.
- DemoteRegToStack(*Context, *I);
+ DemoteRegToStack(*I);
}
// We are going to have to map operands from the original block B to the new