From 5466d0bac4d8df259c03a6559f1d6176e116df55 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 12 Feb 2019 21:49:56 +0000 Subject: [PATCH] [ConstProp] add test for miscompile from bitcast transform; NFC This problem goes with the fix in D51215. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353883 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/ConstProp/bitcast.ll | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll index 5e1581d801c..353062ee3fe 100644 --- a/test/Transforms/ConstProp/bitcast.ll +++ b/test/Transforms/ConstProp/bitcast.ll @@ -1,10 +1,24 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -constprop -S | FileCheck %s ; PR2165 define <1 x i64> @test1() { +; CHECK-LABEL: @test1( +; CHECK-NEXT: ret <1 x i64> +; %A = bitcast i64 63 to <1 x i64> ret <1 x i64> %A -; CHECK-LABEL: @test1( -; CHECK: ret <1 x i64> } +; FIXME: Don't try to propagate an FP source operand to an icmp. + +@a = external global i16, align 1 +@b = external global i16, align 1 + +define i1 @bad_icmp_constexpr_bitcast() { +; CHECK-LABEL: @bad_icmp_constexpr_bitcast( +; CHECK-NEXT: ret i1 icmp eq (float bitcast (i32 ptrtoint (i16* @a to i32) to float), float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.000000e+00)) +; + %cmp = icmp eq i32 ptrtoint (i16* @a to i32), bitcast (float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.0) to i32) + ret i1 %cmp +} -- 2.40.0