1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Transforms/InstCombine/constant-fold-libfunc.ll
Florian Hahn 283961f4c8 [Local] Treat calls that may not return as being alive.
With the addition of the `willreturn` attribute, functions that may
not return (e.g. due to an infinite loop) are well defined, if they are
not marked as `willreturn`.

This patch updates `wouldInstructionBeTriviallyDead` to not consider
calls that may not return as dead.

This patch still provides an escape hatch for intrinsics, which are
still assumed as willreturn unconditionally. It will be removed once
all intrinsics definitions have been reviewed and updated.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94106
2021-01-23 16:05:14 +00:00

32 lines
916 B
LLVM

; RUN: opt < %s -instcombine -S | FileCheck %s
declare double @acos(double) willreturn
; Check that functions without any function attributes are simplified.
define double @test_simplify_acos() {
; CHECK-LABEL: @test_simplify_acos
%pi = call double @acos(double -1.000000e+00)
; CHECK-NOT: call double @acos
; CHECK: ret double 0x400921FB54442D18
ret double %pi
}
; Check that we don't constant fold builtin functions.
define double @test_acos_nobuiltin() {
; CHECK-LABEL: @test_acos_nobuiltin
%pi = call double @acos(double -1.000000e+00) nobuiltin
; CHECK: call double @acos(double -1.000000e+00)
ret double %pi
}
; Check that we don't constant fold strictfp results that require rounding.
define double @test_acos_strictfp() strictfp {
; CHECK-LABEL: @test_acos_strictfp
%pi = call double @acos(double -1.000000e+00) strictfp
; CHECK: call double @acos(double -1.000000e+00)
ret double %pi
}