mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
[InstCombine] Use a more targeted fix instead of r235544
Only clear out the NSW/NUW flags if we are optimizing 'add'/'sub' while taking advantage that the sign bit is not set. We do this optimization to further shrink the mask but shrinking the mask isn't NSW/NUW preserving in this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1125,3 +1125,15 @@ define i1 @PR23309(i32 %A, i32 %B) {
|
||||
%trunc = trunc i32 %sub to i1
|
||||
ret i1 %trunc
|
||||
}
|
||||
|
||||
define i1 @PR23309v2(i32 %A, i32 %B) {
|
||||
; CHECK-LABEL: @PR23309v2(
|
||||
; CHECK-NEXT: %[[sub:.*]] = add i32 %A, %B
|
||||
; CHECK-NEXT: %[[and:.*]] = and i32 %[[sub]], 1
|
||||
; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32 %[[and]], 0
|
||||
; CHECK-NEXT: ret i1 %[[cmp]]
|
||||
%add = add i32 %A, -4
|
||||
%sub = add nuw i32 %add, %B
|
||||
%trunc = trunc i32 %sub to i1
|
||||
ret i1 %trunc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user