More code cleanup [NFC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Philip Reames 2015-03-27 05:47:00 +00:00
parent de15c8edbc
commit 1f768e83c0

View File

@ -299,12 +299,6 @@ analyzeParsePointLiveness(DominatorTree &DT, const CallSite &CS,
result.liveset = liveset; result.liveset = liveset;
} }
/// True iff this value is the null pointer constant (of any pointer type)
static bool LLVM_ATTRIBUTE_UNUSED isNullConstant(Value *V) {
return isa<Constant>(V) && isa<PointerType>(V->getType()) &&
cast<Constant>(V)->isNullValue();
}
/// Helper function for findBasePointer - Will return a value which either a) /// Helper function for findBasePointer - Will return a value which either a)
/// defines the base pointer for the input or b) blocks the simple search /// defines the base pointer for the input or b) blocks the simple search
/// (i.e. a PHI or Select of two derived pointers) /// (i.e. a PHI or Select of two derived pointers)
@ -346,9 +340,8 @@ static Value *findBaseDefiningValue(Value *I) {
// off a potentially null value and have proven it null. We also use // off a potentially null value and have proven it null. We also use
// null pointers in dead paths of relocation phis (which we might later // null pointers in dead paths of relocation phis (which we might later
// want to find a base pointer for). // want to find a base pointer for).
assert(Con->getType()->isPointerTy() && assert(isa<ConstantPointerNull>(Con) &&
"Base for pointer must be another pointer"); "null is the only case which makes sense");
assert(Con->isNullValue() && "null is the only case which makes sense");
return Con; return Con;
} }
@ -941,10 +934,10 @@ static void findBasePointers(const StatepointLiveSetTy &live,
// If you see this trip and like to live really dangerously, the code should // If you see this trip and like to live really dangerously, the code should
// be correct, just with idioms the verifier can't handle. You can try // be correct, just with idioms the verifier can't handle. You can try
// disabling the verifier at your own substaintial risk. // disabling the verifier at your own substaintial risk.
assert(!isNullConstant(base) && "the relocation code needs adjustment to " assert(!isa<ConstantPointerNull>(base) &&
"handle the relocation of a null pointer " "the relocation code needs adjustment to handle the relocation of "
"constant without causing false positives " "a null pointer constant without causing false positives in the "
"in the safepoint ir verifier."); "safepoint ir verifier.");
} }
} }
@ -1547,7 +1540,7 @@ static void relocationViaAlloca(
} }
} else { } else {
assert((isa<Argument>(def) || isa<GlobalVariable>(def) || assert((isa<Argument>(def) || isa<GlobalVariable>(def) ||
(isa<Constant>(def) && cast<Constant>(def)->isNullValue())) && isa<ConstantPointerNull>(def)) &&
"Must be argument or global"); "Must be argument or global");
store->insertAfter(cast<Instruction>(alloca)); store->insertAfter(cast<Instruction>(alloca));
} }