mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-15 14:28:25 +00:00
Remove ExtractGlobalVariable - use StripPointerCasts
instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
33b0b8d242
commit
b4fd45e2fc
@ -2491,27 +2491,10 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
|
||||
}
|
||||
}
|
||||
|
||||
/// ExtractGlobalVariable - If V is a global variable, or a bitcast of one
|
||||
/// (possibly constant folded), return it. Otherwise return NULL.
|
||||
static GlobalVariable *ExtractGlobalVariable (Value *V) {
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
|
||||
return GV;
|
||||
else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
|
||||
if (CE->getOpcode() == Instruction::BitCast)
|
||||
return dyn_cast<GlobalVariable>(CE->getOperand(0));
|
||||
else if (CE->getOpcode() == Instruction::GetElementPtr) {
|
||||
for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i)
|
||||
if (!CE->getOperand(i)->isNullValue())
|
||||
return NULL;
|
||||
return dyn_cast<GlobalVariable>(CE->getOperand(0));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// ExtractTypeInfo - Extracts the type info from a value.
|
||||
/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V.
|
||||
static GlobalVariable *ExtractTypeInfo (Value *V) {
|
||||
GlobalVariable *GV = ExtractGlobalVariable(V);
|
||||
V = IntrinsicInst::StripPointerCasts(V);
|
||||
GlobalVariable *GV = dyn_cast<GlobalVariable>(V);
|
||||
assert (GV || isa<ConstantPointerNull>(V) &&
|
||||
"TypeInfo must be a global variable or NULL");
|
||||
return GV;
|
||||
|
Loading…
x
Reference in New Issue
Block a user