llvm.org GIT mirror llvm / 745921f
[LV] Minor savings to Sink casts to unravel first order recurrence Two minor savings: avoid copying the SinkAfter map and avoid moving a cast if it is not needed. Differential Revision: https://reviews.llvm.org/D36408 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310910 91177308-0d34-0410-b5e6-96231b3b80d8 Ayal Zaks 2 years ago
3 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
564564 auto *I = Phi->user_back();
565565 if (I->isCast() && (I->getParent() == Phi->getParent()) && I->hasOneUse() &&
566566 DT->dominates(Previous, I->user_back())) {
567 SinkAfter[I] = Previous;
567 if (!DT->dominates(Previous, I)) // Otherwise we're good w/o sinking.
568 SinkAfter[I] = Previous;
568569 return true;
569570 }
570571 }
76547654 // 2. Copy and widen instructions from the old loop into the new loop.
76557655
76567656 // Move instructions to handle first-order recurrences.
7657 DenseMap SinkAfter = Legal->getSinkAfter();
7657 DenseMap &SinkAfter = Legal->getSinkAfter();
76587658 for (auto &Entry : SinkAfter) {
76597659 Entry.first->removeFromParent();
76607660 Entry.first->insertAfter(Entry.second);
139139 ; CHECK: vector.body:
140140 ; CHECK: %vector.recur = phi <4 x i16> [ %vector.recur.init, %vector.ph ], [ [[L1:%[a-zA-Z0-9.]+]], %vector.body ]
141141 ; CHECK: [[L1]] = load <4 x i16>
142 ; CHECK: {{.*}} = shufflevector <4 x i16> %vector.recur, <4 x i16> [[L1]], <4 x i32>
142 ; CHECK: [[SHUF:%[a-zA-Z0-9.]+]] = shufflevector <4 x i16> %vector.recur, <4 x i16> [[L1]], <4 x i32>
143 ; Check also that the casts were not moved needlessly.
144 ; CHECK: sitofp <4 x i16> [[L1]] to <4 x double>
145 ; CHECK: sitofp <4 x i16> [[SHUF]] to <4 x double>
143146 ; CHECK: middle.block:
144147 ; CHECK: %vector.recur.extract = extractelement <4 x i16> [[L1]], i32 3
145148 ; CHECK: scalar.ph: