================
@@ -0,0 +1,114 @@
+// RUN: %clang_cc1 -x hlsl -triple  dxil-pc-shadermodel6.3-library %s 
-emit-llvm -disable-llvm-passes -o - | FileCheck %s 
--check-prefixes=CHECK,NOINLINE
+// RUN: %clang_cc1 -x hlsl -triple  dxil-pc-shadermodel6.3-library %s 
-emit-llvm -O0 -o - | FileCheck %s --check-prefixes=CHECK,INLINE
+// RUN: %clang_cc1 -x hlsl -triple  dxil-pc-shadermodel6.0-compute %s 
-emit-llvm -disable-llvm-passes -o - | FileCheck %s 
--check-prefixes=CHECK,NOINLINE
+// RUN: %clang_cc1 -x hlsl -triple  dxil-pc-shadermodel6.0-compute %s 
-emit-llvm -O0 -o - | FileCheck %s --check-prefixes=CHECK,INLINE
+
+// Tests that user functions will always be inlined.
+// This includes exported functions and mangled entry point implementation 
functions.
+// The unmangled entry functions must not be alwaysinlined.
+
+#define MAX 100
+
+float nums[MAX];
+
+// Verify that all functions have the alwaysinline attribute
+// CHECK: Function Attrs: alwaysinline
+// CHECK: define void @"?swap@@YAXY0GE@III@Z"(ptr noundef byval([100 x i32]) 
align 4 %Buf, i32 noundef %ix1, i32 noundef %ix2) [[IntAttr:\#[0-9]+]]
----------------
pow2clk wrote:

The reason why some of these won't be removed is because of the 
`-disable-llvm-passes` flag which skips optimizations that remove trivially 
dead functions.

This comment did make me realize there is a bug in waiting though. We don't yet 
remove trivially dead functions like this at all because the internal linkage 
marking takes place after any pass that would remove them. I have a tentative 
fix that depends on this change here #106146. Once this is in, I'll focus on 
that. Once that's in, these won't show up in the INLINE case, so I moved them 
to be NOINLINE exclusive.

https://github.com/llvm/llvm-project/pull/106588
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to