forked from OSchip/llvm-project
Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode). Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll Failed with signal(SIGBUS) at line 1 while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null 0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85 1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706 2 libSystem.B.dylib 0x92f112bb _sigtramp + 43 3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831 4 bugpoint 0x00021d1c main + 92 5 bugpoint 0x00002106 start + 54 6 bugpoint 0x00000004 start + 18446744073709543220 Stack dump: 0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll Failed with signal(SIGBUS) at line 1 while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85 1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706 2 libSystem.B.dylib 0x92f112bb _sigtramp + 43 3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831 4 bugpoint 0x00021d1c main + 92 5 bugpoint 0x00002106 start + 54 6 bugpoint 0x00000006 start + 18446744073709543222 Stack dump: 0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll Failed with signal(SIGBUS) at line 1 while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 0 bugpoint 0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85 1 bugpoint 0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706 2 libSystem.B.dylib 0x92f112bb _sigtramp + 43 3 libSystem.B.dylib 0xffffffff _sigtramp + 1829694831 4 bugpoint 0x00021d1c main + 92 5 bugpoint 0x00002106 start + 54 Stack dump: 0. Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes --- Reverse-merging (from foreign repository) r66920 into '.': U include/llvm/Support/CallSite.h U include/llvm/Instructions.h U lib/Analysis/IPA/GlobalsModRef.cpp U lib/Analysis/IPA/Andersens.cpp U lib/Bitcode/Writer/BitcodeWriter.cpp U lib/VMCore/Instructions.cpp U lib/VMCore/Verifier.cpp U lib/VMCore/AsmWriter.cpp U lib/Transforms/Utils/LowerInvoke.cpp U lib/Transforms/Scalar/SimplifyCFGPass.cpp U lib/Transforms/IPO/PruneEH.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp llvm-svn: 66953
This commit is contained in:
parent
4b7f3d7344
commit
4bb96e9a50
|
@ -2526,26 +2526,27 @@ public:
|
||||||
/// indirect function invocation.
|
/// indirect function invocation.
|
||||||
///
|
///
|
||||||
Function *getCalledFunction() const {
|
Function *getCalledFunction() const {
|
||||||
return dyn_cast<Function>(Op<-3>());
|
return dyn_cast<Function>(getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getCalledValue - Get a pointer to the function that is invoked by this
|
/// getCalledValue - Get a pointer to the function that is invoked by this
|
||||||
/// instruction
|
/// instruction
|
||||||
const Value *getCalledValue() const { return Op<-3>(); }
|
const Value *getCalledValue() const { return getOperand(0); }
|
||||||
Value *getCalledValue() { return Op<-3>(); }
|
Value *getCalledValue() { return getOperand(0); }
|
||||||
|
|
||||||
// get*Dest - Return the destination basic blocks...
|
// get*Dest - Return the destination basic blocks...
|
||||||
BasicBlock *getNormalDest() const {
|
BasicBlock *getNormalDest() const {
|
||||||
return cast<BasicBlock>(Op<-2>());
|
return cast<BasicBlock>(getOperand(1));
|
||||||
}
|
}
|
||||||
BasicBlock *getUnwindDest() const {
|
BasicBlock *getUnwindDest() const {
|
||||||
return cast<BasicBlock>(Op<-1>());
|
return cast<BasicBlock>(getOperand(2));
|
||||||
}
|
}
|
||||||
void setNormalDest(BasicBlock *B) {
|
void setNormalDest(BasicBlock *B) {
|
||||||
Op<-2>() = B;
|
setOperand(1, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUnwindDest(BasicBlock *B) {
|
void setUnwindDest(BasicBlock *B) {
|
||||||
Op<-1>() = B;
|
setOperand(2, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicBlock *getSuccessor(unsigned i) const {
|
BasicBlock *getSuccessor(unsigned i) const {
|
||||||
|
@ -2555,7 +2556,7 @@ public:
|
||||||
|
|
||||||
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||||
assert(idx < 2 && "Successor # out of range for invoke!");
|
assert(idx < 2 && "Successor # out of range for invoke!");
|
||||||
*(&Op<-2>() + idx) = NewSucc;
|
setOperand(idx+1, NewSucc);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getNumSuccessors() const { return 2; }
|
unsigned getNumSuccessors() const { return 2; }
|
||||||
|
@ -2568,7 +2569,6 @@ public:
|
||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual BasicBlock *getSuccessorV(unsigned idx) const;
|
virtual BasicBlock *getSuccessorV(unsigned idx) const;
|
||||||
virtual unsigned getNumSuccessorsV() const;
|
virtual unsigned getNumSuccessorsV() const;
|
||||||
|
|
|
@ -119,7 +119,7 @@ public:
|
||||||
///
|
///
|
||||||
Value *getCalledValue() const {
|
Value *getCalledValue() const {
|
||||||
assert(getInstruction() && "Not a call or invoke instruction!");
|
assert(getInstruction() && "Not a call or invoke instruction!");
|
||||||
return *getCallee();
|
return getInstruction()->getOperand(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getCalledFunction - Return the function being called if this is a direct
|
/// getCalledFunction - Return the function being called if this is a direct
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
///
|
///
|
||||||
void setCalledFunction(Value *V) {
|
void setCalledFunction(Value *V) {
|
||||||
assert(getInstruction() && "Not a call or invoke instruction!");
|
assert(getInstruction() && "Not a call or invoke instruction!");
|
||||||
*getCallee() = V;
|
getInstruction()->setOperand(0, V);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *getArgument(unsigned ArgNo) const {
|
Value *getArgument(unsigned ArgNo) const {
|
||||||
|
@ -147,16 +147,6 @@ public:
|
||||||
getInstruction()->setOperand(getArgumentOffset() + ArgNo, newVal);
|
getInstruction()->setOperand(getArgumentOffset() + ArgNo, newVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a value use iterator, returns the argument that corresponds to it.
|
|
||||||
/// Iterator must actually correspond to an argument.
|
|
||||||
unsigned getArgumentNo(Value::use_iterator I) const {
|
|
||||||
assert(getInstruction() && "Not a call or invoke instruction!");
|
|
||||||
assert(arg_begin() <= &I.getUse() && &I.getUse() < arg_end()
|
|
||||||
&& "Argument # out of range!");
|
|
||||||
|
|
||||||
return &I.getUse() - arg_begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Given an operand number, returns the argument that corresponds to it.
|
/// Given an operand number, returns the argument that corresponds to it.
|
||||||
/// OperandNo must be a valid operand number that actually corresponds to an
|
/// OperandNo must be a valid operand number that actually corresponds to an
|
||||||
/// argument.
|
/// argument.
|
||||||
|
@ -182,7 +172,7 @@ public:
|
||||||
return getInstruction()->op_begin() + getArgumentOffset();
|
return getInstruction()->op_begin() + getArgumentOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_iterator arg_end() const { return getInstruction()->op_end() - getArgumentEndOffset(); }
|
arg_iterator arg_end() const { return getInstruction()->op_end(); }
|
||||||
bool arg_empty() const { return arg_end() == arg_begin(); }
|
bool arg_empty() const { return arg_end() == arg_begin(); }
|
||||||
unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
|
unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
|
||||||
|
|
||||||
|
@ -191,25 +181,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCallee(Value::use_iterator UI) const {
|
bool isCallee(Value::use_iterator UI) const {
|
||||||
return getCallee() == &UI.getUse();
|
return getInstruction()->op_begin() == &UI.getUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Returns the operand number of the first argument
|
/// Returns the operand number of the first argument
|
||||||
unsigned getArgumentOffset() const {
|
unsigned getArgumentOffset() const {
|
||||||
if (isCall())
|
if (isCall())
|
||||||
return 1; // Skip Function
|
return 1; // Skip Function
|
||||||
else
|
else
|
||||||
return 0; // Args are at the front
|
return 3; // Skip Function, BB, BB
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getArgumentEndOffset() const {
|
|
||||||
if (isCall())
|
|
||||||
return 0; // Unchanged
|
|
||||||
else
|
|
||||||
return 3; // Skip BB, BB, Function
|
|
||||||
}
|
|
||||||
|
|
||||||
User::op_iterator getCallee() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ bool Andersens::AnalyzeUsesOfFunction(Value *V) {
|
||||||
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
|
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
|
||||||
// Make sure that this is just the function being called, not that it is
|
// Make sure that this is just the function being called, not that it is
|
||||||
// passing into the function.
|
// passing into the function.
|
||||||
for (unsigned i = 0, e = II->getNumOperands() - 3; i != e; ++i)
|
for (unsigned i = 3, e = II->getNumOperands(); i != e; ++i)
|
||||||
if (II->getOperand(i) == V) return true;
|
if (II->getOperand(i) == V) return true;
|
||||||
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
|
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
|
||||||
if (CE->getOpcode() == Instruction::GetElementPtr ||
|
if (CE->getOpcode() == Instruction::GetElementPtr ||
|
||||||
|
|
|
@ -244,7 +244,7 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V,
|
||||||
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
|
} else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
|
||||||
// Make sure that this is just the function being called, not that it is
|
// Make sure that this is just the function being called, not that it is
|
||||||
// passing into the function.
|
// passing into the function.
|
||||||
for (unsigned i = 0, e = II->getNumOperands() - 3; i != e; ++i)
|
for (unsigned i = 3, e = II->getNumOperands(); i != e; ++i)
|
||||||
if (II->getOperand(i) == V) return true;
|
if (II->getOperand(i) == V) return true;
|
||||||
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
|
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
|
||||||
if (CE->getOpcode() == Instruction::GetElementPtr ||
|
if (CE->getOpcode() == Instruction::GetElementPtr ||
|
||||||
|
|
|
@ -853,11 +853,11 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
|
||||||
|
|
||||||
// Emit value #'s for the fixed parameters.
|
// Emit value #'s for the fixed parameters.
|
||||||
for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
|
for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
|
||||||
Vals.push_back(VE.getValueID(I.getOperand(i))); // fixed param.
|
Vals.push_back(VE.getValueID(I.getOperand(i+3))); // fixed param.
|
||||||
|
|
||||||
// Emit type/value pairs for varargs params.
|
// Emit type/value pairs for varargs params.
|
||||||
if (FTy->isVarArg()) {
|
if (FTy->isVarArg()) {
|
||||||
for (unsigned i = FTy->getNumParams(), e = I.getNumOperands()-3;
|
for (unsigned i = 3+FTy->getNumParams(), e = I.getNumOperands();
|
||||||
i != e; ++i)
|
i != e; ++i)
|
||||||
PushValueAndType(I.getOperand(i), InstID, Vals, VE); // vararg
|
PushValueAndType(I.getOperand(i), InstID, Vals, VE); // vararg
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,14 +356,14 @@ DAE::Liveness DAE::SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses,
|
||||||
// argument, since if it was the function argument this would be an
|
// argument, since if it was the function argument this would be an
|
||||||
// indirect call and the we know can't be looking at a value of the
|
// indirect call and the we know can't be looking at a value of the
|
||||||
// label type (for the invoke instruction).
|
// label type (for the invoke instruction).
|
||||||
unsigned ArgNo = CS.getArgumentNo(U);
|
unsigned ArgNo = CS.getArgumentNo(U.getOperandNo());
|
||||||
|
|
||||||
if (ArgNo >= F->getFunctionType()->getNumParams())
|
if (ArgNo >= F->getFunctionType()->getNumParams())
|
||||||
// The value is passed in through a vararg! Must be live.
|
// The value is passed in through a vararg! Must be live.
|
||||||
return Live;
|
return Live;
|
||||||
|
|
||||||
assert(CS.getArgument(ArgNo)
|
assert(CS.getArgument(ArgNo)
|
||||||
== CS.getInstruction()->getOperand(U.getOperandNo())
|
== CS.getInstruction()->getOperand(U.getOperandNo())
|
||||||
&& "Argument is not where we expected it");
|
&& "Argument is not where we expected it");
|
||||||
|
|
||||||
// Value passed to a normal call. It's only live when the corresponding
|
// Value passed to a normal call. It's only live when the corresponding
|
||||||
|
|
|
@ -170,7 +170,7 @@ bool PruneEH::SimplifyFunction(Function *F) {
|
||||||
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
|
||||||
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
|
||||||
if (II->doesNotThrow()) {
|
if (II->doesNotThrow()) {
|
||||||
SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3);
|
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
|
||||||
// Insert a call instruction before the invoke.
|
// Insert a call instruction before the invoke.
|
||||||
CallInst *Call = CallInst::Create(II->getCalledValue(),
|
CallInst *Call = CallInst::Create(II->getCalledValue(),
|
||||||
Args.begin(), Args.end(), "", II);
|
Args.begin(), Args.end(), "", II);
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void ChangeToUnreachable(Instruction *I) {
|
||||||
/// ChangeToCall - Convert the specified invoke into a normal call.
|
/// ChangeToCall - Convert the specified invoke into a normal call.
|
||||||
static void ChangeToCall(InvokeInst *II) {
|
static void ChangeToCall(InvokeInst *II) {
|
||||||
BasicBlock *BB = II->getParent();
|
BasicBlock *BB = II->getParent();
|
||||||
SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3);
|
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
|
||||||
CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args.begin(),
|
CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args.begin(),
|
||||||
Args.end(), "", II);
|
Args.end(), "", II);
|
||||||
NewCall->takeName(II);
|
NewCall->takeName(II);
|
||||||
|
|
|
@ -221,7 +221,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||||
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
|
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
|
||||||
std::vector<Value*> CallArgs(II->op_begin(), II->op_end() - 3);
|
std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end());
|
||||||
// Insert a normal call instruction...
|
// Insert a normal call instruction...
|
||||||
CallInst *NewCall = CallInst::Create(II->getCalledValue(),
|
CallInst *NewCall = CallInst::Create(II->getCalledValue(),
|
||||||
CallArgs.begin(), CallArgs.end(), "",II);
|
CallArgs.begin(), CallArgs.end(), "",II);
|
||||||
|
@ -290,7 +290,7 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
|
||||||
CatchSwitch->addCase(InvokeNoC, II->getUnwindDest());
|
CatchSwitch->addCase(InvokeNoC, II->getUnwindDest());
|
||||||
|
|
||||||
// Insert a normal call instruction.
|
// Insert a normal call instruction.
|
||||||
std::vector<Value*> CallArgs(II->op_begin(), II->op_end() - 3);
|
std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end());
|
||||||
CallInst *NewCall = CallInst::Create(II->getCalledValue(),
|
CallInst *NewCall = CallInst::Create(II->getCalledValue(),
|
||||||
CallArgs.begin(), CallArgs.end(), "",
|
CallArgs.begin(), CallArgs.end(), "",
|
||||||
II);
|
II);
|
||||||
|
|
|
@ -1625,7 +1625,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||||
if (PAL.getFnAttributes() != Attribute::None)
|
if (PAL.getFnAttributes() != Attribute::None)
|
||||||
Out << ' ' << Attribute::getAsString(PAL.getFnAttributes());
|
Out << ' ' << Attribute::getAsString(PAL.getFnAttributes());
|
||||||
} else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
|
} else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I)) {
|
||||||
Operand = II->getCalledValue();
|
|
||||||
const PointerType *PTy = cast<PointerType>(Operand->getType());
|
const PointerType *PTy = cast<PointerType>(Operand->getType());
|
||||||
const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
|
const FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
|
||||||
const Type *RetTy = FTy->getReturnType();
|
const Type *RetTy = FTy->getReturnType();
|
||||||
|
@ -1659,10 +1658,10 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||||
writeOperand(Operand, true);
|
writeOperand(Operand, true);
|
||||||
}
|
}
|
||||||
Out << '(';
|
Out << '(';
|
||||||
for (unsigned op = 0, Eop = I.getNumOperands() - 3; op < Eop; ++op) {
|
for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) {
|
||||||
if (op)
|
if (op > 3)
|
||||||
Out << ", ";
|
Out << ", ";
|
||||||
writeParamOperand(I.getOperand(op), PAL.getParamAttributes(op + 1));
|
writeParamOperand(I.getOperand(op), PAL.getParamAttributes(op-2));
|
||||||
}
|
}
|
||||||
|
|
||||||
Out << ')';
|
Out << ')';
|
||||||
|
|
|
@ -93,13 +93,6 @@ bool CallSite::hasArgument(const Value *Arg) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
User::op_iterator CallSite::getCallee() const {
|
|
||||||
Instruction *II(getInstruction());
|
|
||||||
return isCall()
|
|
||||||
? cast<CallInst>(II)->op_begin()
|
|
||||||
: cast<InvokeInst>(II)->op_end() - 3; // Skip BB, BB, Function
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef CALLSITE_DELEGATE_GETTER
|
#undef CALLSITE_DELEGATE_GETTER
|
||||||
#undef CALLSITE_DELEGATE_SETTER
|
#undef CALLSITE_DELEGATE_SETTER
|
||||||
|
|
||||||
|
@ -438,9 +431,10 @@ bool CallInst::paramHasAttr(unsigned i, Attributes attr) const {
|
||||||
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
Value* const *Args, unsigned NumArgs) {
|
Value* const *Args, unsigned NumArgs) {
|
||||||
assert(NumOperands == 3+NumArgs && "NumOperands not set up?");
|
assert(NumOperands == 3+NumArgs && "NumOperands not set up?");
|
||||||
Op<-3>() = Fn;
|
Use *OL = OperandList;
|
||||||
Op<-2>() = IfNormal;
|
OL[0] = Fn;
|
||||||
Op<-1>() = IfException;
|
OL[1] = IfNormal;
|
||||||
|
OL[2] = IfException;
|
||||||
const FunctionType *FTy =
|
const FunctionType *FTy =
|
||||||
cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
|
cast<FunctionType>(cast<PointerType>(Fn->getType())->getElementType());
|
||||||
FTy = FTy; // silence warning.
|
FTy = FTy; // silence warning.
|
||||||
|
@ -449,13 +443,12 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
(FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
|
(FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
|
||||||
"Calling a function with bad signature");
|
"Calling a function with bad signature");
|
||||||
|
|
||||||
Use *OL = OperandList;
|
|
||||||
for (unsigned i = 0, e = NumArgs; i != e; i++) {
|
for (unsigned i = 0, e = NumArgs; i != e; i++) {
|
||||||
assert((i >= FTy->getNumParams() ||
|
assert((i >= FTy->getNumParams() ||
|
||||||
FTy->getParamType(i) == Args[i]->getType()) &&
|
FTy->getParamType(i) == Args[i]->getType()) &&
|
||||||
"Invoking a function with a bad signature!");
|
"Invoking a function with a bad signature!");
|
||||||
|
|
||||||
OL[i] = Args[i];
|
OL[i+3] = Args[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1318,7 +1318,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||||
"Instruction does not dominate all uses!", Op, &I);
|
"Instruction does not dominate all uses!", Op, &I);
|
||||||
}
|
}
|
||||||
} else if (isa<InlineAsm>(I.getOperand(i))) {
|
} else if (isa<InlineAsm>(I.getOperand(i))) {
|
||||||
Assert1((i == 0 && isa<CallInst>(I)) || (i + 3 == e && isa<InvokeInst>(I)),
|
Assert1(i == 0 && (isa<CallInst>(I) || isa<InvokeInst>(I)),
|
||||||
"Cannot take the address of an inline asm!", &I);
|
"Cannot take the address of an inline asm!", &I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue