diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-01-19 16:56:10 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-01-19 16:56:10 +0000 |
commit | 2b03d0051f94734e96bc589ba67372e385cd22f8 (patch) | |
tree | 92e7600ad7b7bf3da890de245d89a1db9ec4fc86 /lib/Transforms/InstCombine/InstCombine.h | |
parent | c7645e860af4b88690f740b6e312356b49b656b4 (diff) | |
download | llvm-2b03d0051f94734e96bc589ba67372e385cd22f8.tar.gz llvm-2b03d0051f94734e96bc589ba67372e385cd22f8.tar.bz2 llvm-2b03d0051f94734e96bc589ba67372e385cd22f8.tar.xz |
InstCombine: Hoist 3 copies of AddOne/SubOne into a header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombine.h')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombine.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombine.h b/lib/Transforms/InstCombine/InstCombine.h index ca834c1094..4021f292d9 100644 --- a/lib/Transforms/InstCombine/InstCombine.h +++ b/lib/Transforms/InstCombine/InstCombine.h @@ -51,6 +51,15 @@ static inline unsigned getComplexity(Value *V) { return isa<Constant>(V) ? (isa<UndefValue>(V) ? 0 : 1) : 2; } +/// AddOne - Add one to a Constant +static inline Constant *AddOne(Constant *C) { + return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1)); +} +/// SubOne - Subtract one from a Constant +static inline Constant *SubOne(Constant *C) { + return ConstantExpr::getSub(C, ConstantInt::get(C->getType(), 1)); +} + /// InstCombineIRInserter - This is an IRBuilder insertion helper that works /// just like the normal insertion helper, but also adds any new instructions |