[llvm] [InstCombine] Remove one-use requirement for add iN (sext i1 X), (sext i1 Y) --> sext (X | Y) to iN (PR #90509)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 1 05:26:49 PDT 2024
================
@@ -1435,34 +1435,52 @@ define i32 @and31_add_sexts(i1 %x, i1 %y) {
ret i32 %r
}
-; Negative test - extra use
+declare void @use_sexts(i32, i32)
-define i32 @lshr_add_use_sexts(i1 %x, i1 %y, ptr %p) {
-; CHECK-LABEL: @lshr_add_use_sexts(
+; Negative test
+define i32 @lshr_add_use_sexts_both(i1 %x, i1 %y, ptr %p) {
+; CHECK-LABEL: @lshr_add_use_sexts_both(
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
; CHECK-NEXT: store i32 [[XS]], ptr [[P:%.*]], align 4
; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
+; CHECK-NEXT: call void @use_sexts(i32 [[XS]], i32 [[YS]])
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31
; CHECK-NEXT: ret i32 [[R]]
;
%xs = sext i1 %x to i32
store i32 %xs, ptr %p
----------------
AtariDreams wrote:
I thought I did by having this use function take 2 arguments?
https://github.com/llvm/llvm-project/pull/90509
More information about the llvm-commits
mailing list