mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Refactor creation of overflow result tuples in InstCombineCalls.
Extract the creation of overflow result tuples in a separate function. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user