projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f009483
)
Don't create usless casts for same-bith-width floating point casts.
author
Reid Spencer
<rspencer@reidspencer.com>
Tue, 12 Dec 2006 05:38:50 +0000
(
05:38
+0000)
committer
Reid Spencer
<rspencer@reidspencer.com>
Tue, 12 Dec 2006 05:38:50 +0000
(
05:38
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32475
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/Constants.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/Constants.cpp
b/lib/VMCore/Constants.cpp
index 2aa0524dfd0565abb0827e8326dec291a558269c..710b738cd245f90ead5ce21c0531259061b7ea8e 100644
(file)
--- a/
lib/VMCore/Constants.cpp
+++ b/
lib/VMCore/Constants.cpp
@@
-1531,9
+1531,10
@@
Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) {
"Invalid cast");
unsigned SrcBits = C->getType()->getPrimitiveSizeInBits();
unsigned DstBits = Ty->getPrimitiveSizeInBits();
+ if (SrcBits == DstBits)
+ return C; // Avoid a useless cast
Instruction::CastOps opcode =
- (SrcBits == DstBits ? Instruction::BitCast :
- (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
+ (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt);
return getCast(opcode, C, Ty);
}