[PATCH] D60897: [SLP] Look-ahead operand reordering heuristic.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 18:40:34 PDT 2019


vporpo added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:773
+        InstructionsState S = getSameOpcode({I1, I2});
+        if (S.getOpcode())
+          return (I1 == I2) ? VLOperands::ScoreSplat
----------------
RKSimon wrote:
> What happens in the case where we have alt opcodes? Should we have a preference for all the same opcode vs with alt-opcode? Sometimes the alt-opcodes will fold away (shl + mul etc.) - other times it won't (shl + lshr).
Hmm good point. Well, currently 'getScoreAtLevelRec()' will simply walk past the alt instructions and will assign them `ScoreSameOpcode`. This is does not look very accurate because alt opcodes usually require shuffles and should have a lower score.
I introduced a new `ScoreAltOpcodes = 1` so that alt opcodes are not given the same score as identical opcodes (please see the new functions in lit test).

As for the alt opcodes that fold away, maybe that should be fixed in the `getSameOpcode()` and in `struct InstructionState` ? If the get folded then maybe `isAltShuffle()` should return false?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60897/new/

https://reviews.llvm.org/D60897





More information about the llvm-commits mailing list