mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
[InstCombine] Generalize sub of selects optimization to all BinaryOperators
This exposes further optimization opportunities if the selects are correlated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -395,3 +395,13 @@ define i8 @add_of_mul(i8 %x, i8 %y, i8 %z) {
|
||||
%sum = add nsw i8 %mA, %mB
|
||||
ret i8 %sum
|
||||
}
|
||||
|
||||
define i32 @add_of_selects(i1 %A, i32 %B) {
|
||||
%sel0 = select i1 %A, i32 0, i32 -2
|
||||
%sel1 = select i1 %A, i32 %B, i32 2
|
||||
%add = add i32 %sel0, %sel1
|
||||
ret i32 %add
|
||||
; CHECK-LABEL: @add_of_selects(
|
||||
; CHECK-NEXT: %[[sel:.*]] = select i1 %A, i32 %B, i32 0
|
||||
; CHECK-NEXT: ret i32 %[[sel]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user