[llvm] [InstCombine] Combine trunc (lshr X, BW-1) to i1 --> icmp slt X, 0 (#142593) (PR #143846)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 02:17:45 PDT 2025


================
@@ -0,0 +1,103 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+define i1 @foo_pos1(i32 %i, ptr %p) {
+; CHECK-LABEL: define i1 @foo_pos1(
+; CHECK-SAME: i32 [[I:%.*]], ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[COMMON_RET1:.*:]]
+; CHECK-NEXT:    [[DOTLOBIT:%.*]] = lshr i32 [[I]], 31
+; CHECK-NEXT:    store i32 [[DOTLOBIT]], ptr [[P]], align 1
+; CHECK-NEXT:    ret i1 false
+;
+common.ret1:
----------------
RKSimon wrote:

drop the (unnecessary) labels

https://github.com/llvm/llvm-project/pull/143846


More information about the llvm-commits mailing list