From owner-svn-src-all@FreeBSD.ORG Sun Jun 7 09:21:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E6B5106566B; Sun, 7 Jun 2009 09:21:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08ACA8FC08; Sun, 7 Jun 2009 09:21:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n579L9HF088371; Sun, 7 Jun 2009 09:21:09 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n579L9fE088356; Sun, 7 Jun 2009 09:21:09 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906070921.n579L9fE088356@svn.freebsd.org> From: Ed Schouten Date: Sun, 7 Jun 2009 09:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193630 - in vendor/llvm/dist: docs include/llvm include/llvm/Analysis lib/Analysis lib/AsmParser lib/CodeGen/SelectionDAG lib/Target/PowerPC lib/Target/X86 lib/Transforms/IPO lib/Trans... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2009 09:21:10 -0000 Author: ed Date: Sun Jun 7 09:21:09 2009 New Revision: 193630 URL: http://svn.freebsd.org/changeset/base/193630 Log: Import LLVM r73021. Added: vendor/llvm/dist/test/CodeGen/PowerPC/vec_shift.ll vendor/llvm/dist/test/CodeGen/X86/vec_loadsingles.ll vendor/llvm/dist/test/Transforms/InstCombine/vec_demanded_elts-3.ll vendor/llvm/dist/tools/llvmc/example/mcc16/ vendor/llvm/dist/tools/llvmc/example/mcc16/Makefile vendor/llvm/dist/tools/llvmc/example/mcc16/README vendor/llvm/dist/tools/llvmc/example/mcc16/driver/ vendor/llvm/dist/tools/llvmc/example/mcc16/driver/Main.cpp vendor/llvm/dist/tools/llvmc/example/mcc16/driver/Makefile vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/ vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/Makefile vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/PIC16Base/ vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td vendor/llvm/dist/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Modified: vendor/llvm/dist/docs/GoldPlugin.html vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h vendor/llvm/dist/include/llvm/DerivedTypes.h vendor/llvm/dist/include/llvm/Type.h vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist/lib/AsmParser/LLParser.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCInstrAltivec.td vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Transforms/IPO/GlobalOpt.cpp vendor/llvm/dist/lib/Transforms/IPO/IPConstantPropagation.cpp vendor/llvm/dist/lib/Transforms/Scalar/InstructionCombining.cpp vendor/llvm/dist/lib/Transforms/Scalar/PredicateSimplifier.cpp vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp vendor/llvm/dist/lib/Transforms/Scalar/ScalarReplAggregates.cpp vendor/llvm/dist/lib/VMCore/Type.cpp vendor/llvm/dist/lib/VMCore/Verifier.cpp vendor/llvm/dist/test/CodeGen/X86/vec_set-5.ll vendor/llvm/dist/test/CodeGen/X86/vec_set-6.ll vendor/llvm/dist/tools/gold/gold-plugin.cpp Modified: vendor/llvm/dist/docs/GoldPlugin.html ============================================================================== --- vendor/llvm/dist/docs/GoldPlugin.html Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/docs/GoldPlugin.html Sun Jun 7 09:21:09 2009 (r193630) @@ -157,7 +157,7 @@ export AR="$PREFIX/bin/ar" export NM="$PREFIX/bin/nm" export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a export CFLAGS="-O4" - +
  • Or you can just set your path:
    @@ -166,7 +166,7 @@ export CC="llvm-gcc -use-gold-plugin"
     export CXX="llvm-g++ -use-gold-plugin"
     export RANLIB=/bin/true
     export CFLAGS="-O4"
    -     
    +
  • Configure & build the project as usual: ./configure && make && make check
  • Modified: vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h ============================================================================== --- vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h Sun Jun 7 09:21:09 2009 (r193630) @@ -227,9 +227,9 @@ namespace llvm { /// TargetData *TD; - /// UnknownValue - This SCEV is used to represent unknown trip counts and - /// things. - SCEVHandle UnknownValue; + /// CouldNotCompute - This SCEV is used to represent unknown trip + /// counts and things. + SCEVHandle CouldNotCompute; /// Scalars - This is a cache of the scalars we have analyzed so far. /// @@ -322,23 +322,23 @@ namespace llvm { /// a constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot - /// evaluate the trip count of the loop, return UnknownValue. + /// evaluate the trip count of the loop, return CouldNotCompute. SCEVHandle ComputeBackedgeTakenCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen); /// HowFarToZero - Return the number of times a backedge comparing the /// specified value to zero will execute. If not computable, return - /// UnknownValue. + /// CouldNotCompute. SCEVHandle HowFarToZero(const SCEV *V, const Loop *L); /// HowFarToNonZero - Return the number of times a backedge checking the /// specified value for nonzero will execute. If not computable, return - /// UnknownValue. + /// CouldNotCompute. SCEVHandle HowFarToNonZero(const SCEV *V, const Loop *L); /// HowManyLessThans - Return the number of times a backedge containing the /// specified less-than comparison will execute. If not computable, return - /// UnknownValue. isSigned specifies whether the less-than is signed. + /// CouldNotCompute. isSigned specifies whether the less-than is signed. BackedgeTakenInfo HowManyLessThans(const SCEV *LHS, const SCEV *RHS, const Loop *L, bool isSigned); Modified: vendor/llvm/dist/include/llvm/DerivedTypes.h ============================================================================== --- vendor/llvm/dist/include/llvm/DerivedTypes.h Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/include/llvm/DerivedTypes.h Sun Jun 7 09:21:09 2009 (r193630) @@ -159,6 +159,10 @@ public: /// type. static bool isValidReturnType(const Type *RetTy); + /// isValidArgumentType - Return true if the specified type is valid as an + /// argument type. + static bool isValidArgumentType(const Type *ArgTy); + inline bool isVarArg() const { return isVarArgs; } inline const Type *getReturnType() const { return ContainedTys[0]; } @@ -232,6 +236,10 @@ public: /// an empty struct, pass NULL, NULL. static StructType *get(const Type *type, ...) END_WITH_NULL; + /// isValidElementType - Return true if the specified type is valid as a + /// element type. + static bool isValidElementType(const Type *ElemTy); + // Iterator access to the elements typedef Type::subtype_iterator element_iterator; element_iterator element_begin() const { return ContainedTys; } @@ -331,6 +339,10 @@ public: /// static ArrayType *get(const Type *ElementType, uint64_t NumElements); + /// isValidElementType - Return true if the specified type is valid as a + /// element type. + static bool isValidElementType(const Type *ElemTy); + inline uint64_t getNumElements() const { return NumElements; } // Implement the AbstractTypeUser interface. @@ -391,6 +403,10 @@ public: return VectorType::get(EltTy, VTy->getNumElements()); } + /// isValidElementType - Return true if the specified type is valid as a + /// element type. + static bool isValidElementType(const Type *ElemTy); + /// @brief Return the number of elements in the Vector type. inline unsigned getNumElements() const { return NumElements; } @@ -431,6 +447,10 @@ public: return PointerType::get(ElementType, 0); } + /// isValidElementType - Return true if the specified type is valid as a + /// element type. + static bool isValidElementType(const Type *ElemTy); + /// @brief Return the address space of the Pointer type. inline unsigned getAddressSpace() const { return AddressSpace; } Modified: vendor/llvm/dist/include/llvm/Type.h ============================================================================== --- vendor/llvm/dist/include/llvm/Type.h Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/include/llvm/Type.h Sun Jun 7 09:21:09 2009 (r193630) @@ -205,7 +205,7 @@ public: inline bool isAbstract() const { return Abstract; } /// canLosslesslyBitCastTo - Return true if this type could be converted - /// with a lossless BitCast to type 'Ty'. For example, uint to int. BitCasts + /// with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts /// are valid for types of the same size only where no re-interpretation of /// the bits is done. /// @brief Determine if this type could be losslessly bitcast to Ty Modified: vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -1771,7 +1771,7 @@ const Type *ScalarEvolution::getEffectiv } SCEVHandle ScalarEvolution::getCouldNotCompute() { - return UnknownValue; + return CouldNotCompute; } /// hasSCEV - Return true if the SCEV for this value has already been @@ -2395,7 +2395,7 @@ ScalarEvolution::getBackedgeTakenInfo(co BackedgeTakenCounts.insert(std::make_pair(L, getCouldNotCompute())); if (Pair.second) { BackedgeTakenInfo ItCount = ComputeBackedgeTakenCount(L); - if (ItCount.Exact != UnknownValue) { + if (ItCount.Exact != CouldNotCompute) { assert(ItCount.Exact->isLoopInvariant(L) && ItCount.Max->isLoopInvariant(L) && "Computed trip count isn't loop invariant for loop!"); @@ -2464,20 +2464,20 @@ ScalarEvolution::ComputeBackedgeTakenCou // If the loop has a non-one exit block count, we can't analyze it. BasicBlock *ExitBlock = L->getExitBlock(); if (!ExitBlock) - return UnknownValue; + return CouldNotCompute; // Okay, there is one exit block. Try to find the condition that causes the // loop to be exited. BasicBlock *ExitingBlock = L->getExitingBlock(); if (!ExitingBlock) - return UnknownValue; // More than one block exiting! + return CouldNotCompute; // More than one block exiting! // Okay, we've computed the exiting block. See what condition causes us to // exit. // // FIXME: we should be able to handle switch instructions (with a single exit) BranchInst *ExitBr = dyn_cast(ExitingBlock->getTerminator()); - if (ExitBr == 0) return UnknownValue; + if (ExitBr == 0) return CouldNotCompute; assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!"); // At this point, we know we have a conditional branch that determines whether @@ -2493,7 +2493,7 @@ ScalarEvolution::ComputeBackedgeTakenCou if (ExitBr->getSuccessor(0) != L->getHeader() && ExitBr->getSuccessor(1) != L->getHeader() && ExitBr->getParent() != L->getHeader()) - return UnknownValue; + return CouldNotCompute; ICmpInst *ExitCond = dyn_cast(ExitBr->getCondition()); @@ -2647,11 +2647,11 @@ SCEVHandle ScalarEvolution:: ComputeLoadConstantCompareBackedgeTakenCount(LoadInst *LI, Constant *RHS, const Loop *L, ICmpInst::Predicate predicate) { - if (LI->isVolatile()) return UnknownValue; + if (LI->isVolatile()) return CouldNotCompute; // Check to see if the loaded pointer is a getelementptr of a global. GetElementPtrInst *GEP = dyn_cast(LI->getOperand(0)); - if (!GEP) return UnknownValue; + if (!GEP) return CouldNotCompute; // Make sure that it is really a constant global we are gepping, with an // initializer, and make sure the first IDX is really 0. @@ -2659,7 +2659,7 @@ ComputeLoadConstantCompareBackedgeTakenC if (!GV || !GV->isConstant() || !GV->hasInitializer() || GEP->getNumOperands() < 3 || !isa(GEP->getOperand(1)) || !cast(GEP->getOperand(1))->isNullValue()) - return UnknownValue; + return CouldNotCompute; // Okay, we allow one non-constant index into the GEP instruction. Value *VarIdx = 0; @@ -2669,7 +2669,7 @@ ComputeLoadConstantCompareBackedgeTakenC if (ConstantInt *CI = dyn_cast(GEP->getOperand(i))) { Indexes.push_back(CI); } else if (!isa(GEP->getOperand(i))) { - if (VarIdx) return UnknownValue; // Multiple non-constant idx's. + if (VarIdx) return CouldNotCompute; // Multiple non-constant idx's. VarIdx = GEP->getOperand(i); VarIdxNum = i-2; Indexes.push_back(0); @@ -2686,7 +2686,7 @@ ComputeLoadConstantCompareBackedgeTakenC if (!IdxExpr || !IdxExpr->isAffine() || IdxExpr->isLoopInvariant(L) || !isa(IdxExpr->getOperand(0)) || !isa(IdxExpr->getOperand(1))) - return UnknownValue; + return CouldNotCompute; unsigned MaxSteps = MaxBruteForceIterations; for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) { @@ -2713,7 +2713,7 @@ ComputeLoadConstantCompareBackedgeTakenC return getConstant(ItCst); // Found terminating iteration! } } - return UnknownValue; + return CouldNotCompute; } @@ -2852,11 +2852,11 @@ getConstantEvolutionLoopExitValue(PHINod /// constant number of times (the condition evolves only from constants), /// try to evaluate a few iterations of the loop until we get the exit /// condition gets a value of ExitWhen (true or false). If we cannot -/// evaluate the trip count of the loop, return UnknownValue. +/// evaluate the trip count of the loop, return CouldNotCompute. SCEVHandle ScalarEvolution:: ComputeBackedgeTakenCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) { PHINode *PN = getConstantEvolvingPHI(Cond, L); - if (PN == 0) return UnknownValue; + if (PN == 0) return CouldNotCompute; // Since the loop is canonicalized, the PHI node must have two entries. One // entry must be a constant (coming in from outside of the loop), and the @@ -2864,11 +2864,11 @@ ComputeBackedgeTakenCountExhaustively(co bool SecondIsBackedge = L->contains(PN->getIncomingBlock(1)); Constant *StartCST = dyn_cast(PN->getIncomingValue(!SecondIsBackedge)); - if (StartCST == 0) return UnknownValue; // Must be a constant. + if (StartCST == 0) return CouldNotCompute; // Must be a constant. Value *BEValue = PN->getIncomingValue(SecondIsBackedge); PHINode *PN2 = getConstantEvolvingPHI(BEValue, L); - if (PN2 != PN) return UnknownValue; // Not derived from same PHI. + if (PN2 != PN) return CouldNotCompute; // Not derived from same PHI. // Okay, we find a PHI node that defines the trip count of this loop. Execute // the loop symbolically to determine when the condition gets a value of @@ -2881,7 +2881,7 @@ ComputeBackedgeTakenCountExhaustively(co dyn_cast_or_null(EvaluateExpression(Cond, PHIVal)); // Couldn't symbolically evaluate. - if (!CondVal) return UnknownValue; + if (!CondVal) return CouldNotCompute; if (CondVal->getValue() == uint64_t(ExitWhen)) { ConstantEvolutionLoopExitValue[PN] = PHIVal; @@ -2892,12 +2892,12 @@ ComputeBackedgeTakenCountExhaustively(co // Compute the value of the PHI node for the next iteration. Constant *NextPHI = EvaluateExpression(BEValue, PHIVal); if (NextPHI == 0 || NextPHI == PHIVal) - return UnknownValue; // Couldn't evaluate or not making progress... + return CouldNotCompute; // Couldn't evaluate or not making progress... PHIVal = NextPHI; } // Too many iterations were needed to evaluate. - return UnknownValue; + return CouldNotCompute; } /// getSCEVAtScope - Return a SCEV expression handle for the specified value @@ -3052,7 +3052,7 @@ SCEVHandle ScalarEvolution::getSCEVAtSco // To evaluate this recurrence, we need to know how many times the AddRec // loop iterates. Compute this now. SCEVHandle BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop()); - if (BackedgeTakenCount == UnknownValue) return AddRec; + if (BackedgeTakenCount == CouldNotCompute) return AddRec; // Then, evaluate the AddRec. return AddRec->evaluateAtIteration(BackedgeTakenCount, *this); @@ -3201,18 +3201,18 @@ SolveQuadraticEquation(const SCEVAddRecE } /// HowFarToZero - Return the number of times a backedge comparing the specified -/// value to zero will execute. If not computable, return UnknownValue. +/// value to zero will execute. If not computable, return CouldNotCompute. SCEVHandle ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) { // If the value is a constant if (const SCEVConstant *C = dyn_cast(V)) { // If the value is already zero, the branch will execute zero times. if (C->getValue()->isZero()) return C; - return UnknownValue; // Otherwise it will loop infinitely. + return CouldNotCompute; // Otherwise it will loop infinitely. } const SCEVAddRecExpr *AddRec = dyn_cast(V); if (!AddRec || AddRec->getLoop() != L) - return UnknownValue; + return CouldNotCompute; if (AddRec->isAffine()) { // If this is an affine expression, the execution count of this branch is @@ -3274,12 +3274,12 @@ SCEVHandle ScalarEvolution::HowFarToZero } } - return UnknownValue; + return CouldNotCompute; } /// HowFarToNonZero - Return the number of times a backedge checking the /// specified value for nonzero will execute. If not computable, return -/// UnknownValue +/// CouldNotCompute SCEVHandle ScalarEvolution::HowFarToNonZero(const SCEV *V, const Loop *L) { // Loops that look like: while (X == 0) are very strange indeed. We don't // handle them yet except for the trivial case. This could be expanded in the @@ -3290,12 +3290,12 @@ SCEVHandle ScalarEvolution::HowFarToNonZ if (const SCEVConstant *C = dyn_cast(V)) { if (!C->getValue()->isNullValue()) return getIntegerSCEV(0, C->getType()); - return UnknownValue; // Otherwise it will loop infinitely. + return CouldNotCompute; // Otherwise it will loop infinitely. } // We could implement others, but I really doubt anyone writes loops like // this, and if they did, they would already be constant folded. - return UnknownValue; + return CouldNotCompute; } /// getLoopPredecessor - If the given loop's header has exactly one unique @@ -3446,16 +3446,16 @@ bool ScalarEvolution::isLoopGuardedByCon /// HowManyLessThans - Return the number of times a backedge containing the /// specified less-than comparison will execute. If not computable, return -/// UnknownValue. +/// CouldNotCompute. ScalarEvolution::BackedgeTakenInfo ScalarEvolution:: HowManyLessThans(const SCEV *LHS, const SCEV *RHS, const Loop *L, bool isSigned) { // Only handle: "ADDREC < LoopInvariant". - if (!RHS->isLoopInvariant(L)) return UnknownValue; + if (!RHS->isLoopInvariant(L)) return CouldNotCompute; const SCEVAddRecExpr *AddRec = dyn_cast(LHS); if (!AddRec || AddRec->getLoop() != L) - return UnknownValue; + return CouldNotCompute; if (AddRec->isAffine()) { // FORNOW: We only support unit strides. @@ -3466,7 +3466,7 @@ HowManyLessThans(const SCEV *LHS, const // TODO: handle non-constant strides. const SCEVConstant *CStep = dyn_cast(Step); if (!CStep || CStep->isZero()) - return UnknownValue; + return CouldNotCompute; if (CStep->isOne()) { // With unit stride, the iteration never steps past the limit value. } else if (CStep->getValue()->getValue().isStrictlyPositive()) { @@ -3477,19 +3477,19 @@ HowManyLessThans(const SCEV *LHS, const APInt Max = APInt::getSignedMaxValue(BitWidth); if ((Max - CStep->getValue()->getValue()) .slt(CLimit->getValue()->getValue())) - return UnknownValue; + return CouldNotCompute; } else { APInt Max = APInt::getMaxValue(BitWidth); if ((Max - CStep->getValue()->getValue()) .ult(CLimit->getValue()->getValue())) - return UnknownValue; + return CouldNotCompute; } } else // TODO: handle non-constant limit values below. - return UnknownValue; + return CouldNotCompute; } else // TODO: handle negative strides below. - return UnknownValue; + return CouldNotCompute; // We know the LHS is of the form {n,+,s} and the RHS is some loop-invariant // m. So, we count the number of iterations in which {n,+,s} < m is true. @@ -3536,7 +3536,7 @@ HowManyLessThans(const SCEV *LHS, const return BackedgeTakenInfo(BECount, MaxBECount); } - return UnknownValue; + return CouldNotCompute; } /// getNumIterationsInRange - Return the number of iterations of this loop that @@ -3724,7 +3724,7 @@ ScalarEvolution::SCEVCallbackVH::SCEVCal //===----------------------------------------------------------------------===// ScalarEvolution::ScalarEvolution() - : FunctionPass(&ID), UnknownValue(new SCEVCouldNotCompute()) { + : FunctionPass(&ID), CouldNotCompute(new SCEVCouldNotCompute()) { } bool ScalarEvolution::runOnFunction(Function &F) { Modified: vendor/llvm/dist/lib/AsmParser/LLParser.cpp ============================================================================== --- vendor/llvm/dist/lib/AsmParser/LLParser.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/AsmParser/LLParser.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -1043,6 +1043,8 @@ bool LLParser::ParseTypeRec(PATypeHolder return TokError("basic block pointers are invalid"); if (Result.get() == Type::VoidTy) return TokError("pointers to void are invalid; use i8* instead"); + if (!PointerType::isValidElementType(Result.get())) + return TokError("pointer to this type is invalid"); Result = HandleUpRefs(PointerType::getUnqual(Result.get())); Lex.Lex(); break; @@ -1053,6 +1055,8 @@ bool LLParser::ParseTypeRec(PATypeHolder return TokError("basic block pointers are invalid"); if (Result.get() == Type::VoidTy) return TokError("pointers to void are invalid; use i8* instead"); + if (!PointerType::isValidElementType(Result.get())) + return TokError("pointer to this type is invalid"); unsigned AddrSpace; if (ParseOptionalAddrSpace(AddrSpace) || ParseToken(lltok::star, "expected '*' in address space")) @@ -1149,7 +1153,7 @@ bool LLParser::ParseArgumentList(std::ve Lex.Lex(); } - if (!ArgTy->isFirstClassType() && !isa(ArgTy)) + if (!FunctionType::isValidArgumentType(ArgTy)) return Error(TypeLoc, "invalid type for function argument"); ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attrs, Name)); @@ -1245,6 +1249,8 @@ bool LLParser::ParseStructType(PATypeHol if (Result == Type::VoidTy) return Error(EltTyLoc, "struct element can not have void type"); + if (!StructType::isValidElementType(Result)) + return Error(EltTyLoc, "invalid element type for struct"); while (EatIfPresent(lltok::comma)) { EltTyLoc = Lex.getLoc(); @@ -1252,6 +1258,8 @@ bool LLParser::ParseStructType(PATypeHol if (Result == Type::VoidTy) return Error(EltTyLoc, "struct element can not have void type"); + if (!StructType::isValidElementType(Result)) + return Error(EltTyLoc, "invalid element type for struct"); ParamsList.push_back(Result); } @@ -1299,11 +1307,11 @@ bool LLParser::ParseArrayVectorType(PATy return Error(SizeLoc, "zero element vector is illegal"); if ((unsigned)Size != Size) return Error(SizeLoc, "size too large for vector"); - if (!EltTy->isFloatingPoint() && !EltTy->isInteger()) + if (!VectorType::isValidElementType(EltTy)) return Error(TypeLoc, "vector element type must be fp or integer"); Result = VectorType::get(EltTy, unsigned(Size)); } else { - if (!EltTy->isFirstClassType() && !isa(EltTy)) + if (!ArrayType::isValidElementType(EltTy)) return Error(TypeLoc, "invalid array element type"); Result = HandleUpRefs(ArrayType::get(EltTy, Size)); } Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -1785,48 +1785,41 @@ SDValue SelectionDAGLegalize::ExpandSCAL /// support the operation, but do support the resultant vector type. SDValue SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) { unsigned NumElems = Node->getNumOperands(); - SDValue SplatValue = Node->getOperand(0); + SDValue Value1, Value2; DebugLoc dl = Node->getDebugLoc(); MVT VT = Node->getValueType(0); - MVT OpVT = SplatValue.getValueType(); + MVT OpVT = Node->getOperand(0).getValueType(); MVT EltVT = VT.getVectorElementType(); // If the only non-undef value is the low element, turn this into a // SCALAR_TO_VECTOR node. If this is { X, X, X, X }, determine X. bool isOnlyLowElement = true; - - // FIXME: it would be far nicer to change this into map - // and use a bitmask instead of a list of elements. - // FIXME: this doesn't treat <0, u, 0, u> for example, as a splat. - std::map > Values; - Values[SplatValue].push_back(0); + bool MoreThanTwoValues = false; bool isConstant = true; - if (!isa(SplatValue) && !isa(SplatValue) && - SplatValue.getOpcode() != ISD::UNDEF) - isConstant = false; - - for (unsigned i = 1; i < NumElems; ++i) { + for (unsigned i = 0; i < NumElems; ++i) { SDValue V = Node->getOperand(i); - Values[V].push_back(i); - if (V.getOpcode() != ISD::UNDEF) + if (V.getOpcode() == ISD::UNDEF) + continue; + if (i > 0) isOnlyLowElement = false; - if (SplatValue != V) - SplatValue = SDValue(0, 0); - - // If this isn't a constant element or an undef, we can't use a constant - // pool load. - if (!isa(V) && !isa(V) && - V.getOpcode() != ISD::UNDEF) + if (!isa(V) && !isa(V)) isConstant = false; + + if (!Value1.getNode()) { + Value1 = V; + } else if (!Value2.getNode()) { + if (V != Value1) + Value2 = V; + } else if (V != Value1 && V != Value2) { + MoreThanTwoValues = true; + } } - if (isOnlyLowElement) { - // If the low element is an undef too, then this whole things is an undef. - if (Node->getOperand(0).getOpcode() == ISD::UNDEF) - return DAG.getUNDEF(VT); - // Otherwise, turn this into a scalar_to_vector node. + if (!Value1.getNode()) + return DAG.getUNDEF(VT); + + if (isOnlyLowElement) return DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, Node->getOperand(0)); - } // If all elements are constants, create a load from the constant pool. if (isConstant) { @@ -1852,59 +1845,25 @@ SDValue SelectionDAGLegalize::ExpandBUIL false, Alignment); } - if (SplatValue.getNode()) { // Splat of one value? - // Build the shuffle constant vector: <0, 0, 0, 0> - SmallVector ZeroVec(NumElems, 0); - - // If the target supports VECTOR_SHUFFLE and this shuffle mask, use it. - if (TLI.isShuffleMaskLegal(ZeroVec, Node->getValueType(0))) { + if (!MoreThanTwoValues) { + SmallVector ShuffleVec(NumElems, -1); + for (unsigned i = 0; i < NumElems; ++i) { + SDValue V = Node->getOperand(i); + if (V.getOpcode() == ISD::UNDEF) + continue; + ShuffleVec[i] = V == Value1 ? 0 : NumElems; + } + if (TLI.isShuffleMaskLegal(ShuffleVec, Node->getValueType(0))) { // Get the splatted value into the low element of a vector register. - SDValue LowValVec = - DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, SplatValue); + SDValue Vec1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, Value1); + SDValue Vec2; + if (Value2.getNode()) + Vec2 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, Value2); + else + Vec2 = DAG.getUNDEF(VT); // Return shuffle(LowValVec, undef, <0,0,0,0>) - return DAG.getVectorShuffle(VT, dl, LowValVec, DAG.getUNDEF(VT), - &ZeroVec[0]); - } - } - - // If there are only two unique elements, we may be able to turn this into a - // vector shuffle. - if (Values.size() == 2) { - // Get the two values in deterministic order. - SDValue Val1 = Node->getOperand(1); - SDValue Val2; - std::map >::iterator MI = Values.begin(); - if (MI->first != Val1) - Val2 = MI->first; - else - Val2 = (++MI)->first; - - // If Val1 is an undef, make sure it ends up as Val2, to ensure that our - // vector shuffle has the undef vector on the RHS. - if (Val1.getOpcode() == ISD::UNDEF) - std::swap(Val1, Val2); - - // Build the shuffle constant vector: e.g. <0, 4, 0, 4> - SmallVector ShuffleMask(NumElems, -1); - - // Set elements of the shuffle mask for Val1. - std::vector &Val1Elts = Values[Val1]; - for (unsigned i = 0, e = Val1Elts.size(); i != e; ++i) - ShuffleMask[Val1Elts[i]] = 0; - - // Set elements of the shuffle mask for Val2. - std::vector &Val2Elts = Values[Val2]; - for (unsigned i = 0, e = Val2Elts.size(); i != e; ++i) - if (Val2.getOpcode() != ISD::UNDEF) - ShuffleMask[Val2Elts[i]] = NumElems; - - // If the target supports SCALAR_TO_VECTOR and this shuffle mask, use it. - if (TLI.isOperationLegalOrCustom(ISD::SCALAR_TO_VECTOR, VT) && - TLI.isShuffleMaskLegal(ShuffleMask, VT)) { - Val1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, Val1); - Val2 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, VT, Val2); - return DAG.getVectorShuffle(VT, dl, Val1, Val2, &ShuffleMask[0]); + return DAG.getVectorShuffle(VT, dl, Vec1, Vec2, ShuffleVec.data()); } } Modified: vendor/llvm/dist/lib/Target/PowerPC/PPCInstrAltivec.td ============================================================================== --- vendor/llvm/dist/lib/Target/PowerPC/PPCInstrAltivec.td Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Target/PowerPC/PPCInstrAltivec.td Sun Jun 7 09:21:09 2009 (r193630) @@ -666,3 +666,25 @@ def : Pat<(int_ppc_altivec_vnmsubfp VRRC def : Pat<(PPCvperm (v16i8 VRRC:$vA), VRRC:$vB, VRRC:$vC), (VPERM VRRC:$vA, VRRC:$vB, VRRC:$vC)>; + +// Vector shifts +def : Pat<(v16i8 (shl (v16i8 VRRC:$vA), (v16i8 VRRC:$vB))), + (v16i8 (VSLB VRRC:$vA, VRRC:$vB))>; +def : Pat<(v8i16 (shl (v8i16 VRRC:$vA), (v8i16 VRRC:$vB))), + (v8i16 (VSLH VRRC:$vA, VRRC:$vB))>; +def : Pat<(v4i32 (shl (v4i32 VRRC:$vA), (v4i32 VRRC:$vB))), + (v4i32 (VSLW VRRC:$vA, VRRC:$vB))>; + +def : Pat<(v16i8 (srl (v16i8 VRRC:$vA), (v16i8 VRRC:$vB))), + (v16i8 (VSRB VRRC:$vA, VRRC:$vB))>; +def : Pat<(v8i16 (srl (v8i16 VRRC:$vA), (v8i16 VRRC:$vB))), + (v8i16 (VSRH VRRC:$vA, VRRC:$vB))>; +def : Pat<(v4i32 (srl (v4i32 VRRC:$vA), (v4i32 VRRC:$vB))), + (v4i32 (VSRW VRRC:$vA, VRRC:$vB))>; + +def : Pat<(v16i8 (sra (v16i8 VRRC:$vA), (v16i8 VRRC:$vB))), + (v16i8 (VSRAB VRRC:$vA, VRRC:$vB))>; +def : Pat<(v8i16 (sra (v8i16 VRRC:$vA), (v8i16 VRRC:$vB))), + (v8i16 (VSRAH VRRC:$vA, VRRC:$vB))>; +def : Pat<(v4i32 (sra (v4i32 VRRC:$vA), (v4i32 VRRC:$vB))), + (v4i32 (VSRAW VRRC:$vA, VRRC:$vB))>; Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -7691,13 +7691,15 @@ static bool isBaseAlignmentOfN(unsigned } static bool EltsFromConsecutiveLoads(ShuffleVectorSDNode *N, unsigned NumElems, - MVT EVT, SDNode *&Base, + MVT EVT, LoadSDNode *&LDBase, + unsigned &LastLoadedElt, SelectionDAG &DAG, MachineFrameInfo *MFI, const TargetLowering &TLI) { - Base = NULL; + LDBase = NULL; + LastLoadedElt = -1; for (unsigned i = 0; i < NumElems; ++i) { if (N->getMaskElt(i) < 0) { - if (!Base) + if (!LDBase) return false; continue; } @@ -7706,19 +7708,20 @@ static bool EltsFromConsecutiveLoads(Shu if (!Elt.getNode() || (Elt.getOpcode() != ISD::UNDEF && !ISD::isNON_EXTLoad(Elt.getNode()))) return false; - if (!Base) { - Base = Elt.getNode(); - if (Base->getOpcode() == ISD::UNDEF) + if (!LDBase) { + if (Elt.getNode()->getOpcode() == ISD::UNDEF) return false; + LDBase = cast(Elt.getNode()); + LastLoadedElt = i; continue; } if (Elt.getOpcode() == ISD::UNDEF) continue; LoadSDNode *LD = cast(Elt); - LoadSDNode *LDBase = cast(Base); if (!TLI.isConsecutiveLoad(LD, LDBase, EVT.getSizeInBits()/8, i, MFI)) return false; + LastLoadedElt = i; } return true; } @@ -7737,134 +7740,29 @@ static SDValue PerformShuffleCombine(SDN ShuffleVectorSDNode *SVN = cast(N); unsigned NumElems = VT.getVectorNumElements(); - // For x86-32 machines, if we see an insert and then a shuffle in a v2i64 - // where the upper half is 0, it is advantageous to rewrite it as a build - // vector of (0, val) so it can use movq. - if (VT == MVT::v2i64) { - SDValue In[2]; - In[0] = N->getOperand(0); - In[1] = N->getOperand(1); - int Idx0 = SVN->getMaskElt(0); - int Idx1 = SVN->getMaskElt(1); - // FIXME: can we take advantage of undef index? - if (Idx0 >= 0 && Idx1 >= 0 && - In[Idx0/2].getOpcode() == ISD::INSERT_VECTOR_ELT && - In[Idx1/2].getOpcode() == ISD::BUILD_VECTOR) { - ConstantSDNode* InsertVecIdx = - dyn_cast(In[Idx0/2].getOperand(2)); - if (InsertVecIdx && - InsertVecIdx->getZExtValue() == (unsigned)(Idx0 % 2) && - isZeroNode(In[Idx1/2].getOperand(Idx1 % 2))) { - return DAG.getNode(ISD::BUILD_VECTOR, dl, VT, - In[Idx0/2].getOperand(1), - In[Idx1/2].getOperand(Idx1 % 2)); - } - } - } + if (VT.getSizeInBits() != 128) + return SDValue(); // Try to combine a vector_shuffle into a 128-bit load. MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo(); - SDNode *Base = NULL; - if (!EltsFromConsecutiveLoads(SVN, NumElems, EVT, Base, DAG, MFI, TLI)) + LoadSDNode *LD = NULL; + unsigned LastLoadedElt; + if (!EltsFromConsecutiveLoads(SVN, NumElems, EVT, LD, LastLoadedElt, DAG, + MFI, TLI)) return SDValue(); - LoadSDNode *LD = cast(Base); - if (isBaseAlignmentOfN(16, Base->getOperand(1).getNode(), TLI)) + if (LastLoadedElt == NumElems - 1) { + if (isBaseAlignmentOfN(16, LD->getBasePtr().getNode(), TLI)) + return DAG.getLoad(VT, dl, LD->getChain(), LD->getBasePtr(), + LD->getSrcValue(), LD->getSrcValueOffset(), + LD->isVolatile()); return DAG.getLoad(VT, dl, LD->getChain(), LD->getBasePtr(), LD->getSrcValue(), LD->getSrcValueOffset(), - LD->isVolatile()); - return DAG.getLoad(VT, dl, LD->getChain(), LD->getBasePtr(), - LD->getSrcValue(), LD->getSrcValueOffset(), - LD->isVolatile(), LD->getAlignment()); -} - -/// PerformBuildVectorCombine - build_vector 0,(load i64 / f64) -> movq / movsd. -static SDValue PerformBuildVectorCombine(SDNode *N, SelectionDAG &DAG, - TargetLowering::DAGCombinerInfo &DCI, - const X86Subtarget *Subtarget, - const TargetLowering &TLI) { - unsigned NumOps = N->getNumOperands(); - DebugLoc dl = N->getDebugLoc(); - - // Ignore single operand BUILD_VECTOR. - if (NumOps == 1) - return SDValue(); - - MVT VT = N->getValueType(0); - MVT EVT = VT.getVectorElementType(); - - // Before or during type legalization, we want to try and convert a - // build_vector of an i64 load and a zero value into vzext_movl before the - // legalizer can break it up. - // FIXME: does the case below remove the need to do this? - if (DCI.isBeforeLegalize() || DCI.isCalledByLegalizer()) { - if ((EVT != MVT::i64 && EVT != MVT::f64) || Subtarget->is64Bit()) - return SDValue(); - - // This must be an insertion into a zero vector. - SDValue HighElt = N->getOperand(1); - if (!isZeroNode(HighElt)) - return SDValue(); - - // Value must be a load. - SDNode *Base = N->getOperand(0).getNode(); - if (!isa(Base)) { - if (Base->getOpcode() != ISD::BIT_CONVERT) - return SDValue(); - Base = Base->getOperand(0).getNode(); - if (!isa(Base)) - return SDValue(); - } - - // Transform it into VZEXT_LOAD addr. - LoadSDNode *LD = cast(Base); - - // Load must not be an extload. - if (LD->getExtensionType() != ISD::NON_EXTLOAD) - return SDValue(); - - // Load type should legal type so we don't have to legalize it. - if (!TLI.isTypeLegal(VT)) - return SDValue(); - - SDVTList Tys = DAG.getVTList(VT, MVT::Other); - SDValue Ops[] = { LD->getChain(), LD->getBasePtr() }; - SDValue ResNode = DAG.getNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops, 2); - TargetLowering::TargetLoweringOpt TLO(DAG); - TLO.CombineTo(SDValue(Base, 1), ResNode.getValue(1)); - DCI.CommitTargetLoweringOpt(TLO); - return ResNode; - } - - // The type legalizer will have broken apart v2i64 build_vector created during - // widening before the code which handles that case is run. Look for build - // vector (load, load + 4, 0/undef, 0/undef) - if (VT == MVT::v4i32 || VT == MVT::v4f32) { - LoadSDNode *LD0 = dyn_cast(N->getOperand(0)); - LoadSDNode *LD1 = dyn_cast(N->getOperand(1)); - if (!LD0 || !LD1) - return SDValue(); - if (LD0->getExtensionType() != ISD::NON_EXTLOAD || - LD1->getExtensionType() != ISD::NON_EXTLOAD) - return SDValue(); - // Make sure the second elt is a consecutive load. - if (!TLI.isConsecutiveLoad(LD1, LD0, EVT.getSizeInBits()/8, 1, - DAG.getMachineFunction().getFrameInfo())) - return SDValue(); - - SDValue N2 = N->getOperand(2); - SDValue N3 = N->getOperand(3); - if (!isZeroNode(N2) && N2.getOpcode() != ISD::UNDEF) - return SDValue(); - if (!isZeroNode(N3) && N3.getOpcode() != ISD::UNDEF) - return SDValue(); - + LD->isVolatile(), LD->getAlignment()); + } else if (NumElems == 4 && LastLoadedElt == 1) { SDVTList Tys = DAG.getVTList(MVT::v2i64, MVT::Other); - SDValue Ops[] = { LD0->getChain(), LD0->getBasePtr() }; + SDValue Ops[] = { LD->getChain(), LD->getBasePtr() }; SDValue ResNode = DAG.getNode(X86ISD::VZEXT_LOAD, dl, Tys, Ops, 2); - TargetLowering::TargetLoweringOpt TLO(DAG); - TLO.CombineTo(SDValue(LD0, 1), ResNode.getValue(1)); - DCI.CommitTargetLoweringOpt(TLO); return DAG.getNode(ISD::BIT_CONVERT, dl, VT, ResNode); } return SDValue(); @@ -8466,14 +8364,25 @@ static SDValue PerformBTCombine(SDNode * return SDValue(); } +static SDValue PerformVZEXT_MOVLCombine(SDNode *N, SelectionDAG &DAG) { + SDValue Op = N->getOperand(0); + if (Op.getOpcode() == ISD::BIT_CONVERT) + Op = Op.getOperand(0); + MVT VT = N->getValueType(0), OpVT = Op.getValueType(); + if (Op.getOpcode() == X86ISD::VZEXT_LOAD && + VT.getVectorElementType().getSizeInBits() == + OpVT.getVectorElementType().getSizeInBits()) { + return DAG.getNode(ISD::BIT_CONVERT, N->getDebugLoc(), VT, Op); + } + return SDValue(); +} + SDValue X86TargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const { SelectionDAG &DAG = DCI.DAG; switch (N->getOpcode()) { default: break; case ISD::VECTOR_SHUFFLE: return PerformShuffleCombine(N, DAG, *this); - case ISD::BUILD_VECTOR: - return PerformBuildVectorCombine(N, DAG, DCI, Subtarget, *this); case ISD::SELECT: return PerformSELECTCombine(N, DAG, Subtarget); case X86ISD::CMOV: return PerformCMOVCombine(N, DAG, DCI); case ISD::MUL: return PerformMulCombine(N, DAG, DCI); @@ -8485,6 +8394,7 @@ SDValue X86TargetLowering::PerformDAGCom case X86ISD::FOR: return PerformFORCombine(N, DAG); case X86ISD::FAND: return PerformFANDCombine(N, DAG); case X86ISD::BT: return PerformBTCombine(N, DAG, DCI); + case X86ISD::VZEXT_MOVL: return PerformVZEXT_MOVLCombine(N, DAG); } return SDValue(); Modified: vendor/llvm/dist/lib/Transforms/IPO/GlobalOpt.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/IPO/GlobalOpt.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Transforms/IPO/GlobalOpt.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -932,8 +932,7 @@ static bool ValueIsOnlyUsedLocallyOrStor GlobalVariable *GV, SmallPtrSet &PHIs) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ - Instruction *Inst = dyn_cast(*UI); - if (Inst == 0) return false; + Instruction *Inst = cast(*UI); if (isa(Inst) || isa(Inst)) { continue; // Fine, ignore. Modified: vendor/llvm/dist/lib/Transforms/IPO/IPConstantPropagation.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/IPO/IPConstantPropagation.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Transforms/IPO/IPConstantPropagation.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -241,15 +241,11 @@ bool IPCP::PropagateConstantReturn(Funct for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); I != E;) { - Instruction *Ins = dyn_cast(*I); + Instruction *Ins = cast(*I); // Increment now, so we can remove the use ++I; - // Not an instruction? Ignore - if (!Ins) - continue; - // Find the index of the retval to replace with int index = -1; if (ExtractValueInst *EV = dyn_cast(Ins)) Modified: vendor/llvm/dist/lib/Transforms/Scalar/InstructionCombining.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -12579,6 +12579,12 @@ Instruction *InstCombiner::visitInsertEl } } + unsigned VWidth = cast(VecOp->getType())->getNumElements(); + APInt UndefElts(VWidth, 0); + APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth)); + if (SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts)) + return &IE; + return 0; } Modified: vendor/llvm/dist/lib/Transforms/Scalar/PredicateSimplifier.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -1525,12 +1525,12 @@ namespace { Instruction *I2 = dyn_cast(R); if (I2 && below(I2)) { std::vector ToNotify; - for (Value::use_iterator UI = R->use_begin(), UE = R->use_end(); + for (Value::use_iterator UI = I2->use_begin(), UE = I2->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast(TheUse.getUser())) - ToNotify.push_back(I); + Instruction *I = cast(TheUse.getUser()); + ToNotify.push_back(I); } DOUT << "Simply removing " << *I2 @@ -1658,10 +1658,9 @@ namespace { ++UI; Value *V = TheUse.getUser(); if (!V->use_empty()) { - if (Instruction *Inst = dyn_cast(V)) { - if (aboveOrBelow(Inst)) - opsToDef(Inst); - } + Instruction *Inst = cast(V); + if (aboveOrBelow(Inst)) + opsToDef(Inst); } } } @@ -2262,10 +2261,9 @@ namespace { UE = O.LHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast(TheUse.getUser())) { - if (aboveOrBelow(I)) - opsToDef(I); - } + Instruction *I = cast(TheUse.getUser()); + if (aboveOrBelow(I)) + opsToDef(I); } } if (Instruction *I2 = dyn_cast(O.RHS)) { @@ -2277,10 +2275,9 @@ namespace { UE = O.RHS->use_end(); UI != UE;) { Use &TheUse = UI.getUse(); ++UI; - if (Instruction *I = dyn_cast(TheUse.getUser())) { - if (aboveOrBelow(I)) - opsToDef(I); - } + Instruction *I = cast(TheUse.getUser()); + if (aboveOrBelow(I)) + opsToDef(I); } } } Modified: vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp Sun Jun 7 09:06:21 2009 (r193629) +++ vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp Sun Jun 7 09:21:09 2009 (r193630) @@ -639,8 +639,8 @@ void SCCPSolver::visitReturnInst(ReturnI DenseMap, LatticeVal>::iterator It = TrackedMultipleRetVals.find(std::make_pair(F, i)); if (It == TrackedMultipleRetVals.end()) break; - Value *Val = FindInsertedValue(I.getOperand(0), i); - mergeInValue(It->second, F, getValueState(Val)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***