From 48dc46a5122ab3c957733f77231a6d7c8e9405c9 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 18 Jul 2004 00:29:57 +0000 Subject: [PATCH] bug 122: - Minimize redundant isa usage - Correct isa for GlobalValue subclass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14946 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/CorrelatedExprs.cpp | 5 +++-- lib/Transforms/Scalar/LowerGC.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index aeeade40cce..9738879e282 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -243,7 +243,7 @@ namespace { void BuildRankMap(Function &F); unsigned getRank(Value *V) const { - if (isa(V) || isa(V)) return 0; + if (isa(V)) return 0; std::map::const_iterator I = RankMap.find(V); if (I != RankMap.end()) return I->second; return 0; // Must be some other global thing @@ -476,7 +476,8 @@ bool CEE::ForwardCorrelatedEdgeDestination(TerminatorInst *TI, unsigned SuccNo, ValueInfo &PredicateVI = NewRI.getValueInfo(BI->getCondition()); if (PredicateVI.getReplacement() && - isa(PredicateVI.getReplacement())) { + isa(PredicateVI.getReplacement()) && + !isa(PredicateVI.getReplacement())) { ConstantBool *CB = cast(PredicateVI.getReplacement()); // Forward to the successor that corresponds to the branch we will take. diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index 98ff0428f67..ce67d0e7a17 100644 --- a/lib/Transforms/Scalar/LowerGC.cpp +++ b/lib/Transforms/Scalar/LowerGC.cpp @@ -140,7 +140,8 @@ bool LowerGC::doInitialization(Module &M) { /// not have the specified type, insert a cast. static void Coerce(Instruction *I, unsigned OpNum, Type *Ty) { if (I->getOperand(OpNum)->getType() != Ty) { - if (Constant *C = dyn_cast(I->getOperand(OpNum))) + Constant *C = dyn_cast(I->getOperand(OpNum)); + if (C && !isa(I->getOperand(OpNum))) I->setOperand(OpNum, ConstantExpr::getCast(C, Ty)); else { CastInst *C = new CastInst(I->getOperand(OpNum), Ty, "", I); @@ -252,8 +253,7 @@ bool LowerGC::runOnFunction(Function &F) { Par[2] = ConstantUInt::get(Type::UIntTy, i); Par[3] = One; Value *MetaDataPtr = new GetElementPtrInst(AI, Par, "MetaDataPtr", IP); - assert(isa(GCRoots[i]->getOperand(2)) || - isa(GCRoots[i]->getOperand(2))); + assert(isa(GCRoots[i]->getOperand(2)) && "Must be a constant"); new StoreInst(GCRoots[i]->getOperand(2), MetaDataPtr, IP); // Initialize the root pointer to null on entry to the function. -- 2.34.1