[PATCH] D140365: [SelectionDAG] Correctly widen bitcast of scalar to vector for big endian

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 12:13:51 PST 2022


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:4861
+      if (DAG.getDataLayout().isBigEndian()) {
+        InVT = N->getOperand(0).getValueType();
+        NewNumElts = WidenSize / InVT.getSizeInBits();
----------------
I'd prefer `EVT OrigInVT = N->getOperand(0).getValueType();`, or something like that.

Can we avoid explicitly forking on endianness here?  We should be able to use the same vector type for little-endian, I think.  Keeping the DAG as close as possible should make it easier to generate optimal code for targets that have both little-endian and big-endian variants.

I'm a little concerned we could end up producing a weird vector type here; the result of promotion is always going to be a nice type, but the original type could be something less nice.  I guess we end up using the CreateStackStoreLoad codepath if we end up choosing an illegal vector type, so maybe we can ignore that for now.


================
Comment at: llvm/test/CodeGen/PowerPC/widen-vec-correctly-be.ll:52
+bb:
+  br i1 poison, label %bb1, label %bb2
+
----------------
Please avoid writing tests that explicitly branch on poison, to make the output more stable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140365



More information about the llvm-commits mailing list