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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 11:19:40 PDT 2024


================
@@ -2853,6 +2853,11 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
 
   bool visitLoadInst(LoadInst &LI) {
     LLVM_DEBUG(dbgs() << "    original: " << LI << "\n");
+
+    // load atomic vector would be generated, which is illegal
+    if (LI.isAtomic() && NewAI.getAllocatedType()->isVectorTy())
----------------
arsenm wrote:

No, you need to ensure the atomic is a valid type for an atomic load. 

Alternatively you can do the load with the equivalent sized type and then bitcast (which is why this restriction is dumb in the first place, the lowering can always do the same) 

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


More information about the llvm-commits mailing list