[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 09:51:11 PDT 2024


================
@@ -48,11 +48,13 @@ define <4 x i32> @load_static_array_of_vec_test(i32 %index) {
 }
 
 ; CHECK-LABEL: multid_load_test
-define <4 x i32> @multid_load_test()  {
+define <4 x i32> @multid_load_test() #0 {
   ; CHECK-COUNT-8: load i32, ptr addrspace(3) {{(.*@groushared2dArrayofVectors.scalarized.*|%.*)}}, align 4
   ; CHECK-NOT: load i32, ptr addrspace(3) {{.*}}, align 4
   %1 = load <4 x i32>, <4 x i32> addrspace(3)* getelementptr inbounds ([3 x [3 x <4 x i32>]], [3 x [3 x <4 x i32>]] addrspace(3)* @"groushared2dArrayofVectors", i32 0, i32 0, i32 0), align 4
   %2 = load <4 x i32>, <4 x i32> addrspace(3)* getelementptr inbounds ([3 x [3 x <4 x i32>]], [3 x [3 x <4 x i32>]] addrspace(3)* @"groushared2dArrayofVectors", i32 0, i32 1, i32 1), align 4
   %3 = add <4 x i32> %1, %2
   ret <4 x i32> %3
 }
+
+attributes #0 = { convergent norecurse nounwind "hlsl.export"}
----------------
pow2clk wrote:

With this change, any functions lacking  this attribute will be removed because they are not called. The attribute is aded so they don't get removed and cause this and other tests to fail.

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


More information about the cfe-commits mailing list