1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/Transforms/Reassociate/min_int.ll
Mehdi Amini 3c8f7ac243 Reassociate: cannot negate a INT_MIN value
Summary:
When trying to canonicalize negative constants out of
multiplication expressions, we need to check that the
constant is not INT_MIN which cannot be negated.

Reviewers: mcrosier

Reviewed By: mcrosier

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7286

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 228872
2015-02-11 19:54:44 +00:00

14 lines
315 B
LLVM

; RUN: opt < %s -reassociate -dce -S | FileCheck %s
; MIN_INT cannot be negated during reassociation
define i32 @minint(i32 %i) {
; CHECK: %mul = mul i32 %i, -2147483648
; CHECK-NEXT: %add = add i32 %mul, 1
; CHECK-NEXT: ret i32 %add
%mul = mul i32 %i, -2147483648
%add = add i32 %mul, 1
ret i32 %add
}