Skip to content

Commit a8b32af

Browse files
committed
Update comments and move assertion to a more fitting place
1 parent e9cc989 commit a8b32af

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3763,18 +3763,16 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
37633763
}
37643764
}
37653765

3766-
// Handle the case where a value is multiplied by a power of two.
3767-
// For example:
3768-
// %2 = insertelement <4 x i32> poison, i32 %0, i64 0
3769-
// %3 = shufflevector <4 x i32> %2, poison, <4 x i32> zeroinitializer
3770-
// %4 = tail call i32 @llvm.vector.reduce.add.v4i32(%3)
3766+
// Handle the case where a splat is summarized. In that case we have a
3767+
// multpilication. For example: %2 = insertelement <4 x i32> poison, i32
3768+
// %0, i64 0 %3 = shufflevector <4 x i32> %2, poison, <4 x i32>
3769+
// zeroinitializer %4 = tail call i32 @llvm.vector.reduce.add.v4i32(%3)
37713770
// =>
37723771
// %2 = shl i32 %0, 2
3773-
assert(Arg->getType()->isVectorTy() &&
3774-
"The vector.reduce.add intrinsic's argument must be a vector!");
3775-
37763772
if (Value *Splat = getSplatValue(Arg)) {
37773773
// It is only a multiplication if we add the same element over and over.
3774+
assert(Arg->getType()->isVectorTy() &&
3775+
"The vector.reduce.add intrinsic's argument must be a vector!");
37783776
ElementCount ReducedVectorElementCount =
37793777
static_cast<VectorType *>(Arg->getType())->getElementCount();
37803778
if (ReducedVectorElementCount.isFixed()) {

0 commit comments

Comments
 (0)