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

Jorge Gorbe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 17:00:36 PDT 2017


jgorbe 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) {
----------------
tra wrote:
> 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.
I have tried but it didn't cause the test to go back to the previous ordering where all device-side actions are executed before all host-side actions.

I have noticed that, before applying my patch, the action graph produced by clang with -ccc-print-phases doesn't seem to introduce any explicit dependency to guarantee that device-side actions are executed before host-side actions:

0: input, "cuda-options.cu", cuda, (host-cuda)
1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
2: compiler, {1}, ir, (host-cuda)
3: input, "cuda-options.cu", cuda, (device-cuda, sm_20)
4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_20)
5: compiler, {4}, ir, (device-cuda, sm_20)
6: backend, {5}, assembler, (device-cuda, sm_20)
7: assembler, {6}, object, (device-cuda, sm_20)
8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_20)" {7}, object
9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_20)" {6}, assembler
10: linker, {8, 9}, cuda-fatbin, (device-cuda)
11: offload, "host-cuda (x86_64--linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {10}, ir
12: backend, {11}, assembler, (host-cuda)
13: assembler, {12}, object, (host-cuda)

I'm trying to figure out now if there's something else that enforces that restriction, or the current compilation order being the right one is a happy coincidence that my patch happened to disturb. I'm new to the project, so I'm working under the assumption that I'm missing something, any hints will be appreciated :)


https://reviews.llvm.org/D33108





More information about the cfe-commits mailing list