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 | ||
---|---|---|
1194 | Please add set/get methods and make these member variables private. | |
1196 | 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. | |
1283 | const? | |
1367 | I was under the impression that we are completely removing InstructionsState and replacing it with state from TreeEntry. | |
1422 | Hmm isn't this an unrelated change to this patch? | |
1429 | Same here | |
1434 | Same | |
2267 | Shouldn't we be getting this from the TreeEntry? Something like E->isAltShuffle() | |
2903 | This also looks unrelated to this patch. | |
3492 | It would be nice to have a method to hide this. Perhaps E->getSchedulingDataKey() or something along those lines. | |
3928–3929 | Why do we still have the InstructionsState here? Shouldn't we use data from the TreeEntry instead? | |
4078 | 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 | ||
---|---|---|
2892 | How about this getSameOpcode() ? Can't we replace this too? | |
3931 | 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 | ||
---|---|---|
1429 | These NFC changes are still here - remove from this patch? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1429 | 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 | ||
---|---|---|
1318 | Clang-format? |
lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1429 | 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.