From af4521393e8cef240b17307d091b51ea3670aaa7 Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Fri, 28 Jun 2019 19:57:31 +0000 Subject: [PATCH] [GVNSink] Add unary FNeg support to GVNSink pass Differential Revision: https://reviews.llvm.org/D63900 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364678 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVNSink.cpp | 1 + test/Transforms/GVNSink/fpmath.ll | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/GVNSink.cpp b/lib/Transforms/Scalar/GVNSink.cpp index 735f68329af..054025755c6 100644 --- a/lib/Transforms/Scalar/GVNSink.cpp +++ b/lib/Transforms/Scalar/GVNSink.cpp @@ -441,6 +441,7 @@ public: break; case Instruction::Call: case Instruction::Invoke: + case Instruction::FNeg: case Instruction::Add: case Instruction::FAdd: case Instruction::Sub: diff --git a/test/Transforms/GVNSink/fpmath.ll b/test/Transforms/GVNSink/fpmath.ll index 15d86845e0d..69e3a2471e7 100644 --- a/test/Transforms/GVNSink/fpmath.ll +++ b/test/Transforms/GVNSink/fpmath.ll @@ -1,8 +1,9 @@ ; RUN: opt -S < %s -gvn-sink | FileCheck %s ; CHECK-LABEL: sink -; CHECK: fneg +; CHECK-NOT: fneg ; CHECK: = phi +; CHECK: fneg define float @sink(float %a, float %b, i1 %cmp) { entry: br i1 %cmp, label %if.then, label %if.else -- 2.50.0