This is an archive of the discontinued LLVM Phabricator instance.

[Hexagon] Diagnose misaligned absolute loads and stores
ClosedPublic

Authored by kparzysz on Aug 7 2018, 12:49 PM.

Details

Summary

Print a meaningful message when a misaligned (compile-time) constant address is used.

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz created this revision.Aug 7 2018, 12:49 PM
tobiasvk accepted this revision.Aug 8 2018, 8:34 AM

Thanks, this is great!

This revision is now accepted and ready to land.Aug 8 2018, 8:34 AM
This revision was automatically updated to reflect the committed changes.

We generally prefer not to emit diagnostics for undefined behavior from the backend because the code might be dynamically unreachable (and the user might not be able to do anything about it if the code is unreachable because the compiler cloned the code).

This issue was detected in a customer code and it was actually a bug in it. We've decided to go this route to make it easier for customers to see what the problem is (and this scenario is almost guaranteed to be a source code bug).

jfb added a comment.Aug 8 2018, 1:57 PM

This issue was detected in a customer code and it was actually a bug in it. We've decided to go this route to make it easier for customers to see what the problem is (and this scenario is almost guaranteed to be a source code bug).

As @efriedma points out that's weird compared to the rest of LLVM. It'll be dependent on optimization levels, and might occur in dynamically-unreachable code. Can you instead detect this and transform it to a trap?

What we can do it convert it to a trap and emit a warning.