llvm/llvm/test/Transforms/SCCP/divrem-crash.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=ipsccp -S < %s | FileCheck %s

@g = internal global i32 42, align 4

define i32 @sdiv_const_undef() {
; CHECK-LABEL: @sdiv_const_undef(
; CHECK-NEXT:    [[D:%.*]] = sdiv i32 42, poison
; CHECK-NEXT:    ret i32 [[D]]
;
  %i = load i32, ptr @g, align 4
  %d = sdiv i32 %i, poison
  ret i32 %d
}

define i32 @sdiv_undef_const() {
; CHECK-LABEL: @sdiv_undef_const(
; CHECK-NEXT:    [[D:%.*]] = sdiv i32 poison, 42
; CHECK-NEXT:    ret i32 [[D]]
;
  %i = load i32, ptr @g, align 4
  %d = sdiv i32 poison, %i
  ret i32 %d
}