This only seems to affect some targets: X86 is not affected but ARM and AArch64 are. $ cat clang_asm.c void foo() { asm("nowayisthisavalidinstruction"); } $ clang -target arm-unknown-linux-gnueabihf clang_asm.c -O0 <inline asm>:1:2: error: invalid instruction nowayisthisavalidinstruction ^ 1 error generated. $ clang -target arm-unknown-linux-gnueabihf clang_asm.c -O1 clang_asm.c:2:9: error: invalid instruction asm("nowayisthisavalidinstruction"); ^ <inline asm>:1:2: note: instantiated into assembly here nowayisthisavalidinstruction ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. The metadata seems to get lost in the instruction selection pass: //// -O0 *** IR Dump After Safe Stack instrumentation pass *** ; Function Attrs: noinline nounwind optnone sspstrong define dso_local void @foo() #0 { call void asm sideeffect "nowayisthisavalidinstruction", ""() #1, !srcloc !5 ret void } # *** IR Dump After ARM Instruction Selection ***: # Machine code for function foo: IsSSA, TracksLiveness bb.0 (%ir-block.0): INLINEASM &nowayisthisavalidinstruction [sideeffect] [attdialect] BX_RET 14, $noreg # End machine code for function foo. //// -O1 *** IR Dump After Safe Stack instrumentation pass *** ; Function Attrs: nounwind sspstrong define dso_local void @foo() local_unnamed_addr #0 { call void asm sideeffect "nowayisthisavalidinstruction", ""() #1, !srcloc !5 ret void } # *** IR Dump After ARM Instruction Selection ***: # Machine code for function foo: IsSSA, TracksLiveness bb.0 (%ir-block.0): INLINEASM &nowayisthisavalidinstruction [sideeffect] [attdialect], !5 BX_RET 14, $noreg # End machine code for function foo.
Fixed by https://reviews.llvm.org/rG6973125cb746e185fc5e7823ec6422fc0670e15d