mstorsjo wrote:

With https://martin.st/temp/abs-preproc.cpp as input, I run `clang -target 
i686-w64-mingw32 abs-preproc.cpp -fsanitize=signed-integer-overflow -w -O3 -S 
-emit-llvm -o abs-out.ll`, and I get the following diff of the output IR after 
this change:
```diff
--- abs-good.ll 2025-04-20 00:10:20.155904358 +0300
+++ abs-bad.ll  2025-04-20 00:10:30.432882049 +0300
@@ -14,7 +14,7 @@
 @7 = private unnamed_addr global { { ptr, i32, i32 }, ptr } { { ptr, i32, i32 
} { ptr @.src, i32 481, i32 19 }, ptr @6 }
 @8 = private unnamed_addr global { { ptr, i32, i32 }, ptr } { { ptr, i32, i32 
} { ptr @.src, i32 482, i32 9 }, ptr @6 }
 
-; Function Attrs: mustprogress norecurse nounwind
+; Function Attrs: mustprogress norecurse nounwind memory(read, argmem: none, 
inaccessiblemem: readwrite)
 define dso_local noundef i32 @main() local_unnamed_addr #0 {
 entry:
   %tmp = alloca i64, align 8
@@ -23,20 +23,18 @@
   tail call void @__ubsan_handle_negate_overflow(ptr nonnull @2, i32 
-2147483648) #2, !nosanitize !6
   tail call void @__ubsan_handle_negate_overflow(ptr nonnull @4, i32 
-2147483648) #2, !nosanitize !6
   tail call void @__ubsan_handle_negate_overflow(ptr nonnull @5, i32 
-2147483648) #2, !nosanitize !6
-  store i64 -9223372036854775808, ptr %tmp, align 8, !nosanitize !6
   %0 = ptrtoint ptr %tmp to i32, !nosanitize !6
   call void @__ubsan_handle_negate_overflow(ptr nonnull @7, i32 %0) #2, 
!nosanitize !6
-  store i64 -9223372036854775808, ptr %tmp14, align 8, !nosanitize !6
   %1 = ptrtoint ptr %tmp14 to i32, !nosanitize !6
   call void @__ubsan_handle_negate_overflow(ptr nonnull @8, i32 %1) #2, 
!nosanitize !6
   ret i32 0
 }
 
-; Function Attrs: uwtable
+; Function Attrs: memory(argmem: read, inaccessiblemem: readwrite) uwtable
 declare dso_local void @__ubsan_handle_negate_overflow(ptr, i32) 
local_unnamed_addr #1
 
-attributes #0 = { mustprogress norecurse nounwind "min-legal-vector-width"="0" 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="pentium4" 
"target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
-attributes #1 = { uwtable }
+attributes #0 = { mustprogress norecurse nounwind memory(read, argmem: none, 
inaccessiblemem: readwrite) "min-legal-vector-width"="0" 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="pentium4" 
"target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { memory(argmem: read, inaccessiblemem: readwrite) uwtable }
 attributes #2 = { nounwind }
 
 !llvm.module.flags = !{!0, !1, !2}
```

https://github.com/llvm/llvm-project/pull/135135
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to