@@ -3844,6 +3844,9 @@ class OffloadingActionBuilder final {
38443844 // / Flag set to true if all valid builders allow file bundling/unbundling.
38453845 bool CanUseBundler;
38463846
3847+ // / Flag set to false if an argument turns off bundling.
3848+ bool ShouldUseBundler;
3849+
38473850public:
38483851 OffloadingActionBuilder (Compilation &C, DerivedArgList &Args,
38493852 const Driver::InputList &Inputs)
@@ -3878,6 +3881,9 @@ class OffloadingActionBuilder final {
38783881 }
38793882 CanUseBundler =
38803883 ValidBuilders && ValidBuilders == ValidBuildersSupportingBundling;
3884+
3885+ ShouldUseBundler = Args.hasFlag (options::OPT_gpu_bundle_output,
3886+ options::OPT_no_gpu_bundle_output, true );
38813887 }
38823888
38833889 ~OffloadingActionBuilder () {
@@ -4029,11 +4035,11 @@ class OffloadingActionBuilder final {
40294035 SB->appendTopLevelActions (OffloadAL);
40304036 }
40314037
4032- // If we can use the bundler, replace the host action by the bundling one in
4033- // the resulting list. Otherwise, just append the device actions. For
4034- // device only compilation, HostAction is a null pointer, therefore only do
4035- // this when HostAction is not a null pointer.
4036- if (CanUseBundler && HostAction &&
4038+ // If we can and should use the bundler, replace the host action by the
4039+ // bundling one in the resulting list. Otherwise, just append the device
4040+ // actions. For device only compilation, HostAction is a null pointer,
4041+ // therefore only do this when HostAction is not a null pointer.
4042+ if (CanUseBundler && ShouldUseBundler && HostAction &&
40374043 HostAction->getType () != types::TY_Nothing && !OffloadAL.empty ()) {
40384044 // Add the host action to the list in order to create the bundling action.
40394045 OffloadAL.push_back (HostAction);
0 commit comments