Skip to content

Commit 6caf0af

Browse files
committed
Fixed comments
1 parent a803bc5 commit 6caf0af

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

lib/Driver/ToolChains/Cuda.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -856,16 +856,10 @@ void CudaToolChain::AddFlangSystemIncludeArgs(const llvm::opt::ArgList &DriverAr
856856
llvm::opt::ArgStringList &Flang1Args) const {
857857
path_list IncludePathList;
858858
const Driver &D = getDriver();
859-
860-
861859
if (DriverArgs.hasArg(options::OPT_nostdinc))
862860
return;
863-
864-
{
865-
SmallString<128> P(D.InstalledDir);
866-
llvm::sys::path::append(P, "../include");
867-
IncludePathList.push_back(P.str());
868-
}
869-
861+
SmallString<128> P(D.InstalledDir);
862+
llvm::sys::path::append(P, "../include");
863+
IncludePathList.push_back(P.str());
870864
AddFlangSysIncludeArg(DriverArgs, Flang1Args, IncludePathList);
871865
}

lib/Driver/ToolChains/Flang.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
4545
ArgStringList UpperCmdArgs;
4646
ArgStringList LowerCmdArgs;
4747
SmallString<256> Stem;
48-
SmallString<256> Path;
4948
std::string OutFile;
5049
bool NeedIEEE = false;
5150
bool NeedFastMath = false;
@@ -54,8 +53,6 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
5453
// Check number of inputs for sanity. We need at least one input.
5554
assert(Inputs.size() >= 1 && "Must have at least one input.");
5655

57-
bool IsOpenMPDevice = JA.isDeviceOffloading(Action::OFK_OpenMP);
58-
5956
/***** Process file arguments to both parts *****/
6057
const InputInfo &Input = Inputs[0];
6158
types::ID InputType = Input.getType();
@@ -795,6 +792,7 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
795792
UpperCmdArgs.push_back("-output");
796793
UpperCmdArgs.push_back(ILMFile);
797794

795+
SmallString<256> Path;
798796
if(Args.getAllArgValues(options::OPT_fopenmp_targets_EQ).size() > 0) {
799797
SmallString<128> TargetInfo;
800798
Path = llvm::sys::path::parent_path(Output.getFilename());
@@ -918,12 +916,13 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
918916
LowerCmdArgs.push_back("-stbfile");
919917
LowerCmdArgs.push_back(STBFile);
920918

919+
Path = llvm::sys::path::parent_path(Output.getFilename());
920+
bool IsOpenMPDevice = JA.isDeviceOffloading(Action::OFK_OpenMP);
921+
921922
/* OpenMP GPU Offload */
922923
if(Args.getAllArgValues(options::OPT_fopenmp_targets_EQ).size() > 0) {
923-
//if (isa<CompileJobAction>(JA) && JA.isHostOffloading(Action::OFK_OpenMP)) {
924924
SmallString<128> TargetInfo;//("-fopenmp-targets ");
925925
SmallString<256> TargetInfoAsm;//("-fopenmp-targets-asm ");
926-
Path = llvm::sys::path::parent_path(Output.getFilename());
927926

928927
Arg* Tgts = Args.getLastArg(options::OPT_fopenmp_targets_EQ);
929928
assert(Tgts && Tgts->getNumValues() &&
@@ -943,6 +942,9 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
943942
TargetInfoAsm += T.getTriple();
944943
TargetInfoAsm += ".ll";
945944
}
945+
// The driver is aware that flang2 can generate multiple files at the same time.
946+
// We mimic it here by exchanging the output files.
947+
// The driver always uses the output file of -asm.
946948
LowerCmdArgs.push_back("-fopenmp-targets");
947949
LowerCmdArgs.push_back(Args.MakeArgString(TargetInfo.str()));
948950
if(IsOpenMPDevice) {

0 commit comments

Comments
 (0)