This can be beneficial if there is a fast ABS (For example with X86
vpabs) or if there is a dominating ABS(A) in the DAG.
Note C is constant so ABS(C) is just a constant.
Alive2 Links:
EQ: https://alive2.llvm.org/ce/z/829F-c
NE: https://alive2.llvm.org/ce/z/tsS8bU
I don't think this is an issue, but it looks "close" to causing an infinite loop.
In X86ISelLowering.cpp from D142345 there is a transform to covert scalar (icmp eq/ne (ABS A), C) -> the logicop/setcc pattern here that we are about to transform back to the ABS pattern. The (icmp eq/ne (ABS A), C) is guarded behind hasOneUse and this is guarded behind doesNodeExist so I believe its safe (after this transform the node will never have only one use), but whoever reviews should probably double check the reasoning/etc.