mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Don't create usless casts for same-bith-width floating point casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f0094839f0
commit
f25212a223
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user