[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerGC.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 17:30:07 PDT 2004
Changes in directory llvm/lib/Transforms/Scalar:
LowerGC.cpp updated: 1.2 -> 1.3
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
---
Diffs of the changes: (+3 -3)
Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.2 llvm/lib/Transforms/Scalar/LowerGC.cpp:1.3
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.2 Sun May 23 16:27:29 2004
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp Sat Jul 17 19:29:57 2004
@@ -140,7 +140,8 @@
/// 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 @@
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.
More information about the llvm-commits
mailing list