mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
eb2be34094
Particularly, it addresses cases where Reassociate breaks Subtracts but then fails to optimize combinations like I1 + -I2 where I1 and I2 have the same rank and are identical. Patch by Dmitri Shtilman. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219092 91177308-0d34-0410-b5e6-96231b3b80d8
16 lines
310 B
LLVM
16 lines
310 B
LLVM
; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
|
|
|
|
; Test that we can turn things like A*B + X - A*B -> X.
|
|
|
|
define i32 @test1(i32 %a, i32 %b, i32 %x) {
|
|
; CHECK-LABEL: test1
|
|
; CHECK: ret i32 %x
|
|
|
|
%c = mul i32 %a, %b
|
|
%d = add i32 %c, %x
|
|
%c1 = mul i32 %a, %b
|
|
%f = sub i32 %d, %c1
|
|
ret i32 %f
|
|
}
|
|
|