<commit_before>; RUN: opt -S -instcombine < %s | FileCheck %s

@g = external global i32

define i1 @test(i32 %other) {
; CHECK-LABEL: @test
; CHECK: %test = icmp sgt i32 %other, 0
  %positive = load i32, i32* @g, !range !{i32 1, i32 2048}
  %cmp = icmp slt i32 %positive, %other
  %sel = select i1 %cmp, i32 %positive, i32 %other
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}

define i1 @test2(i32 %other) {
; CHECK-LABEL: @test2
; CHECK: %test = icmp sgt i32 %other, 0
  %positive = load i32, i32* @g, !range !{i32 1, i32 2048}
  %cmp = icmp slt i32 %other, %positive
  %sel = select i1 %cmp, i32 %other, i32 %positive
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}

; %positive might be zero
define i1 @test3(i32 %other) {
; CHECK-LABEL: @test3
; CHECK: %test = icmp sgt i32 %sel, 0
  %positive = load i32, i32* @g, !range !{i32 0, i32 2048}
  %cmp = icmp slt i32 %positive, %other
  %sel = select i1 %cmp, i32 %positive, i32 %other
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}
<commit_msg>[InstCombine] auto-generate checks<commit_after>; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instcombine < %s | FileCheck %s

@g = external global i32

define i1 @test(i32 %other) {
; CHECK-LABEL: @test(
; CHECK-NEXT:    [[TEST:%.*]] = icmp sgt i32 %other, 0
; CHECK-NEXT:    ret i1 [[TEST]]
;
  %positive = load i32, i32* @g, !range !{i32 1, i32 2048}
  %cmp = icmp slt i32 %positive, %other
  %sel = select i1 %cmp, i32 %positive, i32 %other
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}

define i1 @test2(i32 %other) {
; CHECK-LABEL: @test2(
; CHECK-NEXT:    [[TEST:%.*]] = icmp sgt i32 %other, 0
; CHECK-NEXT:    ret i1 [[TEST]]
;
  %positive = load i32, i32* @g, !range !{i32 1, i32 2048}
  %cmp = icmp slt i32 %other, %positive
  %sel = select i1 %cmp, i32 %other, i32 %positive
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}

; %positive might be zero
define i1 @test3(i32 %other) {
; CHECK-LABEL: @test3(
; CHECK-NEXT:    [[POSITIVE:%.*]] = load i32, i32* @g, align 4, !range !0
; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[POSITIVE]], %other
; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], i32 [[POSITIVE]], i32 %other
; CHECK-NEXT:    [[TEST:%.*]] = icmp sgt i32 [[SEL]], 0
; CHECK-NEXT:    ret i1 [[TEST]]
;
  %positive = load i32, i32* @g, !range !{i32 0, i32 2048}
  %cmp = icmp slt i32 %positive, %other
  %sel = select i1 %cmp, i32 %positive, i32 %other
  %test = icmp sgt i32 %sel, 0
  ret i1 %test
}

{'fraction_non_alphanumeric': 0.16835699797160245, 'fraction_numerical': 0.08438133874239351, 'mean_word_length': 3.4512635379061374, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6950086', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1045, 'n_words': 355}