[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.213 -> 1.214 --- Log message: Use DominatorTree instead of ETForest. --- Diffs of the changes: (+16 -16) Verifier.cpp | 32 1 files changed, 16 insertions(+), 16 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.213 llvm/lib/VMCore/Verifier.cpp:1.214 --- llvm/lib/VMCore/Verifier.cpp:1.213 Thu Jun 7 01:12:03 2007 +++ llvm/lib/VMCore/Verifier.cppMon Jun 11 10:40:48 2007 @@ -76,7 +76,7 @@ VerifierFailureAction action; // What to do if verification fails. Module *Mod; // Module we are verifying right now -ETForest *EF; // ET-Forest, caution can be null! +DominatorTree *DT; // Dominator Tree, caution can be null! std::stringstream msgs; // A stringstream to collect messages /// InstInThisBlock - when verifying a basic block, keep track of all of the @@ -88,20 +88,20 @@ Verifier() : FunctionPass((intptr_t)&ID), Broken(false), RealPass(true), action(AbortProcessAction), - EF(0), msgs( std::ios::app | std::ios::out ) {} + DT(0), msgs( std::ios::app | std::ios::out ) {} Verifier( VerifierFailureAction ctn ) : FunctionPass((intptr_t)&ID), - Broken(false), RealPass(true), action(ctn), EF(0), + Broken(false), RealPass(true), action(ctn), DT(0), msgs( std::ios::app | std::ios::out ) {} Verifier(bool AB ) : FunctionPass((intptr_t)&ID), Broken(false), RealPass(true), - action( AB ? AbortProcessAction : PrintMessageAction), EF(0), + action( AB ? AbortProcessAction : PrintMessageAction), DT(0), msgs( std::ios::app | std::ios::out ) {} -Verifier(ETForest &ef) +Verifier(DominatorTree &dt) : FunctionPass((intptr_t)&ID), Broken(false), RealPass(false), action(PrintMessageAction), - EF(&ef), msgs( std::ios::app | std::ios::out ) {} + DT(&dt), msgs( std::ios::app | std::ios::out ) {} bool doInitialization(Module &M) { @@ -118,7 +118,7 @@ bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager - if (RealPass) EF = &getAnalysis(); + if (RealPass) DT = &getAnalysis(); Mod = F.getParent(); @@ -158,7 +158,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); if (RealPass) -AU.addRequired(); +AU.addRequired(); } /// abortIfBroken - If the module is broken and we are supposed to abort on @@ -879,7 +879,7 @@ for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE; ++UI) Assert1(*UI != (User*)&I || - !EF->dominates(&BB->getParent()->getEntryBlock(), BB), + !DT->dominates(&BB->getParent()->getEntryBlock(), BB), "Only PHI nodes may reference their own value!", &I); } @@ -948,7 +948,7 @@ // dominates all of it's predecessors (other than the invoke) or if // the invoke value is only used by a phi in the successor. if (!OpBlock->getSinglePredecessor() && - EF->dominates(&BB->getParent()->getEntryBlock(), BB)) { + DT->dominates(&BB->getParent()->getEntryBlock(), BB)) { // The first case we allow is if the use is a PHI operand in the // normal block, and if that PHI operand corresponds to the invoke's // block. @@ -965,7 +965,7 @@ Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { -if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { +if (*PI != II->getParent() && !DT->dominates(OpBlock, *PI)) { Bad = true; break; } @@ -979,20 +979,20 @@ // If they are in the same basic block, make sure that the definition // comes before the use. Assert2(InstsInThisBlock.count(Op) || - !EF->dominates(&BB->getParent()->getEntryBlock(), BB), + !DT->dominates(&BB->getParent()->getEntryBlock(), BB), "Instruction does not dominate all uses!", Op, &I); } // Definition must dominate use unless use is unreachable! -Assert2(EF->dominates(OpBlock, BB) || -!EF->dominates(&BB->getParent()->getEntryBlock(), BB), +Assert2(DT->dominates(OpBlock, BB) || +!DT->dominates(&BB->getParent()->getEntryBlock(), BB), "Instruction does not dominate all uses!", Op, &I); } else { // PHI nodes are more difficult than other nodes because they actually // "use" the value in the predecessor basic blocks they correspond to. BasicBlock *PredBB = cast(I.getOperand(i+1)); -Assert2(EF->dominates(OpBlock, Pre
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.212 -> 1.213 --- Log message: Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the correct type of parameters. --- Diffs of the changes: (+15 -0) Verifier.cpp | 15 +++ 1 files changed, 15 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.212 llvm/lib/VMCore/Verifier.cpp:1.213 --- llvm/lib/VMCore/Verifier.cpp:1.212 Wed May 2 20:11:54 2007 +++ llvm/lib/VMCore/Verifier.cppThu Jun 7 01:12:03 2007 @@ -46,6 +46,7 @@ #include "llvm/Pass.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" +#include "llvm/ParameterAttributes.h" #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" @@ -358,6 +359,20 @@ FT->getNumParams() > 0 && isa(FT->getParamType(0))), "Invalid struct-return function!", &F); + if (const ParamAttrsList *Attrs = FT->getParamAttrs()) { +unsigned Idx = 1; +for (FunctionType::param_iterator I = FT->param_begin(), + E = FT->param_end(); I != E; ++I, ++Idx) { + if (Attrs->paramHasAttr(Idx, ParamAttr::ZExt) || + Attrs->paramHasAttr(Idx, ParamAttr::SExt)) +Assert1(FT->getParamType(Idx-1)->isInteger(), +"Attribute ZExt should only apply to Integer type!", &F); + if (Attrs->paramHasAttr(Idx, ParamAttr::NoAlias)) +Assert1(isa(FT->getParamType(Idx-1)), +"Attribute NoAlias should only apply to Pointer type!", &F); +} + } + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On Apr 28, 2007, at 1:01 PM, Anton Korobeynikov wrote: >> I'd suggest: && isa(CE->getOperand(0)) > So, nobody will produce multiple bitcasts, right? > e.g. this is illegal: > @A = alias (bitcast (bitcast i64* @foo to i8*) to i32* Right, ConstantExpr::getBitCast will fold those. Try doing llvm-as | llvm-dis and the output should have them folded. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
> I'd suggest: && isa(CE->getOperand(0)) So, nobody will produce multiple bitcasts, right? e.g. this is illegal: @A = alias (bitcast (bitcast i64* @foo to i8*) to i32* -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On Apr 28, 2007, at 7:35 AM, Anton Korobeynikov wrote: > Index: llvm/lib/VMCore/Verifier.cpp > diff -u llvm/lib/VMCore/Verifier.cpp:1.207 llvm/lib/VMCore/ > Verifier.cpp:1.208 > --- llvm/lib/VMCore/Verifier.cpp:1.207Sat Apr 28 08:45:00 2007 > +++ llvm/lib/VMCore/Verifier.cpp Sat Apr 28 09:35:41 2007 > @@ -319,6 +319,13 @@ >Assert1(GA.getType() == GA.getAliasee()->getType(), >"Alias and aliasee types should match!", &GA); > > + if (!isa(GA.getAliasee())) { > +const ConstantExpr *CE = dyn_cast(GA.getAliasee()); > +Assert1(CE && CE->getOpcode() == Instruction::BitCast, I'd suggest: && isa(CE->getOperand(0)) -Chris > +"Aliasee should be either GlobalValue or bitcast of > GlobalValue", > +&GA); > + } > + >visitGlobalValue(GA); > } > > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.207 -> 1.208 --- Log message: Let Verifier check aliasees --- Diffs of the changes: (+7 -0) Verifier.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.207 llvm/lib/VMCore/Verifier.cpp:1.208 --- llvm/lib/VMCore/Verifier.cpp:1.207 Sat Apr 28 08:45:00 2007 +++ llvm/lib/VMCore/Verifier.cppSat Apr 28 09:35:41 2007 @@ -319,6 +319,13 @@ Assert1(GA.getType() == GA.getAliasee()->getType(), "Alias and aliasee types should match!", &GA); + if (!isa(GA.getAliasee())) { +const ConstantExpr *CE = dyn_cast(GA.getAliasee()); +Assert1(CE && CE->getOpcode() == Instruction::BitCast, +"Aliasee should be either GlobalValue or bitcast of GlobalValue", +&GA); + } + visitGlobalValue(GA); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.204 -> 1.205 --- Log message: Fix regressions introduced by my previous patch: opt calls verifier in a way that the "Mod" ivar was not getting set. --- Diffs of the changes: (+3 -1) Verifier.cpp |4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.204 llvm/lib/VMCore/Verifier.cpp:1.205 --- llvm/lib/VMCore/Verifier.cpp:1.204 Fri Apr 20 16:48:08 2007 +++ llvm/lib/VMCore/Verifier.cppFri Apr 20 18:59:29 2007 @@ -113,7 +113,9 @@ bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager if (RealPass) EF = &getAnalysis(); - + + Mod = F.getParent(); + visit(F); InstsInThisBlock.clear(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.203 -> 1.204 --- Log message: catch a case that was biting jeffc --- Diffs of the changes: (+7 -1) Verifier.cpp |8 +++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.203 llvm/lib/VMCore/Verifier.cpp:1.204 --- llvm/lib/VMCore/Verifier.cpp:1.203 Tue Apr 17 12:36:12 2007 +++ llvm/lib/VMCore/Verifier.cppFri Apr 20 16:48:08 2007 @@ -867,12 +867,17 @@ // taken. Assert1(!F->isIntrinsic() || (i == 0 && isa(I)), "Cannot take the address of an intrinsic!", &I); + Assert1(F->getParent() == Mod, "Referencing function in another module!", + &I); } else if (BasicBlock *OpBB = dyn_cast(I.getOperand(i))) { Assert1(OpBB->getParent() == BB->getParent(), "Referring to a basic block in another function!", &I); } else if (Argument *OpArg = dyn_cast(I.getOperand(i))) { Assert1(OpArg->getParent() == BB->getParent(), "Referring to an argument in another function!", &I); +} else if (GlobalValue *GV = dyn_cast(I.getOperand(i))) { + Assert1(GV->getParent() == Mod, "Referencing global in another module!", + &I); } else if (Instruction *Op = dyn_cast(I.getOperand(i))) { BasicBlock *OpBlock = Op->getParent(); @@ -952,7 +957,8 @@ /// void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Function *IF = CI.getCalledFunction(); - Assert1(IF->isDeclaration(), "Intrinsic functions should never be defined!", IF); + Assert1(IF->isDeclaration(), "Intrinsic functions should never be defined!", + IF); #define GET_INTRINSIC_VERIFIER #include "llvm/Intrinsics.gen" ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.202 -> 1.203 --- Log message: eliminate a use of Instruction::getPrev(), patch by Gabor Greif in 2005. --- Diffs of the changes: (+2 -1) Verifier.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.202 llvm/lib/VMCore/Verifier.cpp:1.203 --- llvm/lib/VMCore/Verifier.cpp:1.202 Wed Apr 11 21:48:46 2007 +++ llvm/lib/VMCore/Verifier.cppTue Apr 17 12:36:12 2007 @@ -640,7 +640,8 @@ // This can be tested by checking whether the instruction before this is // either nonexistent (because this is begin()) or is a PHI node. If not, // then there is some other instruction before a PHI. - Assert2(&PN.getParent()->front() == &PN || isa(PN.getPrev()), + Assert2(&PN == &PN.getParent()->front() || + isa(--BasicBlock::iterator(&PN)), "PHI nodes not grouped at top of basic block!", &PN, PN.getParent()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.201 -> 1.202 --- Log message: For PR1284: http://llvm.org/PR1284 : Implement the "part_set" intrinsic. --- Diffs of the changes: (+3 -2) Verifier.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.201 llvm/lib/VMCore/Verifier.cpp:1.202 --- llvm/lib/VMCore/Verifier.cpp:1.201 Mon Apr 9 22:18:19 2007 +++ llvm/lib/VMCore/Verifier.cppWed Apr 11 21:48:46 2007 @@ -1028,13 +1028,14 @@ if (GotBits < 16 || GotBits % 16 != 0) CheckFailed("Intrinsic requires even byte width argument", F); /* FALL THROUGH */ +case Intrinsic::part_set: case Intrinsic::part_select: if (ArgNo == 1) { unsigned ResultBits = cast(FTy->getReturnType())->getBitWidth(); if (GotBits != ResultBits) - CheckFailed("Intrinsic requires parameter and result bit " - "widths to match", F); + CheckFailed("Intrinsic requires the bit widths of the first " + "parameter and the result to match", F); } break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.200 -> 1.201 --- Log message: unbreak the build :( --- Diffs of the changes: (+1 -1) Verifier.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.200 llvm/lib/VMCore/Verifier.cpp:1.201 --- llvm/lib/VMCore/Verifier.cpp:1.200 Mon Apr 9 22:10:46 2007 +++ llvm/lib/VMCore/Verifier.cppMon Apr 9 22:18:19 2007 @@ -1028,7 +1028,7 @@ if (GotBits < 16 || GotBits % 16 != 0) CheckFailed("Intrinsic requires even byte width argument", F); /* FALL THROUGH */ -case Intrinsic::int_part_select: +case Intrinsic::part_select: if (ArgNo == 1) { unsigned ResultBits = cast(FTy->getReturnType())->getBitWidth(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.199 -> 1.200 --- Log message: Fix build problem. --- Diffs of the changes: (+1 -1) Verifier.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.199 llvm/lib/VMCore/Verifier.cpp:1.200 --- llvm/lib/VMCore/Verifier.cpp:1.199 Wed Apr 4 18:48:25 2007 +++ llvm/lib/VMCore/Verifier.cppMon Apr 9 22:10:46 2007 @@ -1028,7 +1028,7 @@ if (GotBits < 16 || GotBits % 16 != 0) CheckFailed("Intrinsic requires even byte width argument", F); /* FALL THROUGH */ -case Intrinsic::bit_part_select: +case Intrinsic::int_part_select: if (ArgNo == 1) { unsigned ResultBits = cast(FTy->getReturnType())->getBitWidth(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On Apr 4, 2007, at 5:57 PM, Reid Spencer wrote: > On Wed, 2007-04-04 at 17:38 -0700, Chris Lattner wrote: >>> Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. >> >> Should this check that the third type is smaller than the other two? > > No, because that commit comment is in error. I was thinking of the > prototype for part_set (which I deleted from the implementation just > before commit). The prototype is actually like this: > > declare i17 @llvm.bit.part_select.i17.i17 (i17 %val, i32 %loBit, i32 % > hiBit) > > which only has two variable parts: result, 1st arg. And those two must > be the same width which is what this patch does. The other parameters > are i32. Gotcha, ok. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On Wed, 2007-04-04 at 17:38 -0700, Chris Lattner wrote: > > Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. > > Should this check that the third type is smaller than the other two? No, because that commit comment is in error. I was thinking of the prototype for part_set (which I deleted from the implementation just before commit). The prototype is actually like this: declare i17 @llvm.bit.part_select.i17.i17 (i17 %val, i32 %loBit, i32 % hiBit) which only has two variable parts: result, 1st arg. And those two must be the same width which is what this patch does. The other parameters are i32. Reid. > > -Chris > > > > > --- > > Diffs of the changes: (+2 -0) > > > > Verifier.cpp |2 ++ > > 1 files changed, 2 insertions(+) > > > > > > Index: llvm/lib/VMCore/Verifier.cpp > > diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/ > > Verifier.cpp:1.199 > > --- llvm/lib/VMCore/Verifier.cpp:1.198 Sun Apr 1 02:22:57 2007 > > +++ llvm/lib/VMCore/Verifier.cppWed Apr 4 18:48:25 2007 > > @@ -1027,6 +1027,8 @@ > > case Intrinsic::bswap: > >if (GotBits < 16 || GotBits % 16 != 0) > > CheckFailed("Intrinsic requires even byte width > > argument", F); > > + /* FALL THROUGH */ > > +case Intrinsic::bit_part_select: > >if (ArgNo == 1) { > > unsigned ResultBits = > >cast(FTy->getReturnType())->getBitWidth(); > > > > > > > > ___ > > llvm-commits mailing list > > llvm-commits@cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits signature.asc Description: This is a digitally signed message part ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
> Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. Should this check that the third type is smaller than the other two? -Chris > > --- > Diffs of the changes: (+2 -0) > > Verifier.cpp |2 ++ > 1 files changed, 2 insertions(+) > > > Index: llvm/lib/VMCore/Verifier.cpp > diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/ > Verifier.cpp:1.199 > --- llvm/lib/VMCore/Verifier.cpp:1.198Sun Apr 1 02:22:57 2007 > +++ llvm/lib/VMCore/Verifier.cpp Wed Apr 4 18:48:25 2007 > @@ -1027,6 +1027,8 @@ > case Intrinsic::bswap: >if (GotBits < 16 || GotBits % 16 != 0) > CheckFailed("Intrinsic requires even byte width > argument", F); > + /* FALL THROUGH */ > +case Intrinsic::bit_part_select: >if (ArgNo == 1) { > unsigned ResultBits = >cast(FTy->getReturnType())->getBitWidth(); > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.198 -> 1.199 --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+2 -0) Verifier.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/Verifier.cpp:1.199 --- llvm/lib/VMCore/Verifier.cpp:1.198 Sun Apr 1 02:22:57 2007 +++ llvm/lib/VMCore/Verifier.cppWed Apr 4 18:48:25 2007 @@ -1027,6 +1027,8 @@ case Intrinsic::bswap: if (GotBits < 16 || GotBits % 16 != 0) CheckFailed("Intrinsic requires even byte width argument", F); + /* FALL THROUGH */ +case Intrinsic::bit_part_select: if (ArgNo == 1) { unsigned ResultBits = cast(FTy->getReturnType())->getBitWidth(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.197 -> 1.198 --- Log message: For PR1297: http://llvm.org/PR1297 : 1. Clear up confusion between "GotBits" and "ExpectBits". GotBits is the type actually provided. ExpectedBits is the type expected for the intrinsics. Before this patch, it was reversed! 2. Implement checks for overloaded intrinsics. This involves computing the suffix expected and making sure the suffix matches the function name. It also includes some intrinsic-specific checks such as ensuring that the bswap parameter and result are the same width and an even number of bytes. --- Diffs of the changes: (+42 -7) Verifier.cpp | 49 ++--- 1 files changed, 42 insertions(+), 7 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.197 llvm/lib/VMCore/Verifier.cpp:1.198 --- llvm/lib/VMCore/Verifier.cpp:1.197 Wed Feb 14 21:39:18 2007 +++ llvm/lib/VMCore/Verifier.cppSun Apr 1 02:22:57 2007 @@ -212,7 +212,7 @@ void visitUserOp2(Instruction &I) { visitUserOp1(I); } void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); -void VerifyIntrinsicPrototype(Function *F, ...); +void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, ...); void WriteValue(const Value *V) { if (!V) return; @@ -961,12 +961,17 @@ /// VerifyIntrinsicPrototype - TableGen emits calls to this function into /// Intrinsics.gen. This implements a little state machine that verifies the /// prototype of intrinsics. -void Verifier::VerifyIntrinsicPrototype(Function *F, ...) { +void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, ...) { va_list VA; va_start(VA, F); const FunctionType *FTy = F->getFunctionType(); + // For overloaded intrinsics, the Suffix of the function name must match the + // types of the arguments. This variable keeps track of the expected + // suffix, to be checked at the end. + std::string Suffix; + // Note that "arg#0" is the return type. for (unsigned ArgNo = 0; 1; ++ArgNo) { int TypeID = va_arg(VA, int); @@ -987,7 +992,7 @@ } const Type *Ty; -if (ArgNo == 0) +if (ArgNo == 0) Ty = FTy->getReturnType(); else Ty = FTy->getParamType(ArgNo-1); @@ -1001,10 +1006,12 @@ } if (TypeID == Type::IntegerTyID) { - unsigned GotBits = (unsigned) va_arg(VA, int); - unsigned ExpectBits = cast(Ty)->getBitWidth(); - if (GotBits != ExpectBits) { -std::string bitmsg = " Expecting " + utostr(ExpectBits) + " but got " + + unsigned ExpectedBits = (unsigned) va_arg(VA, int); + unsigned GotBits = cast(Ty)->getBitWidth(); + if (ExpectedBits == 0) { +Suffix += ".i" + utostr(GotBits); + } else if (GotBits != ExpectedBits) { +std::string bitmsg = " Expected " + utostr(ExpectedBits) + " but got "+ utostr(GotBits) + " bits."; if (ArgNo == 0) CheckFailed("Intrinsic prototype has incorrect integer result width!" @@ -1014,6 +1021,21 @@ "incorrect integer width!" + bitmsg, F); break; } + // Check some constraints on various intrinsics. + switch (ID) { +default: break; // Not everything needs to be checked. +case Intrinsic::bswap: + if (GotBits < 16 || GotBits % 16 != 0) +CheckFailed("Intrinsic requires even byte width argument", F); + if (ArgNo == 1) { +unsigned ResultBits = + cast(FTy->getReturnType())->getBitWidth(); +if (GotBits != ResultBits) + CheckFailed("Intrinsic requires parameter and result bit " + "widths to match", F); + } + break; + } } else if (TypeID == Type::VectorTyID) { // If this is a packed argument, verify the number and type of elements. const VectorType *PTy = cast(Ty); @@ -1042,6 +1064,19 @@ } va_end(VA); + + // If we computed a Suffix then the intrinsic is overloaded and we need to + // make sure that the name of the function is correct. We add the suffix to + // the name of the intrinsic and compare against the given function name. If + // they are not the same, the function name is invalid. This ensures that + // overloading of intrinsics uses a sane and consistent naming convention. + if (!Suffix.empty()) { +std::string Name(Intrinsic::getName(ID)); +if (Name + Suffix != F->getName()) + CheckFailed("Overloaded intrinsic has incorrect suffix: '" + + F->getName().substr(Name.length()) + "'. It should be '" + + Suffix + "'", F); + } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.193 -> 1.194 --- Log message: convert some vectors to smallvector. --- Diffs of the changes: (+3 -2) Verifier.cpp |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.193 llvm/lib/VMCore/Verifier.cpp:1.194 --- llvm/lib/VMCore/Verifier.cpp:1.193 Sat Feb 10 02:30:29 2007 +++ llvm/lib/VMCore/Verifier.cppSat Feb 10 02:33:11 2007 @@ -396,7 +396,8 @@ // Check constraints that this basic block imposes on all of the PHI nodes in // it. if (isa(BB.front())) { -std::vector Preds(pred_begin(&BB), pred_end(&BB)); +SmallVector Preds(pred_begin(&BB), pred_end(&BB)); +SmallVector, 8> Values; std::sort(Preds.begin(), Preds.end()); PHINode *PN; for (BasicBlock::iterator I = BB.begin(); (PN = dyn_cast(I));++I) { @@ -410,7 +411,7 @@ "parent basic block!", PN); // Get and sort all incoming values in the PHI node... - std::vector > Values; + Values.clear(); Values.reserve(PN->getNumIncomingValues()); for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) Values.push_back(std::make_pair(PN->getIncomingBlock(i), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.192 -> 1.193 --- Log message: speed up the verifier 8.5% by using a smallvector instead of vector. --- Diffs of the changes: (+5 -2) Verifier.cpp |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.192 llvm/lib/VMCore/Verifier.cpp:1.193 --- llvm/lib/VMCore/Verifier.cpp:1.192 Sat Feb 10 02:19:44 2007 +++ llvm/lib/VMCore/Verifier.cppSat Feb 10 02:30:29 2007 @@ -57,6 +57,7 @@ #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Streams.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" @@ -809,11 +810,13 @@ } void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) { + SmallVector Idxs(GEP.idx_begin(), GEP.idx_end()); const Type *ElTy = GetElementPtrInst::getIndexedType(GEP.getOperand(0)->getType(), - std::vector(GEP.idx_begin(), GEP.idx_end()), true); + &Idxs[0], Idxs.size(), true); Assert1(ElTy, "Invalid indices for GEP pointer type!", &GEP); - Assert2(PointerType::get(ElTy) == GEP.getType(), + Assert2(isa(GEP.getType()) && + cast(GEP.getType())->getElementType() == ElTy, "GEP is not of right type for indices!", &GEP, ElTy); visitInstruction(GEP); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.191 -> 1.192 --- Log message: Change an std::set to a SmallPtrSet. This speeds up the verifier on 447.dealII from 1.27s to 0.86s. --- Diffs of the changes: (+2 -1) Verifier.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.191 llvm/lib/VMCore/Verifier.cpp:1.192 --- llvm/lib/VMCore/Verifier.cpp:1.191 Tue Feb 6 12:02:54 2007 +++ llvm/lib/VMCore/Verifier.cppSat Feb 10 02:19:44 2007 @@ -56,6 +56,7 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Streams.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" @@ -80,7 +81,7 @@ /// instructions we have seen so far. This allows us to do efficient /// dominance checks for the case when an instruction has an operand that is /// an instruction in the same block. -std::set InstsInThisBlock; +SmallPtrSet InstsInThisBlock; Verifier() : Broken(false), RealPass(true), action(AbortProcessAction), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.190 -> 1.191 --- Log message: Support var arg intrinsics. --- Diffs of the changes: (+4 -0) Verifier.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.190 llvm/lib/VMCore/Verifier.cpp:1.191 --- llvm/lib/VMCore/Verifier.cpp:1.190 Mon Feb 5 14:47:20 2007 +++ llvm/lib/VMCore/Verifier.cppTue Feb 6 12:02:54 2007 @@ -987,6 +987,10 @@ for (unsigned ArgNo = 0; 1; ++ArgNo) { int TypeID = va_arg(VA, int); +if (TypeID == -2) { + break; +} + if (TypeID == -1) { if (ArgNo != FTy->getNumParams()+1) CheckFailed("Intrinsic prototype has too many arguments!", F); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.180 -> 1.181 --- Log message: Do not allow packed types for icmp and fcmp instructions. --- Diffs of the changes: (+2 -5) Verifier.cpp |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.180 llvm/lib/VMCore/Verifier.cpp:1.181 --- llvm/lib/VMCore/Verifier.cpp:1.180 Sat Dec 30 23:26:44 2006 +++ llvm/lib/VMCore/Verifier.cppWed Jan 3 23:22:18 2007 @@ -739,9 +739,7 @@ Assert1(Op0Ty == Op1Ty, "Both operands to ICmp instruction are not of the same type!", &IC); // Check that the operands are the right type - Assert1(Op0Ty->isIntegral() || Op0Ty->getTypeID() == Type::PointerTyID || - (isa(Op0Ty) && - cast(Op0Ty)->getElementType()->isIntegral()), + Assert1(Op0Ty->isIntegral() || Op0Ty->getTypeID() == Type::PointerTyID, "Invalid operand types for ICmp instruction", &IC); visitInstruction(IC); } @@ -753,8 +751,7 @@ Assert1(Op0Ty == Op1Ty, "Both operands to FCmp instruction are not of the same type!", &FC); // Check that the operands are the right type - Assert1(Op0Ty->isFloatingPoint() || (isa(Op0Ty) && - cast(Op0Ty)->getElementType()->isFloatingPoint()), + Assert1(Op0Ty->isFloatingPoint(), "Invalid operand types for FCmp instruction", &FC); visitInstruction(FC); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.177 -> 1.178 --- Log message: Fix Regression/Verifier/invoke-1.ll --- Diffs of the changes: (+7 -2) Verifier.cpp |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.177 llvm/lib/VMCore/Verifier.cpp:1.178 --- llvm/lib/VMCore/Verifier.cpp:1.177 Wed Dec 20 13:50:15 2006 +++ llvm/lib/VMCore/Verifier.cppWed Dec 20 15:20:13 2006 @@ -902,6 +902,10 @@ if (InvokeInst *II = dyn_cast(Op)) { OpBlock = II->getNormalDest(); + Assert2(OpBlock != II->getUnwindDest(), + "No uses of invoke possible due to dominance structure!", + Op, II); + // If the normal successor of an invoke instruction has multiple // predecessors, then the normal edge from the invoke is critical, so // the invoke value can only be live if the destination block @@ -931,8 +935,9 @@ } } } -Assert1(!Bad, -"Invoke value defined on critical edge but not dead!", &I); +Assert2(!Bad, +"Invoke value defined on critical edge but not dead!", &I, +Op); } } else if (OpBlock == BB) { // If they are in the same basic block, make sure that the definition ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.176 -> 1.177 --- Log message: Revert the previous patch which was incorrect. This unbreaks eon, but rebreaks invoke-1.ll --- Diffs of the changes: (+2 -1) Verifier.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.176 llvm/lib/VMCore/Verifier.cpp:1.177 --- llvm/lib/VMCore/Verifier.cpp:1.176 Mon Dec 18 17:40:19 2006 +++ llvm/lib/VMCore/Verifier.cppWed Dec 20 13:50:15 2006 @@ -921,7 +921,8 @@ // If it is used by something non-phi, then the other case is that // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. -if (!Bad) { +if (Bad) { + Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On 12/18/06, Reid Spencer <[EMAIL PROTECTED]> wrote: > On Mon, 2006-12-18 at 14:14 -0800, Bill Wendling wrote: > > On 12/18/06, Reid Spencer <[EMAIL PROTECTED]> wrote: > > > > > > -if (Bad) { > > > +if (!Bad) { > > >Bad = false; > > > > Isn't the above statement not needed then? > > Yup. I'll remove it. > Thanks :-) -bw ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.175 -> 1.176 --- Log message: Remove a useless statement. --- Diffs of the changes: (+0 -1) Verifier.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.175 llvm/lib/VMCore/Verifier.cpp:1.176 --- llvm/lib/VMCore/Verifier.cpp:1.175 Mon Dec 18 15:56:29 2006 +++ llvm/lib/VMCore/Verifier.cppMon Dec 18 17:40:19 2006 @@ -922,7 +922,6 @@ // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. if (!Bad) { - Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On Mon, 2006-12-18 at 14:14 -0800, Bill Wendling wrote: > On 12/18/06, Reid Spencer <[EMAIL PROTECTED]> wrote: > > > > -if (Bad) { > > +if (!Bad) { > >Bad = false; > > Isn't the above statement not needed then? Yup. I'll remove it. > > -bw > > >for (pred_iterator PI = pred_begin(OpBlock), > > E = pred_end(OpBlock); PI != E; ++PI) { > > ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
On 12/18/06, Reid Spencer <[EMAIL PROTECTED]> wrote: > > -if (Bad) { > +if (!Bad) { >Bad = false; Isn't the above statement not needed then? -bw >for (pred_iterator PI = pred_begin(OpBlock), > E = pred_end(OpBlock); PI != E; ++PI) { > ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.174 -> 1.175 --- Log message: For PR1042: http://llvm.org/PR1042 : Fix a thinko. We want to check the second case if the first cast *didn't* trigger. --- Diffs of the changes: (+1 -1) Verifier.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.174 llvm/lib/VMCore/Verifier.cpp:1.175 --- llvm/lib/VMCore/Verifier.cpp:1.174 Fri Dec 15 20:25:35 2006 +++ llvm/lib/VMCore/Verifier.cppMon Dec 18 15:56:29 2006 @@ -921,7 +921,7 @@ // If it is used by something non-phi, then the other case is that // 'OpBlock' dominates all of its predecessors other than the // invoke. In this case, the invoke value can still be used. -if (Bad) { +if (!Bad) { Bad = false; for (pred_iterator PI = pred_begin(OpBlock), E = pred_end(OpBlock); PI != E; ++PI) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.173 -> 1.174 --- Log message: Fix PR1042: http://llvm.org/PR1042 , by tightening up the subtle rules with invoke value use. --- Diffs of the changes: (+37 -3) Verifier.cpp | 40 +--- 1 files changed, 37 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.173 llvm/lib/VMCore/Verifier.cpp:1.174 --- llvm/lib/VMCore/Verifier.cpp:1.173 Tue Dec 12 22:45:46 2006 +++ llvm/lib/VMCore/Verifier.cppFri Dec 15 20:25:35 2006 @@ -355,7 +355,8 @@ // Check that the argument values match the function type for this function... unsigned i = 0; - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); + I != E; ++I, ++i) { Assert2(I->getType() == FT->getParamType(i), "Argument value does not match function argument type!", I, FT->getParamType(i)); @@ -898,9 +899,42 @@ if (!isa(I)) { // Invoke results are only usable in the normal destination, not in the // exceptional destination. -if (InvokeInst *II = dyn_cast(Op)) +if (InvokeInst *II = dyn_cast(Op)) { OpBlock = II->getNormalDest(); -else if (OpBlock == BB) { + + // If the normal successor of an invoke instruction has multiple + // predecessors, then the normal edge from the invoke is critical, so + // the invoke value can only be live if the destination block + // dominates all of it's predecessors (other than the invoke) or if + // the invoke value is only used by a phi in the successor. + if (!OpBlock->getSinglePredecessor() && + EF->dominates(&BB->getParent()->getEntryBlock(), BB)) { +// The first case we allow is if the use is a PHI operand in the +// normal block, and if that PHI operand corresponds to the invoke's +// block. +bool Bad = true; +if (PHINode *PN = dyn_cast(&I)) + if (PN->getParent() == OpBlock && + PN->getIncomingBlock(i/2) == Op->getParent()) +Bad = false; + +// If it is used by something non-phi, then the other case is that +// 'OpBlock' dominates all of its predecessors other than the +// invoke. In this case, the invoke value can still be used. +if (Bad) { + Bad = false; + for (pred_iterator PI = pred_begin(OpBlock), + E = pred_end(OpBlock); PI != E; ++PI) { +if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { + Bad = true; + break; +} + } +} +Assert1(!Bad, +"Invoke value defined on critical edge but not dead!", &I); + } +} else if (OpBlock == BB) { // If they are in the same basic block, make sure that the definition // comes before the use. Assert2(InstsInThisBlock.count(Op) || ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.172 -> 1.173 --- Log message: only check non-external functions --- Diffs of the changes: (+6 -6) Verifier.cpp | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.172 llvm/lib/VMCore/Verifier.cpp:1.173 --- llvm/lib/VMCore/Verifier.cpp:1.172 Tue Dec 12 22:30:37 2006 +++ llvm/lib/VMCore/Verifier.cppTue Dec 12 22:45:46 2006 @@ -334,12 +334,6 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); - // Verify that this function (which has a body) is not named "llvm.*". It - // is not legal to define intrinsics. - if (F.getName().size() >= 5) -Assert1(F.getName().substr(0, 5) != "llvm.", -"llvm intrinsics cannot be defined!", &F); - // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: @@ -371,6 +365,12 @@ } if (!F.isExternal()) { +// Verify that this function (which has a body) is not named "llvm.*". It +// is not legal to define intrinsics. +if (F.getName().size() >= 5) + Assert1(F.getName().substr(0, 5) != "llvm.", + "llvm intrinsics cannot be defined!", &F); + verifySymbolTable(F.getSymbolTable()); // Check the entry node ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.171 -> 1.172 --- Log message: Reject attempts to define intrinsics. This fixes PR1047: http://llvm.org/PR1047 and Regression/Verifier/2006-12-12-IntrinsicDefine.ll --- Diffs of the changes: (+7 -0) Verifier.cpp |7 +++ 1 files changed, 7 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.171 llvm/lib/VMCore/Verifier.cpp:1.172 --- llvm/lib/VMCore/Verifier.cpp:1.171 Thu Dec 7 17:41:45 2006 +++ llvm/lib/VMCore/Verifier.cppTue Dec 12 22:30:37 2006 @@ -112,6 +112,7 @@ bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager if (RealPass) EF = &getAnalysis(); + visit(F); InstsInThisBlock.clear(); @@ -333,6 +334,12 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + // Verify that this function (which has a body) is not named "llvm.*". It + // is not legal to define intrinsics. + if (F.getName().size() >= 5) +Assert1(F.getName().substr(0, 5) != "llvm.", +"llvm intrinsics cannot be defined!", &F); + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.170 -> 1.171 --- Log message: Don't use in Streams.h but instead. --- Diffs of the changes: (+1 -0) Verifier.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.170 llvm/lib/VMCore/Verifier.cpp:1.171 --- llvm/lib/VMCore/Verifier.cpp:1.170 Wed Dec 6 19:30:31 2006 +++ llvm/lib/VMCore/Verifier.cppThu Dec 7 17:41:45 2006 @@ -60,6 +60,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" #include +#include #include using namespace llvm; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.168 -> 1.169 --- Log message: Remove the 'printname' argument to WriteAsOperand. It is always true, and passing false would make the asmprinter fail anyway. --- Diffs of the changes: (+1 -1) Verifier.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.168 llvm/lib/VMCore/Verifier.cpp:1.169 --- llvm/lib/VMCore/Verifier.cpp:1.168 Mon Nov 27 20:09:03 2006 +++ llvm/lib/VMCore/Verifier.cppWed Dec 6 00:16:21 2006 @@ -218,7 +218,7 @@ if (isa(V)) { msgs << *V; } else { -WriteAsOperand (msgs, V, true, true, Mod); +WriteAsOperand(msgs, V, true, Mod); msgs << "\n"; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.163 -> 1.164 --- Log message: Added some eye-candy for Subtarget type checking Added X86 StdCall & FastCall calling conventions. Codegen will follow. --- Diffs of the changes: (+1 -0) Verifier.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.163 llvm/lib/VMCore/Verifier.cpp:1.164 --- llvm/lib/VMCore/Verifier.cpp:1.163 Thu Sep 14 13:23:27 2006 +++ llvm/lib/VMCore/Verifier.cppSun Sep 17 15:25:45 2006 @@ -332,6 +332,7 @@ break; case CallingConv::Fast: case CallingConv::Cold: + case CallingConv::X86_FastCall: Assert1(!F.isVarArg(), "Varargs functions must have C calling conventions!", &F); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.159 -> 1.160 --- Log message: For PR780: http://llvm.org/PR780 : 1. Move IncludeFile.h to System library 2. Move IncludeFile.cpp to System library 3. #1 and #2 required to prevent cyclic library dependencies for libSystem 4. Convert all existing uses of Support/IncludeFile.h to System/IncludeFile.h 5. Add IncludeFile support to various lib/System classes. 6. Add new lib/System classes to LinkAllVMCore.h All this in an attempt to pull in lib/System to what's required for VMCore --- Diffs of the changes: (+8 -7) Verifier.cpp | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.159 llvm/lib/VMCore/Verifier.cpp:1.160 --- llvm/lib/VMCore/Verifier.cpp:1.159 Tue Jul 11 15:29:49 2006 +++ llvm/lib/VMCore/Verifier.cppWed Jul 26 11:18:00 2006 @@ -105,7 +105,7 @@ // returning back to the pass manager, or else the pass manager may try to // run other passes on the broken module. if (RealPass) -abortIfBroken(); +return abortIfBroken(); return false; } @@ -119,7 +119,7 @@ // returning back to the pass manager, or else the pass manager may try to // run other passes on the broken module. if (RealPass) -abortIfBroken(); +return abortIfBroken(); return false; } @@ -138,8 +138,7 @@ visitGlobalVariable(*I); // If the module is broken, abort at this time. - abortIfBroken(); - return false; + return abortIfBroken(); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -151,7 +150,7 @@ /// abortIfBroken - If the module is broken and we are supposed to abort on /// this condition, do so. /// -void abortIfBroken() { +bool abortIfBroken() { if (Broken) { msgs << "Broken module found, "; switch (action) { @@ -162,11 +161,13 @@ case PrintMessageAction: msgs << "verification continues.\n"; std::cerr << msgs.str(); -break; +return false; case ReturnStatusAction: -break; +msgs << "compilation terminated.\n"; +return Broken; } } + return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.158 -> 1.159 --- Log message: Fix PR826: http://llvm.org/PR826 , testcase here: Regression/Verifier/2006-07-11-StoreStruct.ll --- Diffs of the changes: (+8 -2) Verifier.cpp | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.158 llvm/lib/VMCore/Verifier.cpp:1.159 --- llvm/lib/VMCore/Verifier.cpp:1.158 Thu Jul 6 13:01:23 2006 +++ llvm/lib/VMCore/Verifier.cppTue Jul 11 15:29:49 2006 @@ -652,10 +652,16 @@ } for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { -// Check to make sure that the "address of" an intrinsic function is never -// taken. Assert1(I.getOperand(i) != 0, "Instruction has null operand!", &I); + +// Check to make sure that only first-class-values are operands to +// instructions. +Assert1(I.getOperand(i)->getType()->isFirstClassType(), +"Instruction operands must be first-class values!", &I); + if (Function *F = dyn_cast(I.getOperand(i))) { + // Check to make sure that the "address of" an intrinsic function is never + // taken. Assert1(!F->isIntrinsic() || (i == 0 && isa(I)), "Cannot take the address of an intrinsic!", &I); } else if (BasicBlock *OpBB = dyn_cast(I.getOperand(i))) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.157 -> 1.158 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+7 -8) Verifier.cpp | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.157 llvm/lib/VMCore/Verifier.cpp:1.158 --- llvm/lib/VMCore/Verifier.cpp:1.157 Wed Jun 28 16:38:54 2006 +++ llvm/lib/VMCore/Verifier.cppThu Jul 6 13:01:23 2006 @@ -152,18 +152,13 @@ /// this condition, do so. /// void abortIfBroken() { - if (Broken) - { + if (Broken) { msgs << "Broken module found, "; -switch (action) -{ +switch (action) { case AbortProcessAction: msgs << "compilation aborted!\n"; std::cerr << msgs.str(); abort(); - case ThrowExceptionAction: -msgs << "verification terminated.\n"; -throw msgs.str(); case PrintMessageAction: msgs << "verification continues.\n"; std::cerr << msgs.str(); @@ -799,11 +794,15 @@ /// verifyModule - Check a module for errors, printing messages on stderr. /// Return true if the module is corrupt. /// -bool llvm::verifyModule(const Module &M, VerifierFailureAction action) { +bool llvm::verifyModule(const Module &M, VerifierFailureAction action, +std::string *ErrorInfo) { PassManager PM; Verifier *V = new Verifier(action); PM.add(V); PM.run((Module&)M); + + if (ErrorInfo && V->Broken) +*ErrorInfo = V->msgs.str(); return V->Broken; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.155 -> 1.156 --- Log message: csret functions can be varargs (as can target cc's). Verify restrictions on csret functions. --- Diffs of the changes: (+18 -3) Verifier.cpp | 21 ++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.155 llvm/lib/VMCore/Verifier.cpp:1.156 --- llvm/lib/VMCore/Verifier.cpp:1.155 Sun May 14 13:34:36 2006 +++ llvm/lib/VMCore/Verifier.cppFri May 19 16:25:17 2006 @@ -302,9 +302,6 @@ // visitFunction - Verify that a function is ok. // void Verifier::visitFunction(Function &F) { - Assert1(!F.isVarArg() || F.getCallingConv() == CallingConv::C, - "Varargs functions must have C calling conventions!", &F); - // Check function arguments. const FunctionType *FT = F.getFunctionType(); unsigned NumArgs = F.getArgumentList().size(); @@ -316,6 +313,24 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + // Check that this function meets the restrictions on this calling convention. + switch (F.getCallingConv()) { + default: +break; + case CallingConv::C: +break; + case CallingConv::CSRet: +Assert1(FT->getReturnType() == Type::VoidTy && +FT->getNumParams() > 0 && isa(FT->getParamType(0)), +"Invalid struct-return function!", &F); +break; + case CallingConv::Fast: + case CallingConv::Cold: +Assert1(!F.isVarArg(), +"Varargs functions must have C calling conventions!", &F); +break; + } + // Check that the argument values match the function type for this function... unsigned i = 0; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.153 -> 1.154 --- Log message: Use the isValidOperands helper instead of duplicating checking code --- Diffs of the changes: (+7 -16) Verifier.cpp | 23 +++ 1 files changed, 7 insertions(+), 16 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.153 llvm/lib/VMCore/Verifier.cpp:1.154 --- llvm/lib/VMCore/Verifier.cpp:1.153 Fri Apr 7 20:18:18 2006 +++ llvm/lib/VMCore/Verifier.cppFri Apr 7 23:07:52 2006 @@ -540,26 +540,17 @@ } void Verifier::visitExtractElementInst(ExtractElementInst &EI) { - Assert1(isa(EI.getOperand(0)->getType()), - "First operand to extractelement must be packed type!", &EI); - Assert1(EI.getOperand(1)->getType() == Type::UIntTy, - "Second operand to extractelement must be uint type!", &EI); - Assert1(EI.getType() == - cast(EI.getOperand(0)->getType())->getElementType(), - "Extractelement return type must match " - "first operand element type!", &EI); + Assert1(ExtractElementInst::isValidOperands(EI.getOperand(0), + EI.getOperand(1)), + "Invalid extractelement operands!", &EI); visitInstruction(EI); } void Verifier::visitInsertElementInst(InsertElementInst &IE) { - Assert1(isa(IE.getOperand(0)->getType()), - "First operand to insertelement must be packed type!", &IE); - Assert1(IE.getOperand(1)->getType() == - cast(IE.getOperand(0)->getType())->getElementType(), - "Second operand to insertelement must match " - "first operand element type!", &IE); - Assert1(IE.getOperand(2)->getType() == Type::UIntTy, - "Third operand to insertelement must be uint type!", &IE); + Assert1(InsertElementInst::isValidOperands(IE.getOperand(0), + IE.getOperand(1), + IE.getOperand(2)), + "Invalid insertelement operands!", &IE); visitInstruction(IE); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.151 -> 1.152 --- Log message: Fix build breakage. --- Diffs of the changes: (+1 -0) Verifier.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.151 llvm/lib/VMCore/Verifier.cpp:1.152 --- llvm/lib/VMCore/Verifier.cpp:1.151 Thu Mar 30 22:46:47 2006 +++ llvm/lib/VMCore/Verifier.cppFri Mar 31 01:22:05 2006 @@ -60,6 +60,7 @@ #include #include #include +#include using namespace llvm; namespace { // Anonymous namespace for class ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.150 -> 1.151 --- Log message: Add a new method to verify intrinsic function prototypes. --- Diffs of the changes: (+60 -2) Verifier.cpp | 62 +-- 1 files changed, 60 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.150 llvm/lib/VMCore/Verifier.cpp:1.151 --- llvm/lib/VMCore/Verifier.cpp:1.150 Thu Mar 9 16:06:04 2006 +++ llvm/lib/VMCore/Verifier.cppThu Mar 30 22:46:47 2006 @@ -55,6 +55,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" #include "llvm/Support/InstVisitor.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include #include @@ -196,6 +197,7 @@ void visitUserOp2(Instruction &I) { visitUserOp1(I); } void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); +void VerifyIntrinsicPrototype(Function *F, ...); void WriteValue(const Value *V) { if (!V) return; @@ -436,8 +438,7 @@ /// a pass, if any exist, it's an error. /// void Verifier::visitUserOp1(Instruction &I) { - Assert1(0, "User-defined operators should not live outside of a pass!", - &I); + Assert1(0, "User-defined operators should not live outside of a pass!", &I); } /// visitPHINode - Ensure that a PHI node is well formed. @@ -684,6 +685,63 @@ #undef GET_INTRINSIC_VERIFIER } +/// VerifyIntrinsicPrototype - TableGen emits calls to this function into +/// Intrinsics.gen. This implements a little state machine that verifies the +/// prototype of intrinsics. +void Verifier::VerifyIntrinsicPrototype(Function *F, ...) { + va_list VA; + va_start(VA, F); + + const FunctionType *FTy = F->getFunctionType(); + + // Note that "arg#0" is the return type. + for (unsigned ArgNo = 0; 1; ++ArgNo) { +int TypeID = va_arg(VA, int); + +if (TypeID == -1) { + if (ArgNo != FTy->getNumParams()+1) +CheckFailed("Intrinsic prototype has too many arguments!", F); + break; +} + +if (ArgNo == FTy->getNumParams()+1) { + CheckFailed("Intrinsic prototype has too few arguments!", F); + break; +} + +const Type *Ty; +if (ArgNo == 0) + Ty = FTy->getReturnType(); +else + Ty = FTy->getParamType(ArgNo-1); + +if (Ty->getTypeID() != TypeID) { + if (ArgNo == 0) +CheckFailed("Intrinsic prototype has incorrect result type!", F); + else +CheckFailed("Intrinsic parameter #" + utostr(ArgNo-1) + " is wrong!",F); + break; +} + +// If this is a packed argument, verify the number and type of elements. +if (TypeID == Type::PackedTyID) { + const PackedType *PTy = cast(Ty); + if (va_arg(VA, int) != PTy->getElementType()->getTypeID()) { +CheckFailed("Intrinsic prototype has incorrect vector element type!",F); +break; + } + + if ((unsigned)va_arg(VA, int) != PTy->getNumElements()) { +CheckFailed("Intrinsic prototype has incorrect number of " +"vector elements!",F); +break; + } +} + } + + va_end(VA); +} + //===--===// // Implement the public interfaces to this file... ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.149 -> 1.150 --- Log message: Use the autogenerated intrinsic verifier --- Diffs of the changes: (+5 -266) Verifier.cpp | 271 +-- 1 files changed, 5 insertions(+), 266 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.149 llvm/lib/VMCore/Verifier.cpp:1.150 --- llvm/lib/VMCore/Verifier.cpp:1.149 Thu Mar 9 14:01:50 2006 +++ llvm/lib/VMCore/Verifier.cppThu Mar 9 16:06:04 2006 @@ -676,273 +676,12 @@ /// void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Function *IF = CI.getCalledFunction(); - const FunctionType *FT = IF->getFunctionType(); + const FunctionType *FTy = IF->getFunctionType(); Assert1(IF->isExternal(), "Intrinsic functions should never be defined!", IF); - unsigned NumArgs = 0; - - // FIXME: this should check the return type of each intrinsic as well, also - // arguments! - switch (ID) { - case Intrinsic::vastart: -Assert1(CI.getParent()->getParent()->getFunctionType()->isVarArg(), -"llvm.va_start intrinsic may only occur in function with variable" -" args!", &CI); -NumArgs = 1; -break; - case Intrinsic::vaend: NumArgs = 1; break; - case Intrinsic::vacopy: NumArgs = 2; break; - - case Intrinsic::returnaddress: - case Intrinsic::frameaddress: -Assert1(isa(FT->getReturnType()), -"llvm.(frame|return)address must return pointers", IF); -Assert1(FT->getNumParams() == 1 && isa(CI.getOperand(1)), - "llvm.(frame|return)address require a single constant integer argument", -&CI); -NumArgs = 1; -break; - - case Intrinsic::isunordered_f32: -Assert1(FT->getNumParams() == 2, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == Type::BoolTy, -"Return type is not bool!", IF); -Assert1(FT->getParamType(0) == FT->getParamType(1), -"Arguments must be of the same type!", IF); -Assert1(FT->getParamType(0) == Type::FloatTy, -"Arguments must be a 32-bit floating point type!", IF); -NumArgs = 2; -break; - - case Intrinsic::isunordered_f64: -Assert1(FT->getNumParams() == 2, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == Type::BoolTy, -"Return type is not bool!", IF); -Assert1(FT->getParamType(0) == FT->getParamType(1), -"Arguments must be of the same type!", IF); -Assert1(FT->getParamType(0) == Type::DoubleTy, -"Argument is not a 64-bit floating point type!", IF); -NumArgs = 2; -break; - - case Intrinsic::readcyclecounter: -Assert1(FT->getNumParams() == 0, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == Type::ULongTy, -"Return type is not ulong!", IF); -NumArgs = 0; -break; - - case Intrinsic::bswap_i16: -Assert1(FT->getNumParams() == 1, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == FT->getParamType(0), -"Return type does not match source type", IF); -Assert1(FT->getReturnType() == Type::UShortTy, -"Return type is not ushort!", IF); -NumArgs = 1; -break; - - case Intrinsic::bswap_i32: -Assert1(FT->getNumParams() == 1, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == FT->getParamType(0), -"Return type does not match source type", IF); -Assert1(FT->getReturnType() == Type::UIntTy, -"Return type is not uint!", IF); -NumArgs = 1; -break; - - case Intrinsic::bswap_i64: -Assert1(FT->getNumParams() == 1, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == FT->getParamType(0), -"Return type does not match source type", IF); -Assert1(FT->getReturnType() == Type::ULongTy, -"Return type is not ulong!", IF); -NumArgs = 1; -break; - - case Intrinsic::ctpop_i8: -Assert1(FT->getNumParams() == 1, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == FT->getParamType(0), -"Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UByteTy, -"Argument is not ubyte!", IF); -NumArgs = 1; -break; - - case Intrinsic::ctpop_i16: -Assert1(FT->getNumParams() == 1, -"Illegal # arguments for intrinsic function!", IF); -Assert1(FT->getReturnType() == FT->getParamType(0), -"Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UShortTy, -"Argument is not ushort!", IF); -NumArgs = 1; -break; - - case Intrinsic::ctpop_i32: -Assert1(FT->getNumParams() == 1
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.145 -> 1.146 --- Log message: Make sure the only user of InlineAsm's are direct calls. --- Diffs of the changes: (+4 -0) Verifier.cpp |4 1 files changed, 4 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.145 llvm/lib/VMCore/Verifier.cpp:1.146 --- llvm/lib/VMCore/Verifier.cpp:1.145 Wed Jan 18 19:20:03 2006 +++ llvm/lib/VMCore/Verifier.cppWed Jan 25 18:08:45 2006 @@ -47,6 +47,7 @@ #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/DerivedTypes.h" +#include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/PassManager.h" @@ -663,6 +664,9 @@ !EF->dominates(&BB->getParent()->getEntryBlock(), PredBB), "Instruction does not dominate all uses!", Op, &I); } +} else if (isa(I.getOperand(i))) { + Assert1(i == 0 && isa(I), + "Cannot take the address of an inline asm!", &I); } } InstsInThisBlock.insert(&I); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.144 -> 1.145 --- Log message: Don't accept the ctpop, cttz, or ctlz intrinsics with signed arguments. The interface requires unsigned arguments. --- Diffs of the changes: (+16 -36) Verifier.cpp | 52 1 files changed, 16 insertions(+), 36 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.144 llvm/lib/VMCore/Verifier.cpp:1.145 --- llvm/lib/VMCore/Verifier.cpp:1.144 Tue Jan 17 14:07:22 2006 +++ llvm/lib/VMCore/Verifier.cppWed Jan 18 19:20:03 2006 @@ -810,9 +810,8 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UByteTy -|| FT->getParamType(0) == Type::SByteTy, -"Argument must be a byte type!", IF); +Assert1(FT->getParamType(0) == Type::UByteTy, +"Argument is not ubyte!", IF); NumArgs = 1; break; @@ -821,9 +820,8 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UShortTy -|| FT->getParamType(0) == Type::ShortTy, -"Argument must be a short type!", IF); +Assert1(FT->getParamType(0) == Type::UShortTy, +"Argument is not ushort!", IF); NumArgs = 1; break; @@ -832,9 +830,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UIntTy -|| FT->getParamType(0) == Type::IntTy, -"Argument must be an int type!", IF); +Assert1(FT->getParamType(0) == Type::UIntTy, "Argument is not uint!", IF); NumArgs = 1; break; @@ -843,9 +839,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::ULongTy -|| FT->getParamType(0) == Type::LongTy, -"Argument must be a long type!", IF); +Assert1(FT->getParamType(0) == Type::ULongTy, "Argument is not ulong!", IF); NumArgs = 1; break; @@ -854,9 +848,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UByteTy -|| FT->getParamType(0) == Type::SByteTy, -"Argument must be a byte type!", IF); +Assert1(FT->getParamType(0) == Type::UByteTy, "Argument is not ubyte!", IF); NumArgs = 1; break; @@ -865,9 +857,8 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UShortTy -|| FT->getParamType(0) == Type::ShortTy, -"Argument must be a short type!", IF); +Assert1(FT->getParamType(0) == Type::UShortTy, +"Argument is not ushort!", IF); NumArgs = 1; break; case Intrinsic::ctlz_i32: @@ -875,9 +866,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UIntTy -|| FT->getParamType(0) == Type::IntTy, -"Argument must be an int type!", IF); +Assert1(FT->getParamType(0) == Type::UIntTy, "Argument is not uint!", IF); NumArgs = 1; break; case Intrinsic::ctlz_i64: @@ -885,9 +874,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::ULongTy -|| FT->getParamType(0) == Type::LongTy, -"Argument must be a long type!", IF); +Assert1(FT->getParamType(0) == Type::ULongTy, "Argument is not ulong!", IF); NumArgs = 1; break; case Intrinsic::cttz_i8: @@ -895,9 +882,7 @@ "Illegal # arguments for intrinsic function!", IF); Assert1(FT->getReturnType() == FT->getParamType(0), "Return type does not match source type", IF); -Assert1(FT->getParamType(0) == Type::UByteTy -|| FT->getParamType(0) == Type::SByteTy, -"Argument must be a byte type!", IF); +Assert1(FT->getParamType(0) == Type::UByteTy, "Argument is not ubyte!", IF); NumArgs = 1; break; case Int
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.141 -> 1.142 --- Log message: Thanks to Daniel Berlin's ETForest fix, we can now use it again for the verifier --- Diffs of the changes: (+0 -2) Verifier.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.141 llvm/lib/VMCore/Verifier.cpp:1.142 --- llvm/lib/VMCore/Verifier.cpp:1.141 Sun Jan 15 14:00:51 2006 +++ llvm/lib/VMCore/Verifier.cppSun Jan 15 15:58:50 2006 @@ -60,8 +60,6 @@ #include using namespace llvm; -#define ETForest DominatorSet - namespace { // Anonymous namespace for class struct Verifier : public FunctionPass, InstVisitor { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.140 -> 1.141 --- Log message: ET-Forest has issues with unreachable blocks. Temporarily disable verifiers use of it until they are resolved. --- Diffs of the changes: (+2 -0) Verifier.cpp |2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.140 llvm/lib/VMCore/Verifier.cpp:1.141 --- llvm/lib/VMCore/Verifier.cpp:1.140 Fri Jan 13 19:25:24 2006 +++ llvm/lib/VMCore/Verifier.cppSun Jan 15 14:00:51 2006 @@ -60,6 +60,8 @@ #include using namespace llvm; +#define ETForest DominatorSet + namespace { // Anonymous namespace for class struct Verifier : public FunctionPass, InstVisitor { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.137 -> 1.138 --- Log message: Convert the verifier over to use ETForest instead of DominatorSet. Patch by Daniel Berlin --- Diffs of the changes: (+14 -14) Verifier.cpp | 28 ++-- 1 files changed, 14 insertions(+), 14 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.137 llvm/lib/VMCore/Verifier.cpp:1.138 --- llvm/lib/VMCore/Verifier.cpp:1.137 Tue Jan 10 13:05:24 2006 +++ llvm/lib/VMCore/Verifier.cppThu Jan 12 00:17:59 2006 @@ -68,7 +68,7 @@ VerifierFailureAction action; // What to do if verification fails. Module *Mod; // Module we are verifying right now -DominatorSet *DS; // Dominator set, caution can be null! +ETForest *EF; // ET-Forest, caution can be null! std::stringstream msgs; // A stringstream to collect messages /// InstInThisBlock - when verifying a basic block, keep track of all of the @@ -79,17 +79,17 @@ Verifier() : Broken(false), RealPass(true), action(AbortProcessAction), - DS(0), msgs( std::ios::app | std::ios::out ) {} + EF(0), msgs( std::ios::app | std::ios::out ) {} Verifier( VerifierFailureAction ctn ) -: Broken(false), RealPass(true), action(ctn), DS(0), +: Broken(false), RealPass(true), action(ctn), EF(0), msgs( std::ios::app | std::ios::out ) {} Verifier(bool AB ) : Broken(false), RealPass(true), - action( AB ? AbortProcessAction : PrintMessageAction), DS(0), + action( AB ? AbortProcessAction : PrintMessageAction), EF(0), msgs( std::ios::app | std::ios::out ) {} -Verifier(DominatorSet &ds) +Verifier(ETForest &ef) : Broken(false), RealPass(false), action(PrintMessageAction), -DS(&ds), msgs( std::ios::app | std::ios::out ) {} +EF(&ef), msgs( std::ios::app | std::ios::out ) {} bool doInitialization(Module &M) { @@ -106,7 +106,7 @@ bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager - if (RealPass) DS = &getAnalysis(); + if (RealPass) EF = &getAnalysis(); visit(F); InstsInThisBlock.clear(); @@ -139,7 +139,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); if (RealPass) -AU.addRequired(); + AU.addRequired(); } /// abortIfBroken - If the module is broken and we are supposed to abort on @@ -582,7 +582,7 @@ for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE; ++UI) Assert1(*UI != (User*)&I || - !DS->dominates(&BB->getParent()->getEntryBlock(), BB), + !EF->dominates(&BB->getParent()->getEntryBlock(), BB), "Only PHI nodes may reference their own value!", &I); } @@ -633,20 +633,20 @@ // If they are in the same basic block, make sure that the definition // comes before the use. Assert2(InstsInThisBlock.count(Op) || - !DS->dominates(&BB->getParent()->getEntryBlock(), BB), + !EF->dominates(&BB->getParent()->getEntryBlock(), BB), "Instruction does not dominate all uses!", Op, &I); } // Definition must dominate use unless use is unreachable! -Assert2(DS->dominates(OpBlock, BB) || -!DS->dominates(&BB->getParent()->getEntryBlock(), BB), +Assert2(EF->dominates(OpBlock, BB) || +!EF->dominates(&BB->getParent()->getEntryBlock(), BB), "Instruction does not dominate all uses!", Op, &I); } else { // PHI nodes are more difficult than other nodes because they actually // "use" the value in the predecessor basic blocks they correspond to. BasicBlock *PredBB = cast(I.getOperand(i+1)); -Assert2(DS->dominates(OpBlock, PredBB) || -!DS->dominates(&BB->getParent()->getEntryBlock(), PredBB), +Assert2(EF->dominates(OpBlock, PredBB) || +!EF->dominates(&BB->getParent()->getEntryBlock(), PredBB), "Instruction does not dominate all uses!", Op, &I); } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits