Asm goto is not supported by SLH. Warn if an instance of asm goto is detected
while SLH is enabled.
Test included.
Differential D79743
[clang][asm goto][slh] Warn if asm goto + SLH zbrid on May 11 2020, 1:35 PM. Authored by
Details Asm goto is not supported by SLH. Warn if an instance of asm goto is detected Test included.
Diff Detail
Event TimelineComment Actions Two questions: Comment Actions
Comment Actions Understand, no problem! It to me, you can emit error somewhere in ParseAsmStatement when “goto” is parsed. Let me know if you have problem. Comment Actions Not sure we want to move this into the Parser -- SLH is a property of code generation, and I think it's possible (through LTO?) to mismatch the flags between parse and codegen.
Comment Actions This is frontend code generation or "IR generation". So it should't be possible to mismatch the flags. Comment Actions I don’t know what consequences is of using asm goto under SLH. In general, if asm-goto is not allowed, the diagnostic should be emitted during the parser. If asm-goto is not allowed under specified condition, the diagnostic should be emitted during sema. Diagnostic should not be emitted in the lower(codegen) in general (exception may be for target related). Comment Actions
This would be a compile time crash. At some point the X86SpeculativeLoadHardening pass in the backend will notice asm goto is being used and give up. As far as I can tell it's hard to determine that asm goto was the root cause of that crash in the backend, so I want to emit it earlier in Clang. Does that make sense? Let me know if not :)
Thanks for the pointer! I'll send an update that emits at that point. Ah okay. Asm goto isn't allowed with SLH in general, so sounds like this should be in the parser based on your comment here. Thanks for the explanation. Thanks for the comments, everyone.
Comment Actions This looks good to me. Could you also add a test to use this new DiagGroup (-Wno-slh-asm-goto)? Thanks. Jennifer Comment Actions LGTM. Please changed format for td file.
|
Just need run clang-format:
def warn_slh_does_not_support_asm_goto