[llvm] [SROA] Prevent load atomic vector from being generated (PR #112432)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 23:43:23 PDT 2024


================
@@ -1247,6 +1247,16 @@ void LoadInst::AssertOK() {
          "Ptr must have pointer type.");
 }
 
+bool LoadInst::isValidAtomicTy(Type *Ty, const DataLayout &DL,
+                               AtomicOrdering AO) {
+  if (!Ty->isIntOrPtrTy() && !Ty->isFloatingPointTy())
+    return false;
+  if (AO == AtomicOrdering::Release || AO == AtomicOrdering::AcquireRelease)
+    return false;
+  unsigned Size = DL.getTypeSizeInBits(Ty);
+  return Size >= 8 && !(Size & (Size - 1));
----------------
jofrn wrote:

`basictest.ll` fails due to checking `DL` here.

https://github.com/llvm/llvm-project/pull/112432


More information about the llvm-commits mailing list