Meinersbur requested changes to this revision.
Meinersbur added a comment.
This revision now requires changes to proceed.
Herald added a project: All.
`speculable` implies no undefined behavior (so it can even be speculatively
executed with arguments when the source code would not, but its result
efriedma added a comment.
Consider something like this:
define i32 @div(i32 %x, i32 %y) {
entry:
%div = sdiv i32 %x, %y
ret i32 %div
}
We can mark this function readnone, but not speculatable: it doesn't read or
write memory, but could exhibit undefined behavior.
Consider another
Meinersbur added a comment.
Definition of `__attibute__((const))` from
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
> Many functions do not examine any values except their arguments, and have no
> effects except the return value. Basically this i
grosser created this revision.
Herald added subscribers: javed.absar, wdng.
Today 'const' functions are only marked 'readnone' and 'nounwind', but lack the
'speculatable' attribute for historic reasons. As 'const' functions are known to
not have any side effects and are intended to enable loop opt