Skip to content

Commit f51a584

Browse files
committed
[LV][VPlan] Change the inheritance of class VPWidenSelectRecipe to class VPRecipeWithIRFlags, which allows recipe of the select to pass the fastmath flags
The patch of #119847 will add the fastmath flag to for recipe
1 parent 229e1af commit f51a584

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,10 @@ class VPHistogramRecipe : public VPRecipeBase {
18071807
};
18081808

18091809
/// A recipe for widening select instructions.
1810-
struct VPWidenSelectRecipe : public VPSingleDefRecipe {
1810+
struct VPWidenSelectRecipe : public VPRecipeWithIRFlags {
18111811
template <typename IterT>
18121812
VPWidenSelectRecipe(SelectInst &I, iterator_range<IterT> Operands)
1813-
: VPSingleDefRecipe(VPDef::VPWidenSelectSC, Operands, &I,
1814-
I.getDebugLoc()) {}
1813+
: VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I) {}
18151814

18161815
~VPWidenSelectRecipe() override = default;
18171816

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ void VPWidenSelectRecipe::print(raw_ostream &O, const Twine &Indent,
11711171
O << Indent << "WIDEN-SELECT ";
11721172
printAsOperand(O, SlotTracker);
11731173
O << " = select ";
1174+
printFlags(O);
11741175
getOperand(0)->printAsOperand(O, SlotTracker);
11751176
O << ", ";
11761177
getOperand(1)->printAsOperand(O, SlotTracker);

llvm/test/Transforms/LoopVectorize/select-with-Fastflags.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ define void @select_with_fastmath_flags(ptr noalias %a, ptr noalias %b, ptr noal
2222
; FAST-NEXT: WIDEN ir<[[LD2:%.+]]> = load vp<[[PTR2]]>
2323
; FAST-NEXT: WIDEN ir<[[FCMP:%.+]]> = fcmp ogt ir<[[LD1]]>, ir<[[LD2]]>
2424
; FAST-NEXT: WIDEN ir<[[FADD:%.+]]> = fadd reassoc nnan ninf nsz arcp contract afn ir<[[LD1]]>, ir<1.000000e+01>
25-
; FAST-NEXT: WIDEN-SELECT ir<[[SELECT:%.+]]> = select ir<[[FCMP]]>, ir<[[FADD]]>, ir<[[LD2]]>
25+
; FAST-NEXT: WIDEN-SELECT ir<[[SELECT:%.+]]> = select reassoc nnan ninf nsz arcp contract afn ir<[[FCMP]]>, ir<[[FADD]]>, ir<[[LD2]]>
2626
; FAST-NEXT: CLONE ir<[[GEP3:%.+]]> = getelementptr inbounds nuw ir<%a>, vp<[[ST]]>
2727
; FAST-NEXT: vp<[[PTR3:%.+]]> = vector-pointer ir<[[GEP3]]>
2828
; FAST-NEXT: WIDEN store vp<[[PTR3]]>, ir<[[SELECT]]>

0 commit comments

Comments
 (0)