mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 03:29:40 +00:00
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47793 91177308-0d34-0410-b5e6-96231b3b80d8
18 lines
798 B
LLVM
18 lines
798 B
LLVM
; This entire chain of computation should be optimized away, but
|
|
; wasn't because the two multiplies were not detected as being identical.
|
|
;
|
|
; RUN: llvm-as < %s | opt -gcse -instcombine -dce | \
|
|
; RUN: llvm-dis | not grep sub
|
|
|
|
define i32 @vnum_test4(i32* %data) {
|
|
%idx1 = getelementptr i32* %data, i64 1 ; <i32*> [#uses=1]
|
|
%idx2 = getelementptr i32* %data, i64 3 ; <i32*> [#uses=1]
|
|
%reg1101 = load i32* %idx1 ; <i32> [#uses=2]
|
|
%reg1111 = load i32* %idx2 ; <i32> [#uses=2]
|
|
%reg109 = mul i32 %reg1101, %reg1111 ; <i32> [#uses=1]
|
|
%reg108 = mul i32 %reg1111, %reg1101 ; <i32> [#uses=1]
|
|
%reg121 = sub i32 %reg108, %reg109 ; <i32> [#uses=1]
|
|
ret i32 %reg121
|
|
}
|
|
|