This patch adds calls to NVPTX-specific passes that can be safely skipped to opt-in to the optimization bisect mechanism.
I selected the passes to be skipped based on the fact that they were not added at CodeGenOpt::None in NVPTXTargetMachine.cpp. Based on that criteria, I did not add opt-in calls to the following passes, which appear to be required:
GenericToNVVM
NVPTXAllocaHoisting
NVPTXAssignValidGlobalNames
NVPTXLowerAggrCopies
NVPTXPeephole
NVPTXPrologEpilogPass
NVVMReflect
NVPTXReplaceImageHandles
Based on the description (not to mention the name) NVPTXPeephole seemed to me as if it could be safely skipped but it appears that it never is, so I did not add the opt-in call there.
Note that the call to skipFunction() will also check for the "optnone" function attribute, so this can theoretically result in passes being skipped even when optimization bisect is not being done. However, I believe that any pass that can be safely skipped should be skipped for functions with the optnone attribute.
See D19172 for details on the base optimizaton bisect implementation.
handleByValParam is necessary for correctness, so NVPTXLowerKernelArgs can't be skipped unless we separate handleByValParam out to another pass.