diff options
author | Kristof Beyls <kristof.beyls@arm.com> | 2012-09-12 11:25:02 +0000 |
---|---|---|
committer | Kristof Beyls <kristof.beyls@arm.com> | 2012-09-12 11:25:02 +0000 |
commit | 789efbad2a7b2c7693a3aee7b6d08806c361538f (patch) | |
tree | 5d559b32046763177db76725be30739339547a6c /test | |
parent | d76f6eadc8c8511e1c5cd089a8a54e429c19aa60 (diff) |
Fix constant folding through bitcasts by no longer relying on undefined behaviour (converting NaN values between float and double).
SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget);
should not be used when Val is not a simple constant (as the comment in
SelectionDAG.h indicates). This patch avoids using this function
when folding an unknown constant through a bitcast, where it cannot be
guaranteed that Val will be a simple constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/ARM/constants.ll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/constants.ll b/test/CodeGen/ARM/constants.ll index 0ac8b48d39..3baa103e3d 100644 --- a/test/CodeGen/ARM/constants.ll +++ b/test/CodeGen/ARM/constants.ll @@ -45,6 +45,16 @@ r: ret void } +define i32 @f8() nounwind { +; Check that constant propagation through (i32)-1 => (float)Nan => (i32)-1 +; gives expected result +; CHECK: f8 +; CHECK: mvn r0, #0 + %tmp0 = bitcast i32 -1 to float + %tmp1 = bitcast float %tmp0 to i32 + ret i32 %tmp1 +} + %t1 = type { <3 x float>, <3 x float> } @const1 = global %t1 { <3 x float> zeroinitializer, |