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.
Yeah its called from visitUnaryIntrinsic. This intrinsic is binary because of the nsw argument. I could add it to IsIdempotentand add another call to isIdempotent to the top of visitBinaryIntrinsic, but I thought with the oddity of nsw handling abs directly might be more clear.
LG. This has some overlap with D85043, which will already catch the cases where the inner abs has poison=true, but not those with poison=false, so this seems reasonable as an explicit fold. One could make an argument that this should live in InstCombine and try to preserve the outer poison flag, but this doesn't seem particularly important to me.