[llvm] [AMDGPU] Fix DynLDS causing crash when LowerLDS is run at fullLTO pipeline (PR #96038)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 01:12:20 PDT 2024


================
@@ -207,16 +207,21 @@ LDSUsesInfoTy getTransitiveUsesOfLDS(const CallGraph &CG, Module &M) {
   }
 
   // Verify that we fall into one of 2 cases:
-  //    - All variables are absolute: this is a re-run of the pass
+  //    - All variables are either absolute 
+  //      or direct mapped dynamic LDS that is not lowered.
+  //      this is a re-run of the pass
   //      so we don't have anything to do.
   //    - No variables are absolute.
   std::optional<bool> HasAbsoluteGVs;
   for (auto &Map : {DirectMapKernel, IndirectMapKernel}) {
     for (auto &[Fn, GVs] : Map) {
       for (auto *GV : GVs) {
         bool IsAbsolute = GV->isAbsoluteSymbolRef();
+        bool IsDirectMapDynLDSGV = AMDGPU::isDynamicLDS(*GV) && DirectMapKernel.contains(Fn);
         if (HasAbsoluteGVs.has_value()) {
-          if (*HasAbsoluteGVs != IsAbsolute) {
+          if (*HasAbsoluteGVs != IsAbsolute ) {
+            if(IsDirectMapDynLDSGV)
----------------
Pierre-vh wrote:

```suggestion
          if (*HasAbsoluteGVs != IsAbsolute) {
            if (IsDirectMapDynLDSGV)
```
run clang-format

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


More information about the llvm-commits mailing list