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 | be881ee75832a7d7479a2b82f0aa569e90531967 (patch) | |
| tree | 0272708498f5805dcdf30eaa2f5e89afa36b998b | |
| parent | 722cedfb0dbb4617d99695b1444b65bc7b796f99 (diff) | |
| download | bcm5719-llvm-be881ee75832a7d7479a2b82f0aa569e90531967.tar.gz bcm5719-llvm-be881ee75832a7d7479a2b82f0aa569e90531967.zip | |
Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
for consistency with ConstantFolder.
llvm-svn: 85137
| -rw-r--r-- | llvm/include/llvm/Support/TargetFolder.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/TargetFolder.h b/llvm/include/llvm/Support/TargetFolder.h index 8e28632b7eb..46ad9b601f7 100644 --- a/llvm/include/llvm/Support/TargetFolder.h +++ b/llvm/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 |

