We can avoid repetitive calls getSameOpcode() for already known tree elements by keeping MainOp and AltOp in TreeEntry. Also, ScalarToTreeEntry key should be at this point not just Value but Instruction.
Details
Diff Detail
Event Timeline
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1193 | Please add set/get methods and make these member variables private. | |
1195 | Also please improve TreeEntry's dump() so that it prints whether this is an alt sequence entry. You could also perhaps print these values if needed. | |
1273 | const? | |
1356 | I was under the impression that we are completely removing InstructionsState and replacing it with state from TreeEntry. | |
1401 | Hmm isn't this an unrelated change to this patch? | |
1408 | Same here | |
1413 | Same | |
2217 | Shouldn't we be getting this from the TreeEntry? Something like E->isAltShuffle() | |
2810 | This also looks unrelated to this patch. | |
3399 | It would be nice to have a method to hide this. Perhaps E->getSchedulingDataKey() or something along those lines. | |
3835–3836 | Why do we still have the InstructionsState here? Shouldn't we use data from the TreeEntry instead? | |
3985 | I think it would be nice to have TreeEntry methods E->getMainOpcode() and E->getAltOpcode(). |
Rebased, fixed previous remarks. Here we still have InstructionsState and I have the full change with the state in TreeEntry but I prefer to break it in several reviews.
Just a couple more comments.
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
2799 | How about this getSameOpcode() ? Can't we replace this too? | |
3838 | Hmm, this block starting at line 3828 looks a bit redundant now. Shouldn't this state update be done internally within TreeEntry? How about using something like E->updateStateIfReorder() ? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1408 | These NFC changes are still here - remove from this patch? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1408 | hmm, We can refer to an entry by a pointer instead of a number and I prefer to keep it unless the other opinion? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1308 | Clang-format? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1408 | In which case I'd recommend just doing this as a NFC commit now to avoid it from this patch. |
Please add set/get methods and make these member variables private.