-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector related arith missing nsw
on addition
#664
Comments
I can repro this for just scalar arith, too. See this program. I guess we are missing the corresponding logic in ScalarExprEmitter. The lowering is correct however. clangir/clang/lib/CodeGen/CGExprScalar.cpp Lines 4096 to 4111 in 76f7488
|
I checked and it seems Subop has already done this logic, so if no one else has done it, it can be assigned to me clangir/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp Lines 1317 to 1338 in 9720c61
|
…perator (#677) This PR is to fix the missing **nsw** flag in issue #664 regarding add, mul arithmetic operations. there is also a problem with unary operations such as **Inc ,Dec,Plus,Minus and Not** . which should also have 'nsw' flag [example](https://godbolt.org/z/q3o3jsbe1). This part should need to be fixed through lowering.
If we look at how LLVM currently codegen for this, we get a
add nsw
instead of a plainadd
, see https://godbolt.org/z/xdevh38r8. There are probably other differences too.Originally posted by @bcardosolopes in #613 (comment)
The text was updated successfully, but these errors were encountered: