Generalize the "trunc(ptrtoint(x)) - trunc(ptrtoint(y)) ->

trunc(ptrtoint(x-y))" optimization introduced by Chandler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152626 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2012-03-13 14:07:05 +00:00
parent c347b6f4b6
commit bd0fe56425
3 changed files with 55 additions and 19 deletions

View File

@@ -20,13 +20,14 @@
#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
namespace llvm {
class DominatorTree;
class Instruction;
class Value;
class TargetData;
class TargetLibraryInfo;
template<typename T>
class ArrayRef;
class DominatorTree;
class Instruction;
class TargetData;
class TargetLibraryInfo;
class Type;
class Value;
/// SimplifyAddInst - Given operands for an Add, see if we can
/// fold the result. If not, this returns null.
@@ -158,6 +159,12 @@ namespace llvm {
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyTruncInst - Given operands for an TruncInst, see if we can fold
/// the result. If not, this returns null.
Value *SimplifyTruncInst(Value *Op, Type *Ty, const TargetData *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
//=== Helper functions for higher up the class hierarchy.