diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-08-31 09:58:37 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-08-31 09:58:37 +0000 |
| commit | b9e668f2e738b639baeb502e5005e69f1c10eee7 (patch) | |
| tree | 7a56eb67115456c591b40c689f2f1ec9d58f42fc /llvm/lib/Transforms | |
| parent | 04a4c0910b08fcd3961ad8cc74f99535efdee39a (diff) | |
| download | bcm5719-llvm-b9e668f2e738b639baeb502e5005e69f1c10eee7.tar.gz bcm5719-llvm-b9e668f2e738b639baeb502e5005e69f1c10eee7.zip | |
[CVP] Generate simpler code for elided with.overflow intrinsics
Use a { iN undef, i1 false } struct as the base, and only insert
the first operand, instead of using { iN undef, i1 undef } as the
base and inserting both. This is the same as what we do in InstCombine.
Differential Revision: https://reviews.llvm.org/D67034
llvm-svn: 370573
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp index 5629debe802..66335ed6ce5 100644 --- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp +++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp @@ -417,6 +417,7 @@ static bool willNotOverflow(BinaryOpIntrinsic *BO, LazyValueInfo *LVI) { return NWRegion.contains(LRange); } +// Rewrite this with.overflow intrinsic as non-overflowing. static void processOverflowIntrinsic(WithOverflowInst *WO) { IRBuilder<> B(WO); Value *NewOp = B.CreateBinOp( @@ -429,8 +430,11 @@ static void processOverflowIntrinsic(WithOverflowInst *WO) { Inst->setHasNoUnsignedWrap(); } - Value *NewI = B.CreateInsertValue(UndefValue::get(WO->getType()), NewOp, 0); - NewI = B.CreateInsertValue(NewI, ConstantInt::getFalse(WO->getContext()), 1); + StructType *ST = cast<StructType>(WO->getType()); + Constant *Struct = ConstantStruct::get(ST, + { UndefValue::get(ST->getElementType(0)), + ConstantInt::getFalse(ST->getElementType(1)) }); + Value *NewI = B.CreateInsertValue(Struct, NewOp, 0); WO->replaceAllUsesWith(NewI); WO->eraseFromParent(); ++NumOverflows; |

