Index: include/llvm/IR/Operator.h =================================================================== --- include/llvm/IR/Operator.h +++ include/llvm/IR/Operator.h @@ -364,19 +364,26 @@ /// precision. float getFPAccuracy() const; - static bool classof(const Instruction *I) { - return I->getType()->isFPOrFPVectorTy() || - I->getOpcode() == Instruction::FCmp; - } - - static bool classof(const ConstantExpr *CE) { - return CE->getType()->isFPOrFPVectorTy() || - CE->getOpcode() == Instruction::FCmp; - } - static bool classof(const Value *V) { - return (isa(V) && classof(cast(V))) || - (isa(V) && classof(cast(V))); + unsigned Opcode; + if (auto *I = dyn_cast(V)) + Opcode = I->getOpcode(); + else if (auto *CE = dyn_cast(V)) + Opcode = CE->getOpcode(); + else + return false; + + switch (Opcode) { + case Instruction::FCmp: + return true; + // non math FP Operators (no FMF) + case Instruction::ExtractElement: + case Instruction::ShuffleVector: + case Instruction::InsertElement: + return false; + default: + return V->getType()->isFPOrFPVectorTy(); + } } }; Index: test/CodeGen/X86/intersect-fma-fmf.ll =================================================================== --- test/CodeGen/X86/intersect-fma-fmf.ll +++ test/CodeGen/X86/intersect-fma-fmf.ll @@ -3,8 +3,7 @@ define float @test_x86_fma_intersection_fmf(float %a, float %b) { ; CHECK-LABEL: test_x86_fma_intersection_fmf: ; CHECK: # %bb.0: -; CHECK: vmulss {{[0-9]+}}(%esp), %xmm0, %xmm1 -; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0 +; CHECK: vfmadd132ss {{[0-9]+}}(%esp), %xmm0, %xmm0 ; CHECK: retl %tmp8 = fmul fast float %a, %b %tmp9 = fadd fast float %tmp8, %b