[InstSimplify] Fold abs(abs(x)) -> abs(x)
authorCraig Topper <craig.topper@intel.com>
Sat, 1 Aug 2020 17:01:58 +0000 (10:01 -0700)
committerCraig Topper <craig.topper@intel.com>
Sat, 1 Aug 2020 20:25:00 +0000 (13:25 -0700)
commit85b5315dbe9d52766ab326e702d638fcf58579b5
tree6ce4ce0172fdd11d0b7ae1d3048ba9db191e2c36
parent4a19e6156ed5b6e87d708e6de29b675be69c574f
[InstSimplify] Fold abs(abs(x)) -> abs(x)

It's always safe to pick the earlier abs regardless of the nsw flag. We'll just lose it if it is on the outer abs but not the inner abs.

Differential Revision: https://reviews.llvm.org/D85053
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/call.ll