[llvm] [LangRef] Disallow accessing byval arguments from tail-called functions (PR #110093)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 09:17:39 PDT 2024


================
@@ -63,25 +63,6 @@ declare i32 @e1(ptr nocapture byval(%struct.SmallStruct) %in) nounwind
 declare i32 @e2(ptr nocapture byval(%struct.LargeStruct) %in) nounwind
 declare i32 @e3(ptr nocapture byval(%struct.LargeStruct) align 16 %in) nounwind
 
-; rdar://12442472
-; We can't do tail call since address of s is passed to the callee and part of
-; s is in caller's local frame.
-define void @f3(ptr nocapture byval(%struct.SmallStruct) %s) nounwind optsize {
-; CHECK-LABEL: f3
-; CHECK: bl _consumestruct
-entry:
-  tail call void @consumestruct(ptr %s, i32 80) optsize
----------------
efriedma-quic wrote:

I don't think we need to delete these tests; they have well-defined behavior.  Maybe add a comment if you're concerned someone reading the test will get confused. (If `@consumestruct` tried to access memory through the pointer, that would be wrong, but it doesn't, as far as the compiler can tell.)

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


More information about the llvm-commits mailing list