[PATCH] D109337: [GlobalOpt][FIX] Do not embed initializers into AS!=0 globals

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 13:43:40 PDT 2021


tra added inline comments.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h:52
+  bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const {
+    return AS != AddressSpace::ADDRESS_SPACE_SHARED;
+  }
----------------
While we should not have globals with ADDRESS_SPACE_LOCAL  or ADDRESS_SPACE_PARAM, it may be worth to return false for them, too.


================
Comment at: llvm/test/Transforms/GlobalOpt/address_space_initializer.ll:1
+; RUN: opt -passes=globalopt < %s -S | FileCheck %s
+
----------------
You may want to add another run for NVPTX with non-default AS and check that we do create the initializer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109337



More information about the llvm-commits mailing list