This is an archive of the discontinued LLVM Phabricator instance.

[HIP] Fix duplicate clang -cc1 options on MSVC toolchain
ClosedPublic

Authored by yaxunl on Mar 11 2020, 3:26 PM.

Details

Summary

HIPToolChain::TranslateArgs call TranslateArgs of host toolchain with the input args to get a list of derived args called DAL, then
go through the input args by itself and append them to DAL.

This assumes that the host toolchain should not append any unchanged args to DAL, otherwise there will be duplicates since
HIPToolChain will append it again.

This works for GNU toolchain since it returns an empty list for DAL.

However, MSVC toolchain will append unchanged args to DAL, which causes duplicate args.

This patch let MSVC toolchain not append unchanged args for HIP offloading kind, which fixes this issue.

Diff Detail

Event Timeline

yaxunl created this revision.Mar 11 2020, 3:26 PM
tra added a reviewer: rnk.Mar 11 2020, 4:20 PM

LGTM, but I'm not familiar with the details of clang-cl. I've added Reid who'd have a better idea.

tra accepted this revision.Mar 18 2020, 10:34 AM
This revision is now accepted and ready to land.Mar 18 2020, 10:34 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2020, 11:58 AM