| Issue |
110325
|
| Summary |
-Xarch_device fails to propagate -O1
|
| Labels |
new issue
|
| Assignees |
yxsamliu
|
| Reporter |
Artem-B
|
Clang reports an error if one attempts to pass `-O1` to a CUDA/HIP sib-compilation via `-Xarch_device`:
```
bin/clang++ -x cuda /dev/null --offload-arch=sm_60 -Xarch_device -O1 -c -o /tmp/foo.o -nocudainc -nocudalib
clang++: error: invalid Xarch argument: '-Xarch_device -O1', not all driver options can be forwared via Xarch argument
clang++: error: invalid Xarch argument: '-Xarch_device -O1', not all driver options can be forwared via Xarch argument
```
It appears to be a bug. The code that handles `-Xarch..` options appears to misinterpret `-O1` as a clang-cl option "/O":
```
p *XarchArg->getOption().Info
$41 = {
Prefixes = llvm::ArrayRef of length 2 = {
{
<llvm::StringRef> = "/", <No data fields>},
{
<llvm::StringRef> = "-", <No data fields>}
},
PrefixedName = {
<llvm::StringRef> = "/O", <No data fields>},
HelpText = 0x55fb406ce5d4 "Set multiple /O flags at once; e.g. '/O2y-' for '/O2 /Oy-'",
HelpTextsForVariants = {
_M_elems = {
{
first = {
_M_elems = {
0,
0
}
},
second = 0x0
}
}
},
MetaVar = 0x55fb402591a2 "<flags>",
ID = 3005,
Kind = 4 '\004',
Param = 0 '\000',
Flags = 16,
Visibility = 66,
GroupID = 20,
AliasID = 0,
AliasArgs = 0x0,
Values = 0x0
}
```
This is the option here: https://github.com/llvm/llvm-project/blob/63899748738ce7449e46eebb1aeb7909f2fdea2b/clang/include/clang/Driver/Options.td#L8465
The option has `NoXarchOption` flag set, which triggers the error.
The correct option should've been this one:
https://github.com/llvm/llvm-project/blob/63899748738ce7449e46eebb1aeb7909f2fdea2b/clang/include/clang/Driver/Options.td#L929
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs