Literal structs are mangled as 'ls_' ( mangled fields) 's'. Mangling for structs is also changed to add a 's_' prefix and a 's' postfix to handle nested structs and struct names that may collide with other mangled types.
Diff Detail
Event Timeline
Expand overloaded-intrinsic-name.ll test to include an overload using a literal struct type and execute the new codepath?
Expand overloaded-intrinsic-name.ll test to include an overload using a literal struct type and execute the new codepath?
Done.
lib/IR/Function.cpp | ||
---|---|---|
492–493 | Please consistently use braces. |
The new literal struct naming rules seem fine, but the change in non-literal structs is not. Unless you have a strong motivation for it, I'd prefer to see that portion of the change reverted.
lib/IR/Function.cpp | ||
---|---|---|
493 | I'm not sure the change in serialization is acceptable here. This will silently break previously valid code. Is there a reason why the nesting scheme needs to apply to non-literal structs? I think you can leave the old code in place for non-literal structures and just add the nesting for the new case. | |
test/CodeGen/Generic/overloaded-intrinsic-name.ll | ||
47 | This is the change I'm concerned about. |
lib/IR/Function.cpp | ||
---|---|---|
493 | Consider the following: %si64 = type { i64 } %s = type { i64 } ; struct define %si64* @test_struct(%si64* %v, %s* %w) gc "statepoint-example" { %tok = call i32 (i64, i32, %si64* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p0si64f(i64 0, i32 0, %si64* ()* @return_si64, i32 0, i32 0, i32 0, i32 0) ;%tok = call i32 (i64, i32, %s* (i64)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p0si64f(i64 0, i32 0, %s* (i64)* @return_s, i32 1, i32 0, i64 0, i32 0, i32 0) ret %si64* %v } declare %si64* @return_si64() declare %s* @return_s(i64) declare i32 @llvm.experimental.gc.statepoint.p0f_p0si64f(i64, i32, %si64* ()*, i32, i32, ...) ;declare i32 @llvm.experimental.gc.statepoint.p0f_p0si64f(i64, i32, %s* (i64)*, i32, i32, ...) The mangled names of the two signatures for the statepoint intrinsic collide due to the names of the structs and the parameter types involved. The proposed scheme avoids this collision, as the names become: declare i32 @llvm.experimental.gc.statepoint.p0f_p0s_si64sf(i64, i32, %si64* ()*, i32, i32, ...) declare i32 @llvm.experimental.gc.statepoint.p0f_p0s_ssi64f(i64, i32, %s* (i64)*, i32, i32, ...) |
LGTM. The explanation on the non-literal form makes sense. I'm still not happy about the break in the naming scheme, but I don't have a better option either.
Just for the record, this really should have been two patches. One was a minor enhancement, the other was a subtle change which required careful thought. Please make sure when you land this that you call out the issue here so that it's obvious to readers.
Please consistently use braces.