Add a new function to do the endian check, as I will commit another patch later, which will also need the endian check. The coming patch is trying to combine several stores, as what MatchLoadCombine did. The opportunity is found from spec2017.
Details
- Reviewers
jsji nemanjai spatel apilipenko RKSimon hfinkel - Commits
- rZORG4216e9d756e6: [NFC] Add a static function to do the endian check Add a new function to do the…
rZORG3ef058ac8498: [NFC] Add a static function to do the endian check Add a new function to do the…
rG4216e9d756e6: [NFC] Add a static function to do the endian check Add a new function to do the…
rG3ef058ac8498: [NFC] Add a static function to do the endian check Add a new function to do the…
rGe065af6a42a9: [NFC] Add a static function to do the endian check Add a new function to do the…
rL360226: [NFC] Add a static function to do the endian check
Diff Detail
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6104 | oops. copy paste issue when resolve the conflict. | |
6108 | Maybe, remove the LittleEndianByteAt + BigEndianByteAt for load combine ? As it is a really simple helper function, and it is only used in one place now auto MemoryByteOffset = [&] (ByteProvider P) { assert(P.isMemory() && "Must be a memory byte provider"); unsigned LoadBitWidth = P.Load->getMemoryVT().getSizeInBits(); assert(LoadBitWidth % 8 == 0 && "can only analyze providers for individual bytes not bit"); unsigned LoadByteWidth = LoadBitWidth / 8; return IsBigEndianTarget ? LoadByteWidth - P.ByteOffset - 1 : P.ByteOffset; }; |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6111 | Small stylistic suggestion. This function essentially returns a tri-state: big, little, neither. An explicit enum for the return value might be a cleaner way to express this. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6111 | Or maybe std::optional? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6245 | Maybe call this IsBigEndian? |
LGTM - with one minor
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
6246 | Maybe if (!IsBigEndian.hasValue()) ? |
ok. Use the hasValue instead of the implicit bool convert operator to make the code clear.
Please clang-format the function