[llvm-commits] [llvm] r85137 - /llvm/trunk/include/llvm/Support/TargetFolder.h
Dan Gohman
gohman at apple.com
Mon Oct 26 11:36:40 PDT 2009
Author: djg
Date: Mon Oct 26 13:36:40 2009
New Revision: 85137
URL: http://llvm.org/viewvc/llvm-project?rev=85137&view=rev
Log:
Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
for consistency with ConstantFolder.
Modified:
llvm/trunk/include/llvm/Support/TargetFolder.h
Modified: llvm/trunk/include/llvm/Support/TargetFolder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetFolder.h?rev=85137&r1=85136&r2=85137&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TargetFolder.h (original)
+++ llvm/trunk/include/llvm/Support/TargetFolder.h Mon Oct 26 13:36:40 2009
@@ -179,6 +179,16 @@
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
More information about the llvm-commits
mailing list