diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:29:57 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:29:57 +0000 |
commit | 48dc46a5122ab3c957733f77231a6d7c8e9405c9 (patch) | |
tree | 612633b5dbb66ff6e18d9aa0fc4c1671a8f4800a /lib/Transforms/Scalar/LowerGC.cpp | |
parent | 0c4a0418d3f73ec373977b28e06920b5046f2727 (diff) |
bug 122:
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LowerGC.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LowerGC.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index 98ff0428f6..ce67d0e7a1 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<Constant>(I->getOperand(OpNum))) + Constant *C = dyn_cast<Constant>(I->getOperand(OpNum)); + if (C && !isa<GlobalValue>(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<Constant>(GCRoots[i]->getOperand(2)) || - isa<GlobalValue>(GCRoots[i]->getOperand(2))); + assert(isa<Constant>(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. |