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
960 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=instcombine -S %s | FileCheck %s
@A = extern_weak global i32, align 4
@B = extern_weak global i32, align 4
define i32 @foo(i1 %which, ptr %dst) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 true, label [[FINAL:%.*]], label [[DELAY:%.*]]
; CHECK: delay:
; CHECK-NEXT: br label [[FINAL]]
; CHECK: final:
; CHECK-NEXT: store i1 false, ptr [[DST:%.*]], align 1
; CHECK-NEXT: ret i32 1
;
entry:
br i1 true, label %final, label %delay
delay: ; preds = %entry
%cmp = icmp eq ptr @A, @B
br label %final
final: ; preds = %delay, %entry
%use2 = phi i1 [ false, %entry ], [ %cmp, %delay ]
%value = select i1 %use2, i32 2, i32 1
%B7 = mul i32 %value, 2147483647
%C3 = icmp ule i32 %B7, 0
store i1 %C3, ptr %dst
ret i32 %value
}