[PATCH] D33108: Generate extra .ll files before/after optimization when using -save-temps.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 09:51:48 PDT 2017


tra added inline comments.


================
Comment at: lib/Driver/Driver.cpp:2603-2614
+      // lipo-able.
+      if (!MultiArchUniversalBuild) {
+        if (isSaveTempsEnabled() && Phase == phases::Compile) {
+          Actions.push_back(
+              C.MakeAction<CompileJobAction>(Current, types::TY_LLVM_IR));
+        }
+        if (isSaveTempsEnabled() && Phase == phases::Backend) {
----------------
Can this be moved below addHostDependenceToDeviceActions() on line 2626?
See my comment in cuda-options.cu below for the reasons why it may be necessary.


================
Comment at: test/Driver/cuda-options.cu:197-202
-// Match host-side preprocessor job with -save-temps.
-// HOST-SAVE: "-cc1" "-triple" "x86_64--linux-gnu"
-// HOST-SAVE-SAME: "-aux-triple" "nvptx64-nvidia-cuda"
-// HOST-SAVE-NOT: "-fcuda-is-device"
-// HOST-SAVE-SAME: "-x" "cuda"
-
----------------
It appears that the new actions you've pushed trigger at least parts of host-side compilation to happen before device-side compilation is done. That, at the very least, will not work well for CUDA. Compilation will probably succeed, but it will be missing device-side code and will fail at runtime.

If it's only host-side preprocessor that happens ahead of device-side actions, then may be OK, but in general host actions must be done after device's. 


https://reviews.llvm.org/D33108





More information about the cfe-commits mailing list