llvm.org GIT mirror llvm / 033c772
Merging r341416: ------------------------------------------------------------------------ r341416 | annat | 2018-09-05 00:12:23 +0200 (Wed, 05 Sep 2018) | 11 lines [LV] First order recurrence phis should not be treated as uniform This is fix for PR38786. First order recurrence phis were incorrectly treated as uniform, which caused them to be vectorized as uniform instructions. Patch by Ayal Zaks and Orivej Desh! Reviewed by: Anna Differential Revision: https://reviews.llvm.org/D51639 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@341523 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 2 years ago
2 changed file(s) with 29 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
45094509 for (auto OV : I->operand_values()) {
45104510 if (isOutOfScope(OV))
45114511 continue;
4512 // First order recurrence Phi's should typically be considered
4513 // non-uniform.
4514 auto *OP = dyn_cast(OV);
4515 if (OP && Legal->isFirstOrderRecurrence(OP))
4516 continue;
4517 // If all the users of the operand are uniform, then add the
4518 // operand into the uniform worklist.
45124519 auto *OI = cast(OV);
45134520 if (llvm::all_of(OI->users(), [&](User *U) -> bool {
45144521 auto *J = cast(U);
7474 ret i64 %retval
7575 }
7676
77 ; CHECK-LABEL: PR38786
78 ; Check that first order recurrence phis (%phi32 and %phi64) are not uniform.
79 ; CHECK-NOT: LV: Found uniform instruction: %phi
80 define void @PR38786(double* %y, double* %x, i64 %n) {
81 entry:
82 br label %for.body
83
84 for.body:
85 %phi32 = phi i32 [ 0, %entry ], [ %i32next, %for.body ]
86 %phi64 = phi i64 [ 0, %entry ], [ %i64next, %for.body ]
87 %i32next = add i32 %phi32, 1
88 %i64next = zext i32 %i32next to i64
89 %xip = getelementptr inbounds double, double* %x, i64 %i64next
90 %yip = getelementptr inbounds double, double* %y, i64 %phi64
91 %xi = load double, double* %xip, align 8
92 store double %xi, double* %yip, align 8
93 %cmp = icmp slt i64 %i64next, %n
94 br i1 %cmp, label %for.body, label %for.end
95
96 for.end:
97 ret void
98 }