[llvm] r362261 - [CVP] Fix assertion failure on vector with.overflow
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 13:42:07 PDT 2019
Author: nikic
Date: Fri May 31 13:42:07 2019
New Revision: 362261
URL: http://llvm.org/viewvc/llvm-project?rev=362261&view=rev
Log:
[CVP] Fix assertion failure on vector with.overflow
Noticed on D62703. LVI only handles plain integers, not vectors of
integers. This was previously not an issue, because vector support
for with.overflow is only a relatively recent addition.
Modified:
llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/trunk/test/Transforms/CorrelatedValuePropagation/overflows.ll
Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=362261&r1=362260&r2=362261&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Fri May 31 13:42:07 2019
@@ -434,7 +434,7 @@ static bool processCallSite(CallSite CS,
unsigned ArgNo = 0;
if (auto *WO = dyn_cast<WithOverflowInst>(CS.getInstruction())) {
- if (willNotOverflow(WO, LVI)) {
+ if (WO->getLHS()->getType()->isIntegerTy() && willNotOverflow(WO, LVI)) {
processOverflowIntrinsic(WO);
return true;
}
Modified: llvm/trunk/test/Transforms/CorrelatedValuePropagation/overflows.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CorrelatedValuePropagation/overflows.ll?rev=362261&r1=362260&r2=362261&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CorrelatedValuePropagation/overflows.ll (original)
+++ llvm/trunk/test/Transforms/CorrelatedValuePropagation/overflows.ll Fri May 31 13:42:07 2019
@@ -21,6 +21,8 @@ declare { i32, i1 } @llvm.umul.with.over
declare { i8, i1 } @llvm.umul.with.overflow.i8(i8, i8)
+declare { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32>, <2 x i32>)
+
declare i8 @llvm.uadd.sat.i8(i8, i8)
declare i8 @llvm.sadd.sat.i8(i8, i8)
declare i8 @llvm.usub.sat.i8(i8, i8)
@@ -731,6 +733,16 @@ define { i8, i1 } @signed_mul_constant_f
ret { i8, i1 } %mul
}
+define { <2 x i32>, <2 x i1> } @uaddo_vec(<2 x i32> %a) {
+; CHECK-LABEL: @uaddo_vec(
+; CHECK-NEXT: [[ADD:%.*]] = call { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32> [[A:%.*]], <2 x i32> <i32 1, i32 1>)
+; CHECK-NEXT: ret { <2 x i32>, <2 x i1> } [[ADD]]
+;
+ %add = call { <2 x i32>, <2 x i1> } @llvm.uadd.with.overflow.v2i32(<2 x i32> %a, <2 x i32> <i32 1, i32 1>)
+ ret { <2 x i32>, <2 x i1> } %add
+}
+
+
define i8 @uadd_sat_no_overflow(i8 %x) {
; CHECK-LABEL: @uadd_sat_no_overflow(
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], 100
More information about the llvm-commits
mailing list