[llvm-commits] [dragonegg] r86838 - in /dragonegg/trunk: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Wed Nov 11 05:43:11 PST 2009
Author: baldrick
Date: Wed Nov 11 07:43:10 2009
New Revision: 86838
URL: http://llvm.org/viewvc/llvm-project?rev=86838&view=rev
Log:
It seems that the intent is that llvm.invariant.start should not
require a corresponding call to llvm.invariant.end. The fact that
this doesn't work is an LLVM bug... So stop trying to output calls
to llvm.invariant.end all over the place.
Modified:
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-internal.h
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=86838&r1=86837&r2=86838&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Wed Nov 11 07:43:10 2009
@@ -763,26 +763,6 @@
typedef SmallVector<std::pair<BasicBlock*, tree>, 8> TreeVector;
typedef SmallVector<std::pair<BasicBlock*, Value*>, 8> ValueVector;
-/// EndInvariantRegions - Output a call to llvm.invariant.end for each call
-/// to llvm.invariant.start recorded in InvariantRegions.
-void TreeToLLVM::EndInvariantRegions() {
- if (InvariantRegions.empty())
- return;
-
- Value *Ops[3];
- Value *IEnd = Intrinsic::getDeclaration(TheModule,Intrinsic::invariant_end);
- for (unsigned i = 0, e = InvariantRegions.size(); i < e; ++i) {
- CallInst *CI = InvariantRegions[i];
- Ops[0] = CI;
- Ops[1] = CI->getOperand(1);
- Ops[2] = CI->getOperand(2);
- Builder.CreateCall(IEnd, Ops, Ops + 3);
- }
-
- // Do not clear out InvariantRegions in case the function has multiple exits:
- // we need to output calls to llvm.invariant.end before each one.
-}
-
/// PopulatePhiNodes - Populate generated phi nodes with their operands.
void TreeToLLVM::PopulatePhiNodes() {
PredVector Predecessors;
@@ -949,9 +929,6 @@
TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
TheDebugInfo->EmitFunctionEnd(Builder.GetInsertBlock(), true);
}
-
- EndInvariantRegions();
-
if (RetVals.empty())
Builder.CreateRetVoid();
else if (RetVals.size() == 1 && RetVals[0]->getType() == Fn->getReturnType()){
@@ -2128,7 +2105,6 @@
if (UnwindBB) {
CreateExceptionValues();
EmitBlock(UnwindBB);
- EndInvariantRegions();
abort();//FIXME
//FIXME // Fetch and store exception handler.
//FIXME Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr");
@@ -2567,7 +2543,6 @@
// after the function to prevent LLVM from thinking that control flow will
// fall into the subsequent block.
if (gimple_call_flags(stmt) & ECF_NORETURN) {
- EndInvariantRegions();
Builder.CreateUnreachable();
EmitBlock(BasicBlock::Create(Context));
}
@@ -4638,7 +4613,6 @@
case BUILT_IN_TRAP:
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::trap));
// Emit an explicit unreachable instruction.
- EndInvariantRegions();
Builder.CreateUnreachable();
EmitBlock(BasicBlock::Create(Context));
return true;
@@ -5485,7 +5459,6 @@
Args.push_back(Handler);
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID),
Args.begin(), Args.end());
- EndInvariantRegions();
Result = Builder.CreateUnreachable();
EmitBlock(BasicBlock::Create(Context));
@@ -5699,26 +5672,6 @@
// is called.
static const Type *VPTy = Type::getInt8PtrTy(Context);
- // In order to simplify the use of llvm.invariant.start/end, generate the
- // trampoline initialization code in the entry block.
- BasicBlock *EntryBlock = Fn->begin();
-
- // Note the current builder position.
- BasicBlock *SavedInsertBB = Builder.GetInsertBlock();
- BasicBlock::iterator SavedInsertPoint = Builder.GetInsertPoint();
-
- // Pop the entry block terminator. There may not be a terminator if the entry
- // block was not yet finished.
- Instruction *Terminator = EntryBlock->getTerminator();
- assert(((SavedInsertBB != EntryBlock && Terminator) ||
- (SavedInsertPoint == EntryBlock->end() && !Terminator)) &&
- "Insertion point doesn't make sense!");
- if (Terminator)
- Terminator->removeFromParent();
-
- // Point the builder at the end of the entry block.
- Builder.SetInsertPoint(EntryBlock);
-
// Create a stack temporary to hold the trampoline machine code.
const Type *TrampType = ArrayType::get(Type::getInt8Ty(Context),
TRAMPOLINE_SIZE);
@@ -5755,16 +5708,7 @@
Intr = Intrinsic::getDeclaration(TheModule, Intrinsic::invariant_start);
Ops[0] = ConstantInt::get(Type::getInt64Ty(Context), TRAMPOLINE_SIZE);
Ops[1] = Builder.CreateBitCast(Tramp, VPTy);
- CallInst *InvStart = Builder.CreateCall(Intr, Ops, Ops + 2);
- InvariantRegions.push_back(InvStart);
-
- // Restore the entry block terminator.
- if (Terminator)
- EntryBlock->getInstList().push_back(Terminator);
-
- // Restore the builder insertion point.
- if (SavedInsertBB != EntryBlock)
- Builder.SetInsertPoint(SavedInsertBB, SavedInsertPoint);
+ Builder.CreateCall(Intr, Ops, Ops + 2);
return true;
}
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=86838&r1=86837&r2=86838&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Wed Nov 11 07:43:10 2009
@@ -357,10 +357,6 @@
/// LocalDecls - Map from local declarations to their associated LLVM values.
DenseMap<tree, AssertingVH<> > LocalDecls;
- /// InvariantRegions - Calls to llvm.invariant.start for which a corresponding
- /// call to llvm.invariant.end needs to be generated at function exit points.
- SmallVector<CallInst*, 8> InvariantRegions;
-
/// PendingPhis - Phi nodes which have not yet been populated with operands.
SmallVector<PhiRecord, 16> PendingPhis;
@@ -473,15 +469,11 @@
/// StartFunctionBody - Start the emission of 'fndecl', outputing all
/// declarations for parameters and setting things up.
void StartFunctionBody();
-
+
/// FinishFunctionBody - Once the body of the function has been emitted, this
/// cleans up and returns the result function.
Function *FinishFunctionBody();
- /// EndInvariantRegions - Output a call to llvm.invariant.end for each call
- /// of llvm.invariant.start recorded in InvariantRegions.
- void EndInvariantRegions();
-
/// PopulatePhiNodes - Populate generated phi nodes with their operands.
void PopulatePhiNodes();
More information about the llvm-commits
mailing list