forked from OSchip/llvm-project
Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
for consistency with ConstantFolder. llvm-svn: 85137
This commit is contained in:
parent
722cedfb0d
commit
be881ee758
|
@ -179,6 +179,16 @@ public:
|
|||
Constant *CreatePtrToInt(Constant *C, const Type *DestTy) const {
|
||||
return CreateCast(Instruction::PtrToInt, C, DestTy);
|
||||
}
|
||||
Constant *CreateZExtOrBitCast(Constant *C, const Type *DestTy) const {
|
||||
if (C->getType() == DestTy)
|
||||
return C; // avoid calling Fold
|
||||
return Fold(ConstantExpr::getZExtOrBitCast(C, DestTy));
|
||||
}
|
||||
Constant *CreateSExtOrBitCast(Constant *C, const Type *DestTy) const {
|
||||
if (C->getType() == DestTy)
|
||||
return C; // avoid calling Fold
|
||||
return Fold(ConstantExpr::getSExtOrBitCast(C, DestTy));
|
||||
}
|
||||
Constant *CreateTruncOrBitCast(Constant *C, const Type *DestTy) const {
|
||||
if (C->getType() == DestTy)
|
||||
return C; // avoid calling Fold
|
||||
|
|
Loading…
Reference in New Issue