1 //===- llvm/Transforms/Utils/BypassSlowDivision.h --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains an optimization for div and rem on architectures that
11 // execute short instructions significantly faster than longer instructions.
12 // For example, on Intel Atom 32-bit divides are slow enough that during
13 // runtime it is profitable to check the value of the operands, and if they are
14 // positive and less than 256 use an unsigned 8-bit divide.
16 //===----------------------------------------------------------------------===//
18 #ifndef TRANSFORMS_UTILS_BYPASSSLOWDIVISION_H
19 #define TRANSFORMS_UTILS_BYPASSSLOWDIVISION_H
21 #include "llvm/Function.h"
25 /// This optimization identifies DIV instructions that can be
26 /// profitably bypassed and carried out with a shorter, faster divide.
27 bool bypassSlowDivision(Function &F,
28 Function::iterator &I,
29 const DenseMap<unsigned int, unsigned int> &BypassWidth);
31 } // End llvm namespace