This is an archive of the discontinued LLVM Phabricator instance.

Statepoint: Fix handling of Far Immediate calls
ClosedPublic

Authored by swaroop.sridhar on Jun 3 2015, 6:39 PM.

Details

Summary

gc.statepoint intrinsics with a far immediate target was lowered incorrectly as a pc-rel32 call.

For example, for
%safepoint_token = call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* inttoptr (i64 140727162896504 to void ()*), i32 0, i32 0, i32 0, i32 0)

the CALL instruction generated was:

callq 140727162896504

This change fixes the problem, so that an indirect call via a scratch register is correctly generated:

movabsq $140727162896504, %rax
callq *%rax

In lowerCallFromStatepoint(), the callee-target was modified and represented as a "TargetConstant" node, rather than a "Constant" node.
Undoing this modification enabled LowerCall() to generate the correct CALL instruction.

Diff Detail

Event Timeline

swaroop.sridhar retitled this revision from to Statepoint: Fix handling of Far Immediate calls.
swaroop.sridhar updated this object.
swaroop.sridhar edited the test plan for this revision. (Show Details)
swaroop.sridhar added reviewers: sanjoy, reames, pgavlin.
swaroop.sridhar added a subscriber: Unknown Object (MLST).
sanjoy accepted this revision.Jun 3 2015, 6:45 PM
sanjoy edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Jun 3 2015, 6:45 PM