[llvm] [InstCombine] Preserve nneg in foldLogicCastConstant (PR #157865)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 10 07:34:08 PDT 2025
================
@@ -2047,3 +2047,69 @@ define i1 @or_truncs(i8 %x) {
%or1 = or i1 %trunc1, %trunc2
ret i1 %or1
}
+
+define i32 @or_zext_constant(i8 %a) {
+; CHECK-LABEL: @or_zext_constant(
+; CHECK-NEXT: [[TMP1:%.*]] = or i8 [[A:%.*]], 1
+; CHECK-NEXT: [[AND:%.*]] = zext i8 [[TMP1]] to i32
+; CHECK-NEXT: ret i32 [[AND]]
+;
+ %zext = zext i8 %a to i32
+ %or = or i32 %zext, 1
+ ret i32 %or
+}
+
+define i32 @or_zext_minus_constant(i8 %a) {
----------------
dtcxzyw wrote:
It is identical to `or_zext_constant`.
https://github.com/llvm/llvm-project/pull/157865
More information about the llvm-commits
mailing list