[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)

Yingwei Zheng via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 31 18:50:57 PDT 2025


dtcxzyw wrote:

> > The ubsan handler cannot be eliminated because inaccessiblemem: readwrite indicates that it has externally observable side effects.
> 
> That is not how things work. For example:
> 
> ```
> $ echo "declare void @g() define void @f() nounwind { call void @g() memory(argmem: read, inaccessiblemem: readwrite) willreturn unreachable }" | opt -O3 -S
> ; ModuleID = '<stdin>'
> source_filename = "<stdin>"
> 
> ; Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none)
> define void @f() local_unnamed_addr #0 {
>   unreachable
> }
> 
> attributes #0 = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) }
> ```

Fixed. Now it sets `mustprogress`.


https://github.com/llvm/llvm-project/pull/130990


More information about the cfe-commits mailing list