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

29 lines
964 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=instcombine %s | FileCheck %s
@a = common global i8 0, align 1
@b = external global i32
define void @tinkywinky() {
; CHECK-LABEL: @tinkywinky(
; CHECK-NEXT: [[PATATINO:%.*]] = load i8, ptr @a, align 1
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i8 [[PATATINO]], 0
; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr @a, @b
; CHECK-NEXT: [[XOR1:%.*]] = or i1 [[CMP]], [[TOBOOL_NOT]]
; CHECK-NEXT: [[XOR:%.*]] = zext i1 [[XOR1]] to i32
; CHECK-NEXT: [[OR:%.*]] = or disjoint i32 [[XOR]], 2
; CHECK-NEXT: store i32 [[OR]], ptr @b, align 4
; CHECK-NEXT: ret void
;
%patatino = load i8, ptr @a
%tobool = icmp ne i8 %patatino, 0
%lnot = xor i1 %tobool, true
%lnot.ext = zext i1 %lnot to i32
%cmp = icmp ne ptr @a, @b
%zext = zext i1 %cmp to i32
%xor = xor i32 %zext, 2
%or = or i32 %xor, %lnot.ext
store i32 %or, ptr @b, align 4
ret void
}