David Chisnall via llvm-dev
2019-Jan-27 13:16 UTC
[llvm-dev] Help finding regression from 7-8 related to MemorySSA
Hello the list, Updating from clang 7 to 8, I’m seeing a regression in one of the tests from the GNUstep Objective-C runtime’s test suite. The test[1] uses a static variable to check whether a dealloc method is called. After running 'Early CSE w/ MemorySSA’ as part of an -O2 clang invocation, the assert is incorrectly optimised to always failing. It appears that there is an issue with MemorySSA believing that the (internal linkage) function that sets the global cannot be called as a result of the @llvm.objc.autoreleasePoolPop intrinsic, ignoring the fact that pointers to the function have escaped before main(), via named linker sections. With clang 7.0, and most of the pre-8 trunk builds, this test was passing, and it’s only quite recently that the regression has been introduced. I have tried working around it in the front end by putting various things in the compiler-used global, but I cannot determine exactly what needs to go there. David [1] Full source here: https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m There should be a load of @deallocCalled after the call to objc_autoreleasePoolPop (which some ARC optimisers temporarily turn into a call to llvm.objc.autoreleasePoolPop in the middle).