This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] do not rely on cached subtarget info.
ClosedPublic

Authored by tra on Dec 11 2018, 2:19 PM.

Details

Summary

If a module has function references, but no functions
themselves, we may end up never calling runOnMachineFunction
and therefore would never initialize nvptxSubtarget field
which would eventually cause a crash.

Instead of relying on nvptxSubtarget being initialized by
one of the methods, retrieve subtarget info directly.

@echristo : Added you as a reviewer as you were refactoring this code some time back (rL229785)

Diff Detail

Repository
rL LLVM

Event Timeline

tra created this revision.Dec 11 2018, 2:19 PM
echristo accepted this revision.Dec 11 2018, 3:34 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Dec 11 2018, 3:34 PM
This revision was automatically updated to reflect the committed changes.