This is an archive of the discontinued LLVM Phabricator instance.

[GC] Turn {undef,null} transforms into strategy
AbandonedPublic

Authored by artagnon on Jan 4 2015, 3:01 PM.

Details

Reviewers
reames
sanjoy
Summary

The code doesn't seem to run for some reason. Hints?

Diff Detail

Event Timeline

artagnon updated this revision to Diff 17779.Jan 4 2015, 3:01 PM
artagnon retitled this revision from to [GC] Turn {undef,null} transforms into strategy.
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added reviewers: reames, sanjoy.
artagnon added a subscriber: Unknown Object (MLST).
reames edited edge metadata.Jan 4 2015, 3:25 PM

What are you trying to accomplish here? The patch appears slightly nonsensical. The lowering code your modifying is from the old gc.root mechanism and isn't involved with statepoints.

Why do you want to move the optimization code out of InstCombine? Arguably some of it should live in InstSimplify, but it's definitely an IR level optimization.

Do you have a collector which doesn't want these?

I'm just following what I think I understood from your comment: "There might be some weird collector this property does not hold for." -- so, I thought there should be a way to define a custom lowering pass for "relocate undef" or "relocate null" instead of turning them into "undef" and "null" everytime. Did I misunderstand? What are those TODO comments about?

GCStrategy code is invoked on a gc "..." annotation, irrespective of whether it uses the gcroot mechanism, no?

sanjoy edited edge metadata.Jan 4 2015, 4:24 PM

I'm just following what I think I understood from your comment: "There might be some weird collector this property does not hold for." -- so, I thought there should be a way to define a custom lowering pass for "relocate undef" or "relocate null" instead of turning them into "undef" and "null" everytime. Did I misunderstand? What are those TODO comments about?

In this context: "There might be some weird collector this property
does not hold for." == "This property holds for virtually every
production-grade garbage collector". It is better to defer this
complexity (of conditionally switching off the two optimizations) till
someone actually tries to get statepoints working with such a
collector.

GCStrategy code is invoked on a gc "..." annotation, irrespective of whether it uses the gcroot mechanism, no?

relocate(null) == null is an optimization, similar to "add x 0 == x".
I don't think it should live in GCStrategy -- it is inaccurate for
this transform to be part of any "lowering" phase. Even from a
practical standpoint, it is better to run it interleaved with other
transforms done by instcombine.

  • Sanjoy
artagnon abandoned this revision.Jan 4 2015, 4:28 PM
reames added a comment.Jan 4 2015, 4:41 PM

Sanjoy's response covered much of what I would otherwise say. One small
addition: If we do add a hook to the GCStrategy class to control these
optimizations, the location of the optimization should not change. The
intent of my "Move ownership of GCStrategy objects to LLVMContext"
change (up for review now) is to allow InstCombine and other passes to
get at properties of the GCStrategy in play.

Philip