-
Notifications
You must be signed in to change notification settings - Fork 14k
[LV][VPlan] Add fast flags for selectRecipe #121023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-transforms Author: LiqinWeng (LiqinWeng) ChangesThe patch of #119847 will add the fastmath flag to for recipe Full diff: https://github.com/llvm/llvm-project/pull/121023.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 6486c6745a6800..4f457e9876358b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1813,11 +1813,10 @@ class VPHistogramRecipe : public VPRecipeBase {
};
/// A recipe for widening select instructions.
-struct VPWidenSelectRecipe : public VPSingleDefRecipe {
+struct VPWidenSelectRecipe : public VPRecipeWithIRFlags {
template <typename IterT>
VPWidenSelectRecipe(SelectInst &I, iterator_range<IterT> Operands)
- : VPSingleDefRecipe(VPDef::VPWidenSelectSC, Operands, &I,
- I.getDebugLoc()) {}
+ : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I) {}
~VPWidenSelectRecipe() override = default;
|
@Mel-Chen :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test case with a select with fast-math flags?
23ee671
to
f51a584
Compare
done, pls give me LG:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to call setFlags() in execute()?
15c3b5d
to
c372a26
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Change the inheritance of class VPWidenSelectRecipe to class VPRecipeWithIRFlags, which allows recipe of the select to pass the fastmath flags The patch of llvm#119847 will add the fastmath flag to for recipe
c372a26
to
f4932cc
Compare
; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ | ||
; RUN: -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-max=128 \ | ||
; RUN: -riscv-v-vector-bits-min=128 -disable-output < %s 2>&1 | FileCheck --check-prefix=FAST %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this to vplan-printing.ll? RISCV triple and other flags shouldn't be needed for the printing test (if they re needed, the test needs to be in the RISCV subdirectory otherwise it will fail when RISCV is not built
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, fixed ~
; RUN: opt < %s -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -riscv-v-vector-bits-max=128 \ | ||
; RUN: -riscv-v-vector-bits-min=128 -S | FileCheck --check-prefix=FAST %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is RISCV triple really needed? Better to use -force-vector-width; if RISCV is really needed, it should be moved to the RISCV subdir.
(Also doesn't need REQUIRES: asserts
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks,fixed:)
08ebef0
to
47d9df2
Compare
47d9df2
to
cbd50dd
Compare
If there is no problem, can you give me LG:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
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