Nikita Popov deab451e7a
[IR] Remove support for icmp and fcmp constant expressions (#93038)
Remove support for the icmp and fcmp constant expressions.

This is part of:
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179

As usual, many of the updated tests will no longer test what they were
originally intended to -- this is hard to preserve when constant
expressions get removed, and in many cases just impossible as the
existence of a specific kind of constant expression was the cause of the
issue in the first place.
2024-06-04 08:31:03 +02:00

32 lines
635 B
LLVM

; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare i32 @f32(ptr, ptr)
declare i32 @f64(ptr, ptr)
define i1 @icmp_func() {
; CHECK-LABEL: @icmp_func(
; CHECK: ret i1 false
%cmp = icmp eq ptr @f32, @f64
ret i1 %cmp
}
define i1 @icmp_fptr(ptr) {
; CHECK-LABEL: @icmp_fptr(
; CHECK: %cmp = icmp ne ptr %0, @f32
; CHECK: ret i1 %cmp
%cmp = icmp ne ptr @f32, %0
ret i1 %cmp
}
@b = external global i32
define i32 @icmp_glob(i32 %x, i32 %y) {
; CHECK-LABEL: define i32 @icmp_glob(i32 %x, i32 %y)
; CHECK-NEXT: ret i32 %y
;
%cmp = icmp eq ptr @icmp_glob, @b
%sel = select i1 %cmp, i32 %x, i32 %y
ret i32 %sel
}