WHILELO/LS insn is used very important for SVE loop, and itself
is a flag-setting operation, so add it.
Details
Diff Detail
Event Timeline
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14551 | Hi @Allen, don't you also have to check the first operand to see if it matches the intrinsic, i.e. aarch64_sve_whilelo or aarch64_sve_whilels? | |
llvm/test/CodeGen/AArch64/sve-cmp-folds.ll | ||
102 | Since you also want to support the DAG combine with whilels is it worth having a test for that too? |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14551 | I guess I should have asked this a couple of patches ago but being provocative what's the value in having any restriction here? I recall something about allowing hoisting from loops but is this really a necessary consideration at this phase of compilation? Are there other things to consider? |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14551 | So I think the MachineLICM pass runs after this phase, right? And if you introduce flag-setting operations they don't get hoisted out. Obviously if you had flag-setting operations to start with then it's no worse. This is what happens when you dup a i1 into a predicate register, for example see LowerSPLAT_VECTOR where we create a whilelo that then never gets hoisted out of the loop. I'm happy to be proved wrong though as I may have missed something! |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14551 | Sure, that makes sense. I guess what I'm asking is what's the scenario where we are extracting from a loop invariant predicate vector that hasn't already been hoisted at the IR level. |
Whether it's worth having the CC restriction aside, the patch look good to me. I've mentioned some refactoring to consider.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14539–14540 | This name is less meaningful after this change. | |
14549–14552 | Perhaps it's worth extracting this into a isPredicateCCSettingOp helper function (or lambda) as eventually we'll want to add all such operations if we're going to persist with this restriction. |
update according review
- define a new helper function isPredicateCCSettingOp
- add all other type whileXX operations
- add related cases, and sve->sve2
This name is less meaningful after this change.