diff options
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index 4c14715b758..d3a75123935 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -2342,11 +2342,15 @@ int X86TTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm,        return TTI::TCC_Free;      ImmIdx = 1;      break; -  case Instruction::Mul:    case Instruction::UDiv:    case Instruction::SDiv:    case Instruction::URem:    case Instruction::SRem: +    // Division by constant is typically expanded later into a different +    // instruction sequence. This completely changes the constants. +    // Report them as "free" to stop ConstantHoist from marking them as opaque. +    return TTI::TCC_Free; +  case Instruction::Mul:    case Instruction::Or:    case Instruction::Xor:      ImmIdx = 1; | 

