HomePhabricator

[InstCombine] use nsw negation for abs libcalls

Description

[InstCombine] use nsw negation for abs libcalls

Also, produce the canonical IR abs (s<0) to be more efficient.

This is the libcall equivalent of the clang builtin change from:
rL333038

Pasting from that commit message:
The stdlib functions are defined in section 7.20.6.1 of the C standard with:
"If the result cannot be represented, the behavior is undefined."

That lets us mark the negation with 'nsw' because "sub i32 0, INT_MIN" would
be UB/poison.

Details

Committed
spatelMay 22 2018, 4:29 PM
Parents
rL333041: build: use cmake to find the libedit content
Branches
Unknown
Tags
Unknown