Index: llvm/trunk/include/llvm/IR/Operator.h =================================================================== --- llvm/trunk/include/llvm/IR/Operator.h +++ llvm/trunk/include/llvm/IR/Operator.h @@ -328,8 +328,15 @@ return I->getType()->isFPOrFPVectorTy() || I->getOpcode() == Instruction::FCmp; } + + static inline bool classof(const ConstantExpr *CE) { + return CE->getType()->isFPOrFPVectorTy() || + CE->getOpcode() == Instruction::FCmp; + } + static inline bool classof(const Value *V) { - return isa(V) && classof(cast(V)); + return (isa(V) && classof(cast(V))) || + (isa(V) && classof(cast(V))); } }; Index: llvm/trunk/test/Transforms/InstCombine/pr33453.ll =================================================================== --- llvm/trunk/test/Transforms/InstCombine/pr33453.ll +++ llvm/trunk/test/Transforms/InstCombine/pr33453.ll @@ -0,0 +1,15 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -instcombine -S %s | FileCheck %s + +@g1 = external global i16 +@g2 = external global i16 + +define float @patatino() { +; CHECK-LABEL: @patatino( +; CHECK-NEXT: ret float fmul (float uitofp (i1 icmp eq (i16* getelementptr inbounds (i16, i16* @g2, i64 1), i16* @g1) to float), float uitofp (i1 icmp eq (i16* getelementptr inbounds (i16, i16* @g2, i64 1), i16* @g1) to float)) +; + %call = call float @fabsf(float fmul (float uitofp (i1 icmp eq (i16* getelementptr inbounds (i16, i16* @g2, i64 1), i16* @g1) to float), float uitofp (i1 icmp eq (i16* getelementptr inbounds (i16, i16* @g2, i64 1), i16* @g1) to float))) + ret float %call +} + +declare float @fabsf(float)