It is possible for some passes to materialize a call to a libcall (ex: ldexp, exp2, etc),
but these passes will not mark the call as a gc-leaf-function. All libcalls are
actually gc-leaf-functions, so we change llvm::callsGCLeafFunction() to tell us that
available libcalls are equivalent to gc-leaf-function calls.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This change looks good to me. However, I would suggest separating out the PlaceSafepoints (and it's testcase) change from the RewriteStatepointsForGC change. We don't use placeSafepoint anymore, so we should perhaps just deprecate it upstream, instead of fixing it.
@reames: What do you suggest?
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1850 ↗ | (On Diff #108083) | Please state that libcalls can be materialized by RS4GC, there's no other passes right? (frankly, the placeSafepoints.cpp is deprecated). |
With the codebase in its current state, the PlaceSafepoints & RewriteStatepointsForGC changes cannot be separated. Fundamentally, the change is to behaviour of callsGCLeafFunction() -- making it flag lib calls as gc-leaf. That change required changing the prototype for the function, which in turn required the change in PlaceSafepoints.
The change could be contained to add the libcall check to just RewriteStatepointsForGC in the NeedsRewrite lambda, but that's less of a proper fix in my view -- it fixes a location of the bug's manifestation, but not the source of the bug.
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1850 ↗ | (On Diff #108083) | That's not true. Libcalls can be created by other passes than just RS4GC. For example, where we noticed this problem was in a series of simplifications: |
SGTM!
lib/Transforms/Utils/Local.cpp | ||
---|---|---|
1850 ↗ | (On Diff #108083) | ah thanks for the clarification. |
Fixing both is definitely the right answer for the moment. PlaceSafepoints is questionable. It's a nice proof of concept, but given we aren't using it and thus testing it, it's probably starting to bit rot. I'd lean toward removing it, but let's check on llvm-dev to see if anyone else is using it before we just delete the code.