diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-26 18:36:40 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-26 18:36:40 +0000 |
commit | e18700a09ac14dc957684472244a2681b536a118 (patch) | |
tree | b94675adc7e8c8928856368fee6a322145f54f47 /include/llvm/Support | |
parent | 91203cf87b8a72227c78a9eeae8bb744dfcc4ef0 (diff) | |
download | external_llvm-e18700a09ac14dc957684472244a2681b536a118.zip external_llvm-e18700a09ac14dc957684472244a2681b536a118.tar.gz external_llvm-e18700a09ac14dc957684472244a2681b536a118.tar.bz2 |
Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
for consistency with ConstantFolder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/TargetFolder.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h index 8e28632..46ad9b6 100644 --- a/include/llvm/Support/TargetFolder.h +++ b/include/llvm/Support/TargetFolder.h @@ -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 |