mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
27bd9b361b
The code was actually correct. Sorry for the confusion. I have expanded the comment saying why the analysis is valid to avoid me misunderstaning it again in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210052 91177308-0d34-0410-b5e6-96231b3b80d8
17 lines
443 B
LLVM
17 lines
443 B
LLVM
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
; rdar://11748024
|
|
|
|
define i32 @a(i1 zeroext %x, i1 zeroext %y) {
|
|
entry:
|
|
; CHECK-LABEL: @a(
|
|
; CHECK: [[TMP1:%.*]] = sext i1 %y to i32
|
|
; CHECK: [[TMP2:%.*]] = select i1 %x, i32 2, i32 1
|
|
; CHECK-NEXT: add nsw i32 [[TMP2]], [[TMP1]]
|
|
%conv = zext i1 %x to i32
|
|
%conv3 = zext i1 %y to i32
|
|
%conv3.neg = sub i32 0, %conv3
|
|
%sub = add i32 %conv, 1
|
|
%add = add i32 %sub, %conv3.neg
|
|
ret i32 %add
|
|
}
|