mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +00:00
[Reassociate] Canonicalize negative constants out of expressions.
This is a reapplication of r221171, but we only perform the transformation on expressions which include a multiplication. We do not transform rem/div operations as this doesn't appear to be safe in all cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
; CHECK-LABEL: @shl_to_mul_nsw(
|
||||
; CHECK: %mul = mul i32 %i, -2147483648
|
||||
; CHECK: %mul2 = add i32 %mul, 1
|
||||
; CHECK: add i32 %mul, 1
|
||||
define i32 @shl_to_mul_nsw(i32 %i) {
|
||||
entry:
|
||||
%mul = shl nsw i32 %i, 31
|
||||
@@ -15,7 +15,7 @@ entry:
|
||||
|
||||
; CHECK-LABEL: @shl_to_mul_nuw(
|
||||
; CHECK: %mul = mul nuw i32 %i, 4
|
||||
; CHECK: %mul2 = add i32 %mul, 1
|
||||
; CHECK: add i32 %mul, 1
|
||||
define i32 @shl_to_mul_nuw(i32 %i) {
|
||||
entry:
|
||||
%mul = shl nuw i32 %i, 2
|
||||
@@ -25,7 +25,7 @@ entry:
|
||||
|
||||
; CHECK-LABEL: @shl_to_mul_nuw_nsw(
|
||||
; CHECK: %mul = mul nuw nsw i32 %i, 4
|
||||
; CHECK: %mul2 = add i32 %mul, 1
|
||||
; CHECK: add i32 %mul, 1
|
||||
define i32 @shl_to_mul_nuw_nsw(i32 %i) {
|
||||
entry:
|
||||
%mul = shl nuw nsw i32 %i, 2
|
||||
|
||||
Reference in New Issue
Block a user