mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
23af697ae6
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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228872 91177308-0d34-0410-b5e6-96231b3b80d8
14 lines
315 B
LLVM
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
|
|
}
|
|
|