In my project, I hope that compile an cu file using clang++ to LLVM IR. Then, an LLVM Pass is used via LLVM opt to optimize or analyze the produced LLVM IR. To achieve this goal, I learn about the compilation trajectory. I have read through The CUDA Compilation Trajectory in the this offics dos and understood the rough compilation trajectory using NVCC.
I also read through this offcis dos about compiling CUDA code via clang++. However, my question is if I used the following command to compile CUDA code(a .cu file) to LLVM IR, would it be possible that these produced files (axpy-cuda-nvptx64-nvidia-cuda-sm_86.ll and axpy.ll) could be further compiled and linked to be an executable just as the same executable produced by directly using NVCC?
Because these two files can be further compiled to PTX and x86 assembly file using llc. So the keypoiint of this question may become If I have two files, one of which is ptx file and the other x86 assembly, how to combine them to an executable?
FYI: The CUDA source code is here.
clang++ -S -emit-llvm --cuda-gpu-arch=sm_86 axpy.cu