[PATCH] D108757: [X86][Codegen] PR51615: don't replace wide volatile load with narrow broadcast-from-memory

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 06:35:02 PDT 2021


spatel added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:5043-5046
+  // X86ISD::VBROADCAST will only perform the load of a single scalar element,
+  // but if the original load was volatile, the load must have been loading
+  // exactly that single scalar element, because we can not change the size
+  // of volatile loads.
----------------
This comment doesn't read clearly to me. The comment on the test does, so copy that here?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:5049
+  return !Ld->isVolatile() ||
+         Ld->getValueSizeInBits(0) == EltVT.getScalarSizeInBits();
+}
----------------
lebedev.ri wrote:
> RKSimon wrote:
> > Can you use normal and simple tests here?
> We could, but i'm not sure we have to?
> If the aligned load was already only loading a single element, why not promote it into broadcast?
We are already checking ISD::isNormalLoad() by calling MayFoldLoad() first, right?
MemSDNode::isSimple() would add a constraint for an atomic load. I'm not sure about the rules for those. A quick survey of existing uses suggests we do use that in general to be safe - see for example getBROADCAST_LOAD().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108757



More information about the llvm-commits mailing list