mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Add a constant folding of casts from zero to zero. Fixes PR9011!
While here, I'd like to complain about how vector is not an aggregate type according to llvm::Type::isAggregateType(), but they're listed under aggregate types in the LangRef and zero vectors are stored as ConstantAggregateZero. llvm-svn: 123956
This commit is contained in:
parent
52fe62c996
commit
50f86f3414
@ -511,10 +511,14 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
||||
return Constant::getNullValue(DestTy);
|
||||
return UndefValue::get(DestTy);
|
||||
}
|
||||
|
||||
// No compile-time operations on this type yet.
|
||||
if (V->getType()->isPPC_FP128Ty() || DestTy->isPPC_FP128Ty())
|
||||
return 0;
|
||||
|
||||
if (V->isNullValue() && !DestTy->isX86_MMXTy())
|
||||
return Constant::getNullValue(DestTy);
|
||||
|
||||
// If the cast operand is a constant expression, there's a few things we can
|
||||
// do to try to simplify it.
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
|
||||
|
@ -65,3 +65,38 @@
|
||||
|
||||
; No check line. This used to crash llvm-as.
|
||||
@T6 = global <2 x i1> fcmp ole (<2 x float> fdiv (<2 x float> undef, <2 x float> <float 1.000000e+00, float 1.000000e+00>), <2 x float> zeroinitializer)
|
||||
|
||||
|
||||
; PR9011
|
||||
|
||||
@pr9011_1 = constant <4 x i32> zext (<4 x i8> zeroinitializer to <4 x i32>)
|
||||
; CHECK: pr9011_1 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_2 = constant <4 x i32> sext (<4 x i8> zeroinitializer to <4 x i32>)
|
||||
; CHECK: pr9011_2 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_3 = constant <4 x i32> bitcast (<16 x i8> zeroinitializer to <4 x i32>)
|
||||
; CHECK: pr9011_3 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_4 = constant <4 x float> uitofp (<4 x i8> zeroinitializer to <4 x float>)
|
||||
; CHECK: pr9011_4 = constant <4 x float> zeroinitializer
|
||||
@pr9011_5 = constant <4 x float> sitofp (<4 x i8> zeroinitializer to <4 x float>)
|
||||
; CHECK: pr9011_5 = constant <4 x float> zeroinitializer
|
||||
@pr9011_6 = constant <4 x i32> fptosi (<4 x float> zeroinitializer to <4 x i32>)
|
||||
; CHECK: pr9011_6 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_7 = constant <4 x i32> fptoui (<4 x float> zeroinitializer to <4 x i32>)
|
||||
; CHECK: pr9011_7 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_8 = constant <4 x float> fptrunc (<4 x double> zeroinitializer to <4 x float>)
|
||||
; CHECK: pr9011_8 = constant <4 x float> zeroinitializer
|
||||
@pr9011_9 = constant <4 x double> fpext (<4 x float> zeroinitializer to <4 x double>)
|
||||
; CHECK: pr9011_9 = constant <4 x double> zeroinitializer
|
||||
|
||||
@pr9011_10 = constant <4 x double> bitcast (i256 0 to <4 x double>)
|
||||
; CHECK: pr9011_10 = constant <4 x double> zeroinitializer
|
||||
@pr9011_11 = constant <4 x float> bitcast (i128 0 to <4 x float>)
|
||||
; CHECK: pr9011_11 = constant <4 x float> zeroinitializer
|
||||
@pr9011_12 = constant <4 x i32> bitcast (i128 0 to <4 x i32>)
|
||||
; CHECK: pr9011_12 = constant <4 x i32> zeroinitializer
|
||||
@pr9011_13 = constant i256 bitcast (<4 x double> zeroinitializer to i256)
|
||||
; CHECK: pr9011_13 = constant i256 0
|
||||
@pr9011_14 = constant i128 bitcast (<4 x float> zeroinitializer to i128)
|
||||
; CHECK: pr9011_14 = constant i128 0
|
||||
@pr9011_15 = constant i128 bitcast (<4 x i32> zeroinitializer to i128)
|
||||
; CHECK: pr9011_15 = constant i128 0
|
||||
|
Loading…
Reference in New Issue
Block a user