File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
test/Transforms/Scalarizer Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1084,6 +1084,17 @@ bool ScalarizerVisitor::visitExtractValueInst(ExtractValueInst &EVI) {
10841084 ValueVector Res;
10851085 if (!isStructOfMatchingFixedVectors (OpTy))
10861086 return false ;
1087+ if (CallInst *CI = dyn_cast<CallInst>(Op)) {
1088+ Function *F = CI->getCalledFunction ();
1089+ if (!F)
1090+ return false ;
1091+ Intrinsic::ID ID = F->getIntrinsicID ();
1092+ if (ID == Intrinsic::not_intrinsic || !isTriviallyScalarizable (ID))
1093+ return false ;
1094+ // Note: Fall through means Operand is a`CallInst` and it is defined in
1095+ // `isTriviallyScalarizable`.
1096+ } else
1097+ return false ;
10871098 Type *VecType = cast<FixedVectorType>(OpTy->getContainedType (0 ));
10881099 std::optional<VectorSplit> VS = getVectorSplit (VecType);
10891100 if (!VS)
Original file line number Diff line number Diff line change 1+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+ ; RUN: opt %s -passes='function(scalarizer)' -S | FileCheck %s
3+
4+ ; Test to make sure that struct return intrinsics that are not `isTriviallyScalarizable` do not get scalarized.
5+
6+ define <3 x i32 > @test_ (<3 x i32 > %a , <3 x i32 > %b ) {
7+ ; CHECK-LABEL: define <3 x i32> @test_(
8+ ; CHECK-SAME: <3 x i32> [[A:%.*]], <3 x i32> [[B:%.*]]) {
9+ ; CHECK-NEXT: [[R:%.*]] = call { <3 x i32>, <3 x i1> } @llvm.uadd.with.overflow.v3i32(<3 x i32> [[B]], <3 x i32> [[B]])
10+ ; CHECK-NEXT: [[EL:%.*]] = extractvalue { <3 x i32>, <3 x i1> } [[R]], 0
11+ ; CHECK-NEXT: ret <3 x i32> [[EL]]
12+ ;
13+ %r = call { <3 x i32 >, <3 x i1 > } @llvm.uadd.with.overflow.v3i32 (<3 x i32 > %b , <3 x i32 > %b )
14+ %el = extractvalue { <3 x i32 >, <3 x i1 > } %r , 0
15+ ret <3 x i32 > %el
16+ }
You can’t perform that action at this time.
0 commit comments