Index: llvm/lib/Transforms/Scalar/GVNSink.cpp =================================================================== --- llvm/lib/Transforms/Scalar/GVNSink.cpp +++ llvm/lib/Transforms/Scalar/GVNSink.cpp @@ -441,6 +441,7 @@ break; case Instruction::Call: case Instruction::Invoke: + case Instruction::FNeg: case Instruction::Add: case Instruction::FAdd: case Instruction::Sub: Index: llvm/test/Transforms/GVNSink/fpmath.ll =================================================================== --- llvm/test/Transforms/GVNSink/fpmath.ll +++ llvm/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