llvm-project
d762bbb5 - [SafeStack] Stop emitting an invalid function annotation for the unsafe stack size (#229440)

Commit
10 days ago
[SafeStack] Stop emitting an invalid function annotation for the unsafe stack size (#229440) The verifier requires that annotation "operands must be a string or a tuple of strings", and code that reads annotations relies on this contract. But SafeStack stored the unsafe stack size as an integer in the function annotation `!{!"unsafe-stack-size", i32 N}`. The verifier only checked annotations on instructions, so this went unnoticed. `MachineFunction` read the value back with `mdconst::extract<ConstantInt>`, which asserts on any other operand, so a valid annotation of the same name with a string value asserted in codegen. Record the size in the `"unsafe-stack-size"` string function attribute instead, as is done for `"warn-stack-size"`, and check its value in the verifier. Also verify function annotations with `visitAnnotationMetadata`. Fixes #229406 Assisted-by: Claude Opus 5.5
Author
Parents
Loading