From 7f26e26d0c424df277a231484190a7be84d28c3f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 15 Jun 2016 16:47:23 +0000 Subject: [PATCH] [TargetLibraryInfo] Teach isValidProtoForLibFunc about tan We would fail to validate the type of the tan function which would cause downstream users of isValidProtoForLibFunc to assert. This fixes PR28143. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272802 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/TargetLibraryInfo.cpp | 3 +++ test/Transforms/InstCombine/pr28143.ll | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/Transforms/InstCombine/pr28143.ll diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp index 789b0396e0b..f70b438a06b 100644 --- a/lib/Analysis/TargetLibraryInfo.cpp +++ b/lib/Analysis/TargetLibraryInfo.cpp @@ -897,6 +897,9 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy, case LibFunc::cos: case LibFunc::cosf: case LibFunc::cosl: + case LibFunc::tan: + case LibFunc::tanf: + case LibFunc::tanl: case LibFunc::exp: case LibFunc::expf: case LibFunc::expl: diff --git a/test/Transforms/InstCombine/pr28143.ll b/test/Transforms/InstCombine/pr28143.ll new file mode 100644 index 00000000000..9ef273e5ed4 --- /dev/null +++ b/test/Transforms/InstCombine/pr28143.ll @@ -0,0 +1,12 @@ +; RUN: opt -S -instcombine < %s | FileCheck %s + +define void @test1() { +entry: + call void @tan() + ret void +} +; CHECK-LABEL: define void @test1( +; CHECK: call void @tan() +; CHECK-NEXT: ret void + +declare void @tan() -- 2.11.0