Test Failure: Transforms/InstCombine/sub-of-negatible.ll

Test source: git

Comments: LLVM PR44185

Log:

Source: <stdin>

----------------------------------------
define i8 @t0(i8 %x) {
%0:
  %t0 = sub i8 %x, 214
  ret i8 %t0
}
=>
define i8 @t0(i8 %x) {
%0:
  %t0 = add i8 %x, 42
  ret i8 %t0
}
Transformation seems to be correct!


----------------------------------------
define i8 @t1(i8 %x, i8 %y) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @t1(i8 %x, i8 %y) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = add i8 %x, %y
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @t2(i8 %x, i8 %y) {
%0:
  %t0 = shl i8 214, %y
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @t2(i8 %x, i8 %y) {
%0:
  %t0.neg = shl i8 42, %y
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @n2(i8 %x, i8 %y) {
%0:
  %t0 = shl i8 214, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @n2(i8 %x, i8 %y) {
%0:
  %t0 = shl i8 214, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t3(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1 = shl i8 %t0, %y
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @t3(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1.neg = shl i8 %z, %y
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n3(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1 = shl i8 %t0, %y
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @n3(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1 = shl i8 %t0, %y
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t4(i8 %x, i1 %y) {
%0:
  %t0 = select i1 %y, i8 214, i8 44
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @t4(i8 %x, i1 %y) {
%0:
  %t0.neg = select i1 %y, i8 42, i8 212
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @select_of_constants_multi_use(i1 %b) {
%0:
  %s = select i1 %b, i8 42, i8 254
  call void @use8(i8 %s)
  %n = sub i8 0, %s
  ret i8 %n
}
=>
define i8 @select_of_constants_multi_use(i1 %b) {
%0:
  %s.neg = select i1 %b, i8 214, i8 2
  %s = select i1 %b, i8 42, i8 254
  call void @use8(i8 %s)
  ret i8 %s.neg
}
Transformation seems to be correct!


----------------------------------------
define i32 @PR52261(i1 %b) {
%0:
  %s = select i1 %b, i32 2, i32 4294967294
  %n = sub nsw i32 0, %s
  %a = and i32 %s, %n
  ret i32 %a
}
=>
define i32 @PR52261(i1 %b) {
%0:
  ret i32 2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n4(i8 %x, i1 %y) {
%0:
  %t0 = select i1 %y, i8 214, i8 44
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @n4(i8 %x, i1 %y) {
%0:
  %t0 = select i1 %y, i8 214, i8 44
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @n5(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = select i1 %y, i8 214, i8 %z
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @n5(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = select i1 %y, i8 214, i8 %z
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t6(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1 = select i1 %y, i8 214, i8 %t0
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @t6(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %z
  call void @use8(i8 %t0)
  %t1.neg = select i1 %y, i8 42, i8 %z
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @t7(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = shl i8 1, %z
  %t1 = select i1 %y, i8 0, i8 %t0
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @t7(i8 %x, i1 %y, i8 %z) {
%0:
  %t0.neg = shl i8 255, %z
  %t1.neg = select i1 %y, i8 0, i8 %t0.neg
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n8(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = shl i8 1, %z
  call void @use8(i8 %t0)
  %t1 = select i1 %y, i8 0, i8 %t0
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @n8(i8 %x, i1 %y, i8 %z) {
%0:
  %t0 = shl i8 1, %z
  call void @use8(i8 %t0)
  %t1 = select i1 %y, i8 0, i8 %t0
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t9(i8 %x, i8 %y) {
%0:
  %t0 = sub i8 %y, %x
  %t1 = sub i8 0, %t0
  ret i8 %t1
}
=>
define i8 @t9(i8 %x, i8 %y) {
%0:
  %t0.neg = sub i8 %x, %y
  ret i8 %t0.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @n10(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 %y, %x
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %t0
  ret i8 %t1
}
=>
define i8 @n10(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 %y, %x
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @neg_of_sub_from_constant(i8 %x) {
%0:
  %s = sub i8 42, %x
  %r = sub i8 0, %s
  ret i8 %r
}
=>
define i8 @neg_of_sub_from_constant(i8 %x) {
%0:
  %s.neg = add i8 %x, 214
  ret i8 %s.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @neg_of_sub_from_constant_multi_use(i8 %x) {
%0:
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  %r = sub i8 0, %s
  ret i8 %r
}
=>
define i8 @neg_of_sub_from_constant_multi_use(i8 %x) {
%0:
  %s.neg = add i8 %x, 214
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  ret i8 %s.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_constant_of_sub_from_constant(i8 %x) {
%0:
  %s = sub i8 42, %x
  %r = sub i8 11, %s
  ret i8 %r
}
=>
define i8 @sub_from_constant_of_sub_from_constant(i8 %x) {
%0:
  %r = add i8 %x, 225
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_constant_of_sub_from_constant_multi_use(i8 %x) {
%0:
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  %r = sub i8 11, %s
  ret i8 %r
}
=>
define i8 @sub_from_constant_of_sub_from_constant_multi_use(i8 %x) {
%0:
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  %r = add i8 %x, 225
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_variable_of_sub_from_constant(i8 %x, i8 %y) {
%0:
  %s = sub i8 42, %x
  %r = sub i8 %y, %s
  ret i8 %r
}
=>
define i8 @sub_from_variable_of_sub_from_constant(i8 %x, i8 %y) {
%0:
  %s.neg = add i8 %x, 214
  %r = add i8 %s.neg, %y
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_variable_of_sub_from_constant_multi_use(i8 %x, i8 %y) {
%0:
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  %r = sub i8 %y, %s
  ret i8 %r
}
=>
define i8 @sub_from_variable_of_sub_from_constant_multi_use(i8 %x, i8 %y) {
%0:
  %s = sub i8 42, %x
  call void @use8(i8 %s)
  %r = sub i8 %y, %s
  ret i8 %r
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t12(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %z
  call void @use8(i8 %t1)
  %t2 = add i8 %t0, %t1
  %t3 = sub i8 %x, %t2
  ret i8 %t3
}
=>
define i8 @t12(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %z
  call void @use8(i8 %t1)
  %1 = add i8 %y, %z
  %t3 = add i8 %1, %x
  ret i8 %t3
}
Transformation seems to be correct!


----------------------------------------
define i8 @n13(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = add i8 %t0, %z
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @n13(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1.neg = sub i8 %y, %z
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n14(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %z
  call void @use8(i8 %t1)
  %t2 = add i8 %t0, %t1
  call void @use8(i8 %t2)
  %t3 = sub i8 %x, %t2
  ret i8 %t3
}
=>
define i8 @n14(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %z
  call void @use8(i8 %t1)
  %1 = add i8 %y, %z
  %t2 = sub i8 0, %1
  call void @use8(i8 %t2)
  %t3 = add i8 %1, %x
  ret i8 %t3
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @neg_of_add_with_constant(i8 %x) {
%0:
  %s = add i8 %x, 42
  %r = sub i8 0, %s
  ret i8 %r
}
=>
define i8 @neg_of_add_with_constant(i8 %x) {
%0:
  %r = sub i8 214, %x
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @neg_of_add_with_constant_multi_use(i8 %x) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 0, %s
  ret i8 %r
}
=>
define i8 @neg_of_add_with_constant_multi_use(i8 %x) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 214, %x
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_constant_of_add_with_constant(i8 %x) {
%0:
  %s = add i8 %x, 42
  %r = sub i8 11, %s
  ret i8 %r
}
=>
define i8 @sub_from_constant_of_add_with_constant(i8 %x) {
%0:
  %r = sub i8 225, %x
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_constant_of_add_with_constant_multi_use(i8 %x) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 11, %s
  ret i8 %r
}
=>
define i8 @sub_from_constant_of_add_with_constant_multi_use(i8 %x) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 225, %x
  ret i8 %r
}
Transformation seems to be correct!


----------------------------------------
define i8 @sub_from_variable_of_add_with_constant(i8 %x, i8 %y) {
%0:
  %s = add i8 %x, 42
  %r = sub i8 %y, %s
  ret i8 %r
}
=>
define i8 @sub_from_variable_of_add_with_constant(i8 %x, i8 %y) {
%0:
  %s = add i8 %x, 42
  %r = sub i8 %y, %s
  ret i8 %r
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @sub_from_variable_of_add_with_constant_multi_use(i8 %x, i8 %y) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 %y, %s
  ret i8 %r
}
=>
define i8 @sub_from_variable_of_add_with_constant_multi_use(i8 %x, i8 %y) {
%0:
  %s = add i8 %x, 42
  call void @use8(i8 %s)
  %r = sub i8 %y, %s
  ret i8 %r
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t15(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = mul i8 %t0, %z
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @t15(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1.neg = mul i8 %y, %z
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n16(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = mul i8 %t0, %z
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @n16(i8 %x, i8 %y, i8 %z) {
%0:
  %t0 = sub i8 0, %y
  call void @use8(i8 %t0)
  %t1 = mul i8 %t0, %z
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @t16(i1 %c, i8 %x) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  %y = sub i8 0, %x
  br label %end

%end:
  %z = phi i8 [ %y, %then ], [ 214, %else ]
  %n = sub i8 0, %z
  ret i8 %n
}
=>
define i8 @t16(i1 %c, i8 %x) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  br label %end

%end:
  %z.neg = phi i8 [ %x, %then ], [ 42, %else ]
  ret i8 %z.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @n17(i1 %c, i8 %x) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  %y = sub i8 0, %x
  br label %end

%end:
  %z = phi i8 [ %y, %then ], [ 214, %else ]
  call void @use8(i8 %z)
  %n = sub i8 0, %z
  ret i8 %n
}
=>
define i8 @n17(i1 %c, i8 %x) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  %y = sub i8 0, %x
  br label %end

%end:
  %z = phi i8 [ %y, %then ], [ 214, %else ]
  call void @use8(i8 %z)
  %n = sub i8 0, %z
  ret i8 %n
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @n19(i1 %c, i8 %x, i8 %y) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  %z = sub i8 0, %x
  br label %end

%end:
  %r = phi i8 [ %z, %then ], [ %y, %else ]
  %n = sub i8 0, %r
  ret i8 %n
}
=>
define i8 @n19(i1 %c, i8 %x, i8 %y) {
%begin:
  br i1 %c, label %then, label %else

%else:
  br label %end

%then:
  %z = sub i8 0, %x
  br label %end

%end:
  %r = phi i8 [ %z, %then ], [ %y, %else ]
  %n = sub i8 0, %r
  ret i8 %n
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define void @phi_with_duplicate_incoming_basic_blocks(i32 %x, i32 %y, i1 %should_lookup, i32 %z) {
%entry:
  %x_inc = add i32 %x, 1
  br i1 %should_lookup, label %lookup, label %loop

%lookup:
  %to_lookup = phi i32 [ %y, %entry ], [ %negated_metaval, %loop ]
  switch i32 %to_lookup, label %end [
    i32 0, label %loop
    i32 42, label %loop
  ]

%loop:
  %metaval = phi i32 [ %x_inc, %lookup ], [ %x_inc, %lookup ], [ 84, %entry ]
  %negated_metaval = sub i32 0, %metaval
  %repeat = call i1 @use32gen1(i32 %negated_metaval)
  br i1 %repeat, label %lookup, label %end

%end:
  ret void
}
=>
define void @phi_with_duplicate_incoming_basic_blocks(i32 %x, i32 %y, i1 %should_lookup, i32 %z) {
%entry:
  %x_inc.neg = xor i32 %x, 4294967295
  br i1 %should_lookup, label %lookup, label %loop

%lookup:
  %to_lookup = phi i32 [ %y, %entry ], [ %metaval.neg, %loop ]
  switch i32 %to_lookup, label %end [
    i32 0, label %loop
    i32 42, label %loop
  ]

%loop:
  %metaval.neg = phi i32 [ %x_inc.neg, %lookup ], [ %x_inc.neg, %lookup ], [ 4294967212, %entry ]
  %repeat = call i1 @use32gen1(i32 %metaval.neg)
  br i1 %repeat, label %lookup, label %end

%end:
  ret void
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @t20(i8 %x, i16 %y) {
%0:
  %t0 = shl i16 65494, %y
  %t1 = trunc i16 %t0 to i8
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @t20(i8 %x, i16 %y) {
%0:
  %t0.neg = shl i16 42, %y
  %t1.neg = trunc i16 %t0.neg to i8
  %t2 = add i8 %t1.neg, %x
  ret i8 %t2
}
Transformation seems to be correct!


----------------------------------------
define i8 @n21(i8 %x, i16 %y) {
%0:
  %t0 = shl i16 65494, %y
  %t1 = trunc i16 %t0 to i8
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
=>
define i8 @n21(i8 %x, i16 %y) {
%0:
  %t0 = shl i16 65494, %y
  %t1 = trunc i16 %t0 to i8
  call void @use8(i8 %t1)
  %t2 = sub i8 %x, %t1
  ret i8 %t2
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i4 @negate_xor(i4 %x) {
%0:
  %o = xor i4 %x, 5
  %r = sub i4 0, %o
  ret i4 %r
}
=>
define i4 @negate_xor(i4 %x) {
%0:
  %1 = xor i4 %x, 10
  %o.neg = add i4 %1, 1
  ret i4 %o.neg
}
Transformation seems to be correct!


----------------------------------------
define <2 x i4> @negate_xor_vec(<2 x i4> %x) {
%0:
  %o = xor <2 x i4> %x, { 5, 10 }
  %r = sub <2 x i4> { 0, 0 }, %o
  ret <2 x i4> %r
}
=>
define <2 x i4> @negate_xor_vec(<2 x i4> %x) {
%0:
  %1 = xor <2 x i4> %x, { 10, 5 }
  %o.neg = add <2 x i4> %1, { 1, 1 }
  ret <2 x i4> %o.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_xor_use(i8 %x) {
%0:
  %o = xor i8 %x, 5
  call void @use8(i8 %o)
  %r = sub i8 0, %o
  ret i8 %r
}
=>
define i8 @negate_xor_use(i8 %x) {
%0:
  %o = xor i8 %x, 5
  call void @use8(i8 %o)
  %r = sub i8 0, %o
  ret i8 %r
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i4 @negate_shl_xor(i4 %x, i4 %y) {
%0:
  %o = xor i4 %x, 5
  %s = shl i4 %o, %y
  %r = sub i4 0, %s
  ret i4 %r
}
=>
define i4 @negate_shl_xor(i4 %x, i4 %y) {
%0:
  %1 = xor i4 %x, 10
  %o.neg = add i4 %1, 1
  %s.neg = shl i4 %o.neg, %y
  ret i4 %s.neg
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_shl_not_uses(i8 %x, i8 %y) {
%0:
  %o = xor i8 %x, 255
  call void @use8(i8 %o)
  %s = shl i8 %o, %y
  %r = sub i8 0, %s
  ret i8 %r
}
=>
define i8 @negate_shl_not_uses(i8 %x, i8 %y) {
%0:
  %o.neg = add i8 %x, 1
  %o = xor i8 %x, 255
  call void @use8(i8 %o)
  %s.neg = shl i8 %o.neg, %y
  ret i8 %s.neg
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define <2 x i4> @negate_mul_not_uses_vec(<2 x i4> %x, <2 x i4> %y) {
%0:
  %o = xor <2 x i4> %x, { 15, 15 }
  call void @use_v2i4(<2 x i4> %o)
  %s = mul <2 x i4> %o, %y
  %r = sub <2 x i4> { 0, 0 }, %s
  ret <2 x i4> %r
}
=>
define <2 x i4> @negate_mul_not_uses_vec(<2 x i4> %x, <2 x i4> %y) {
%0:
  %o.neg = add <2 x i4> %x, { 1, 1 }
  %o = xor <2 x i4> %x, { 15, 15 }
  call void @use_v2i4(<2 x i4> %o)
  %s.neg = mul <2 x i4> %o.neg, %y
  ret <2 x i4> %s.neg
}
Transformation doesn't verify!
ERROR: Timeout


----------------------------------------
define i8 @negate_sdiv(i8 %x, i8 %y) {
%0:
  %t0 = sdiv i8 %y, 42
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_sdiv(i8 %x, i8 %y) {
%0:
  %t0.neg = sdiv i8 %y, 214
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_sdiv_extrause(i8 %x, i8 %y) {
%0:
  %t0 = sdiv i8 %y, 42
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_sdiv_extrause(i8 %x, i8 %y) {
%0:
  %t0 = sdiv i8 %y, 42
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_sdiv_extrause2(i8 %x, i8 %y) {
%0:
  %t0 = sdiv i8 %y, 42
  call void @use8(i8 %t0)
  %t1 = sub i8 0, %t0
  ret i8 %t1
}
=>
define i8 @negate_sdiv_extrause2(i8 %x, i8 %y) {
%0:
  %t0 = sdiv i8 %y, 42
  call void @use8(i8 %t0)
  %t1 = sub nsw i8 0, %t0
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_ashr(i8 %x, i8 %y) {
%0:
  %t0 = ashr i8 %y, 7
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_ashr(i8 %x, i8 %y) {
%0:
  %t0.neg = lshr i8 %y, 7
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_lshr(i8 %x, i8 %y) {
%0:
  %t0 = lshr i8 %y, 7
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_lshr(i8 %x, i8 %y) {
%0:
  %t0.neg = ashr i8 %y, 7
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_ashr_extrause(i8 %x, i8 %y) {
%0:
  %t0 = ashr i8 %y, 7
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_ashr_extrause(i8 %x, i8 %y) {
%0:
  %t0 = ashr i8 %y, 7
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_lshr_extrause(i8 %x, i8 %y) {
%0:
  %t0 = lshr i8 %y, 7
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_lshr_extrause(i8 %x, i8 %y) {
%0:
  %t0 = lshr i8 %y, 7
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_ashr_wrongshift(i8 %x, i8 %y) {
%0:
  %t0 = ashr i8 %y, 6
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_ashr_wrongshift(i8 %x, i8 %y) {
%0:
  %t0 = ashr i8 %y, 6
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_lshr_wrongshift(i8 %x, i8 %y) {
%0:
  %t0 = lshr i8 %y, 6
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_lshr_wrongshift(i8 %x, i8 %y) {
%0:
  %t0 = lshr i8 %y, 6
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_sext(i8 %x, i1 %y) {
%0:
  %t0 = sext i1 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_sext(i8 %x, i1 %y) {
%0:
  %t0.neg = zext i1 %y to i8
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_zext(i8 %x, i1 %y) {
%0:
  %t0 = zext i1 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_zext(i8 %x, i1 %y) {
%0:
  %t0.neg = sext i1 %y to i8
  %t1 = add i8 %t0.neg, %x
  ret i8 %t1
}
Transformation seems to be correct!


----------------------------------------
define i8 @negate_sext_extrause(i8 %x, i1 %y) {
%0:
  %t0 = sext i1 %y to i8
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_sext_extrause(i8 %x, i1 %y) {
%0:
  %t0 = sext i1 %y to i8
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_zext_extrause(i8 %x, i1 %y) {
%0:
  %t0 = zext i1 %y to i8
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_zext_extrause(i8 %x, i1 %y) {
%0:
  %t0 = zext i1 %y to i8
  call void @use8(i8 %t0)
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_sext_wrongwidth(i8 %x, i2 %y) {
%0:
  %t0 = sext i2 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_sext_wrongwidth(i8 %x, i2 %y) {
%0:
  %t0 = sext i2 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define i8 @negate_zext_wrongwidth(i8 %x, i2 %y) {
%0:
  %t0 = zext i2 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
=>
define i8 @negate_zext_wrongwidth(i8 %x, i2 %y) {
%0:
  %t0 = zext i2 %y to i8
  %t1 = sub i8 %x, %t0
  ret i8 %t1
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define <2 x i4> @negate_shufflevector_oneinput_reverse(<2 x i4> %x, <2 x i4> %y) {
%0:
  %t0 = shl <2 x i4> { 10, 5 }, %x
  %t1 = shufflevector <2 x i4> %t0, <2 x i4> undef, 1, 0
  %t2 = sub <2 x i4> %y, %t1
  ret <2 x i4> %t2
}
=>
define <2 x i4> @negate_shufflevector_oneinput_reverse(<2 x i4> %x, <2 x i4> %y) {
%0:
  %t0.neg = shl <2 x i4> { 6, 11 }, %x
  %t1.neg = shufflevector <2 x i4> %t0.neg, <2 x i4> undef, 1, 0
  %t2 = add <2 x i4> %t1.neg, %y
  ret <2 x i4> %t2
}
Transformation seems to be correct!


----------------------------------------
define <2 x i4> @negate_shufflevector_oneinput_second_lane_is_undef(<2 x i4> %x, <2 x i4> %y) {
%0:
  %t0 = shl <2 x i4> { 10, 5 }, %x
  %t1 = shufflevector <2 x i4> %t0, <2 x i4> undef, 0, 2
  %t2 = sub <2 x i4> %y, %t1
  ret <2 x i4> %t2
}
=>
define <2 x i4> @negate_shufflevector_oneinput_second_lane_is_undef(<2 x i4> %x, <2 x i4> %y) {
%0:
  %t0.neg = shl <2 x i4> { 6, 11 }, %x
  %t1.neg = shufflevector <2 x i4> %t0.neg, <2 x i4> undef, 0, 4294967295
  %t2 = add <2 x i4> %t1.neg, %y
  ret <2 x i4> %t2
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source

Example:
<2 x i4> %x = < poison, poison >
<2 x i4> %y = < poison, #x0 (0)	[based on undef value] >

Source:
<2 x i4> %t0 = < poison, poison >
<2 x i4> %t1 = < poison, #x0 (0)	[based on undef value] >
<2 x i4> %t2 = < poison, #x0 (0) >

Target:
<2 x i4> %t0.neg = < poison, poison >
<2 x i4> %t1.neg = < poison, poison >
<2 x i4> %t2 = < poison, poison >
Source value: < poison, #x0 (0) >
Target value: < poison, poison >


------------------- SMT STATS -------------------
Num queries: 237
Num invalid: 0
Num skips:   0
Num trivial: 100 (29.7%)
Num timeout: 4 (1.7%)
Num errors:  0 (0.0%)
Num SAT:     123 (51.9%)
Num UNSAT:   110 (46.4%)
Alive2: Transform doesn't verify; aborting!

stderr:

+ : 'RUN: at line 2'
+ /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S
+ /tmp/nlopes/llvm/build/bin/FileCheck /tmp/nlopes/llvm/llvm/test/Transforms/InstCombine/sub-of-negatible.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /tmp/nlopes/llvm/build/bin/FileCheck /tmp/nlopes/llvm/llvm/test/Transforms/InstCombine/sub-of-negatible.ll

 

<-- Back