Please review and commit changes.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/CodeGen/opencl-RSH-signed.c | ||
---|---|---|
2 ↗ | (On Diff #45673) | This won't work. You need some sort of -verify in order to "expected-no-disagnostics" to work. |
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2716 | Is this an OpenCL specific thing? If yes - it should at least be guarded. I believe this is the case when C99 and OpenCL disagrees. Also, please familiarize yourself with http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface (e.g. you need to create more context in the diff, etc.). | |
test/CodeGenOpenCL/opencl_rhs_signed.cl | ||
1 | Why you're having non-OpenCL-specific test in OpenCL dir? | |
6 | And? You need to check for the generated IR at least. |
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2716 | Yes, it's not OpenCL specific. Changing r-operator type signed to unsigned while performing << is the bug (despite that negative RHS is undefined for C++). |
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2716 | Why it's a bug for non-OpenCL? Please elaborate (citing the standard, if possible). | |
test/CodeGen/rhs_signed_check.c | ||
5 ↗ | (On Diff #46115) | Do you really need to check for all these stuff? Can't you simply check only for the instructions which are relevant for your patch? |
test/CodeGen/rhs_signed_check.c | ||
---|---|---|
5 ↗ | (On Diff #46115) | I analyzed IR and didn't find a no one line to remove. |
test/CodeGen/rhs_signed_check.c | ||
---|---|---|
5 ↗ | (On Diff #46115) | Sorry, what? The main difference in the generated IR before and after patch is zext => sext before shl. Everything else is heavily irrelevant. |
test/CodeGen/rhs_signed_check.c | ||
---|---|---|
6 ↗ | (On Diff #46120) | IR Code portion reduced in patch. |
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2716 | The OpenCL 2.0 standard does not say anything about right operand sign of shift operators. C standard says the behavior is undefined: In C++11 standard said the same: I.e., we can close this bug as NAB and do not apply patch. |
lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2716 | I agree that it would be abstractly better to sign-extend the RHS if it's a signed type. Please do this for both << and >>, and please make sure your test covers <<= and >>= as well. Also, please use cast<> for unconditional casts instead of dyn_cast. |
Is this an OpenCL specific thing? If yes - it should at least be guarded. I believe this is the case when C99 and OpenCL disagrees.
Also, please familiarize yourself with http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface (e.g. you need to create more context in the diff, etc.).