[llvm] r353883 - [ConstProp] add test for miscompile from bitcast transform; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 12 13:49:56 PST 2019


Author: spatel
Date: Tue Feb 12 13:49:56 2019
New Revision: 353883

URL: http://llvm.org/viewvc/llvm-project?rev=353883&view=rev
Log:
[ConstProp] add test for miscompile from bitcast transform; NFC

This problem goes with the fix in D51215.

Modified:
    llvm/trunk/test/Transforms/ConstProp/bitcast.ll

Modified: llvm/trunk/test/Transforms/ConstProp/bitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstProp/bitcast.ll?rev=353883&r1=353882&r2=353883&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ConstProp/bitcast.ll (original)
+++ llvm/trunk/test/Transforms/ConstProp/bitcast.ll Tue Feb 12 13:49:56 2019
@@ -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> <i64 63>
+;
   %A = bitcast i64 63 to <1 x i64>
   ret <1 x i64> %A
-; CHECK-LABEL: @test1(
-; CHECK: ret <1 x i64> <i64 63>
 }
 
+; FIXME: Don't try to propagate an FP source operand to an icmp.
+
+ at a = external global i16, align 1
+ at 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
+}




More information about the llvm-commits mailing list