Skip to content

Conversation

@abadams
Copy link
Member

@abadams abadams commented Dec 12, 2022

Also, use compiler intrinsics when possible to handle overflow, as it generates faster code.

Fixes #7229

Also, use compiler intrinsics when possible to handle overflow, as it
generates faster code.
Copy link
Contributor

@steven-johnson steven-johnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I will pull this into Google for testing

@steven-johnson
Copy link
Contributor

src\CMakeFiles\Halide.dir\Util.cpp.obj /Fdsrc\CMakeFiles\Halide.dir\ /FS -c D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp
D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(529): error C3861: '__builtin_saddll_overflow': identifier not found
D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(557): error C3861: '__builtin_ssubll_overflow': identifier not found
D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(597): error C3861: '__builtin_smulll_overflow': identifier not found

@abadams
Copy link
Member Author

abadams commented Dec 12, 2022

src\CMakeFiles\Halide.dir\Util.cpp.obj /Fdsrc\CMakeFiles\Halide.dir\ /FS -c D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(529): error C3861: '__builtin_saddll_overflow': identifier not found D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(557): error C3861: '__builtin_ssubll_overflow': identifier not found D:\build_bot\worker\halide-testbranch-main-llvm16-x86-32-windows-cmake\halide-source\src\Util.cpp(597): error C3861: '__builtin_smulll_overflow': identifier not found

Oops, it's _MSC_VER, not __MSC_VER

@steven-johnson
Copy link
Contributor

Still failing ~every Windows test

@steven-johnson
Copy link
Contributor

Google integrate looks clean, just need to figure out Windows

@abadams abadams merged commit 1a4a469 into main Dec 13, 2022
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
)

* Fix some sources of signed integer overflow in the compiler

Also, use compiler intrinsics when possible to handle overflow, as it
generates faster code.

* Fix msvc macro

* Must use result

* Actually perform the requested operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASAN reports signed-integer-overflow in correctness_intrinsics and correctness_code_explosion

3 participants