[llvm] [AMDGPU] Drop !noundef when widening sub-DWORD constant loads (PR #201085)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 02:16:26 PDT 2026


================
@@ -30,6 +31,22 @@ Align getAlign(const DataLayout &DL, const GlobalVariable *GV) {
                                        GV->getValueType());
 }
 
+void copyMetadataForWidenedLoad(LoadInst &Dest, const LoadInst &Source) {
+  SmallVector<std::pair<unsigned, MDNode *>, 8> MD;
+  Source.getAllMetadata(MD);
+  for (const auto &[ID, N] : MD) {
+    switch (ID) {
+    case LLVMContext::MD_dbg:
+    case LLVMContext::MD_invariant_load:
+    case LLVMContext::MD_nontemporal:
+      Dest.setMetadata(ID, N);
----------------
arsenm wrote:

Might be able to preserve some of the alias ones, but requires some thought 

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


More information about the llvm-commits mailing list