mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
Fix some minor issues folding undef, PR2052
llvm-svn: 47314
This commit is contained in:
parent
6bb889cf84
commit
85482657eb
@ -175,7 +175,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
|
||||
if (isa<UndefValue>(V)) {
|
||||
// zext(undef) = 0, because the top bits will be zero.
|
||||
// sext(undef) = 0, because the top bits will all be the same.
|
||||
if (opc == Instruction::ZExt || opc == Instruction::SExt)
|
||||
// [us]itofp(undef) = 0, because the result value is bounded.
|
||||
if (opc == Instruction::ZExt || opc == Instruction::SExt ||
|
||||
opc == Instruction::UIToFP || opc == Instruction::SIToFP)
|
||||
return Constant::getNullValue(DestTy);
|
||||
return UndefValue::get(DestTy);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user