diff options
| author | Erik Eckstein <eeckstein@apple.com> | 2014-12-11 08:02:30 +0000 |
|---|---|---|
| committer | Erik Eckstein <eeckstein@apple.com> | 2014-12-11 08:02:30 +0000 |
| commit | 096ff7dcd693b3f33771f00b8ead13d4a422864d (patch) | |
| tree | 411dec5cb7dd92332fde8e2d234b810526df0794 /llvm/lib/Transforms/InstCombine/InstCombine.h | |
| parent | 5fcc5abc1f32014b45502860a536dd2ef48966d0 (diff) | |
| download | bcm5719-llvm-096ff7dcd693b3f33771f00b8ead13d4a422864d.tar.gz bcm5719-llvm-096ff7dcd693b3f33771f00b8ead13d4a422864d.zip | |
Refactor creation of overflow result tuples in InstCombineCalls.
Extract the creation of overflow result tuples in a separate function. NFC.
llvm-svn: 224006
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombine.h')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombine.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h index 4ccda4d0150..755de87c53b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombine.h +++ b/llvm/lib/Transforms/InstCombine/InstCombine.h @@ -331,6 +331,20 @@ public: return &I; } + /// Creates a result tuple for an overflow intrinsic \p II with a given + /// \p Result and a constant \p Overflow value. If \p ReUseName is true the + /// \p Result's name is taken from \p II. + Instruction *CreateOverflowTuple(IntrinsicInst *II, Value *Result, + bool Overflow, bool ReUseName = true) { + if (ReUseName) + Result->takeName(II); + Constant *V[] = { UndefValue::get(Result->getType()), + Overflow ? Builder->getTrue() : Builder->getFalse() }; + StructType *ST = cast<StructType>(II->getType()); + Constant *Struct = ConstantStruct::get(ST, V); + return InsertValueInst::Create(Struct, Result, 0); + } + // EraseInstFromFunction - When dealing with an instruction that has side // effects or produces a void value, we can't rely on DCE to delete the // instruction. Instead, visit methods should return the value returned by |

