LTO scan of module-level inline assembly does not respect CPU (original) (raw)

The scan of module-level inline assembly performed to extract the referenced symbols does not forward the CPU specified on the clang command line. Because of this, opcodes that are only legal in that CPU will cause the compile to fail in -flto where it would have succeeded without. For example:

asm(".globl func; func: cm.mvsa01 s1, s0; ret");

This succeeds when compiled for RISC-V -march=rv64izcmp (https://godbolt.org/z/8dxT3nxs9), but fails when -flto is added (https://godbolt.org/z/GK5ohKnK9).

See

T->createMCSubtargetInfo(TT.str(), "", ""));