This is an archive of the discontinued LLVM Phabricator instance.

Have 'optnone' respect -fast-isel=false
ClosedPublic

Authored by probinson on Nov 18 2015, 3:31 PM.

Details

Summary

The 'optnone' attribute was forcing FastISel on. For debugging 'optnone' issues, it would be useful to be able to disable this from the command line, so now the -fast-isel option will factor into the decision to enable FastISel for 'optnone' functions.

Diff Detail

Repository
rL LLVM

Event Timeline

probinson updated this revision to Diff 40573.Nov 18 2015, 3:31 PM
probinson retitled this revision from to Have 'optnone' respect -fast-isel=false.
probinson updated this object.
probinson added reviewers: echristo, dsanders.
probinson added a subscriber: llvm-commits.

I'm not entirely sure it's kosher to describe backend command-line options in the IR LangRef, but Eric had asked for this feature to be documented and I'm not sure how else to do it. Advice welcome.

echristo edited edge metadata.Nov 19 2015, 5:03 PM

Some inline comments which should change quite a bit of the patch.

Thanks!

-eric

docs/LangRef.rst
1294 ↗(On Diff #40573)

You can remove everything after the semicolon and replace it with a period.

include/llvm/Target/TargetMachine.h
105 ↗(On Diff #40573)

No need for this.

probinson added inline comments.Nov 19 2015, 5:59 PM
include/llvm/Target/TargetMachine.h
105 ↗(On Diff #40573)

This is where LLVMTargetMachine records the state of the -fast-isel command-line option, which SelectionDAGISel needs. SelectionDAGISel does not have direct access to the EnableFastISelOption flag.

Unless you're now saying 'optnone' must always use FastISel? That wasn't the conclusion in the llvm-dev thread.

Just make it an enum ala FloatABI with a Default, SelectionDAG, FastISel
and use that everywhere?

-eric

Just make it an enum ala FloatABI with a Default, SelectionDAG, FastISel
and use that everywhere?

-eric

"Everywhere" is exactly two places, hardly seems worth the trouble. Maybe rename the flag to "O0UsesFastISel" instead? which then can be used directly in both LLVMTargetMachine and OptLevelChanger with obviously consistent semantics.

dsanders edited edge metadata.Nov 21 2015, 2:49 AM

Just make it an enum ala FloatABI with a Default, SelectionDAG, FastISel
and use that everywhere?

-eric

"Everywhere" is exactly two places, hardly seems worth the trouble. Maybe rename the flag to "O0UsesFastISel" instead? which then can be used directly in both LLVMTargetMachine and OptLevelChanger with obviously consistent semantics.

Given the current choice of SelectionDAG vs FastISel, I agree with Paul that this isn't worth the trouble. I think Eric is accounting for the addition of Global ISel in the near future which would presumably add a third choice to the enum he's requesting. If that is the reason, then I'd suggest leaving that for Global ISel since it's going to have to replace the -fast-isel option with an enum based option anyway.

I also agree with the renaming. FWIW, I was going to suggest 'CanUseFastISel' but I think 'O0UsesFastISel' or maybe 'O0WantsFastISel' is better.

probinson marked an inline comment as done.Nov 23 2015, 11:22 AM
probinson added inline comments.
include/llvm/Target/TargetMachine.h
105 ↗(On Diff #40573)

Renamed to 'O0WantsFastISel' as suggested by dsanders.

probinson updated this revision to Diff 40954.Nov 23 2015, 11:24 AM
probinson edited edge metadata.

Rename flag as requested.

dsanders accepted this revision.Nov 26 2015, 2:22 AM
dsanders edited edge metadata.

This LGTM.

This revision is now accepted and ready to land.Nov 26 2015, 2:22 AM
This revision was automatically updated to reflect the committed changes.