This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Transform ABS(X) eq/ne 0/IntMin -> X eq/ne 0/IntMIn
AbandonedPublic

Authored by goldstein.w.n on Jan 26 2023, 1:38 PM.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Jan 26 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 1:38 PM
goldstein.w.n requested review of this revision.Jan 26 2023, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 1:38 PM
RKSimon added inline comments.Jan 27 2023, 3:29 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
11698

Isn't ISD::ABS always one operand? We don't have the INT_MIN handling in the DAG node:

/// ABS - Determine the unsigned absolute value of a signed integer value of
/// the same bitwidth.
/// Note: A value of INT_MIN will return INT_MIN, no saturation or overflow
/// is performed.
ABS,
goldstein.w.n added inline comments.Jan 27 2023, 10:43 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
11698

Isn't ISD::ABS always one operand? We don't have the INT_MIN handling in the DAG node:

/// ABS - Determine the unsigned absolute value of a signed integer value of
/// the same bitwidth.
/// Note: A value of INT_MIN will return INT_MIN, no saturation or overflow
/// is performed.
ABS,

You're right, will fix if go forward with the patch, although based on the comment in D142345 I think the consensus with this is truly unneeded so will likely abandon.

RKSimon edited the summary of this revision. (Show Details)Mar 14 2023, 8:34 AM

@goldstein.w.n reverse-ping - whats the plan for this patch?

goldstein.w.n abandoned this revision.Mar 22 2023, 10:45 AM

@goldstein.w.n reverse-ping - whats the plan for this patch?

Abandoning as its handled by the middle end.

@goldstein.w.n reverse-ping - whats the plan for this patch?

@RKSimon does this show up in any codegen that went throw the middle-end?

@goldstein.w.n reverse-ping - whats the plan for this patch?

@RKSimon does this show up in any codegen that went throw the middle-end?

There isn't that much in DAG that generates ABS nodes - foldAndOrOfSETCC is the closest to this I suppose?

@goldstein.w.n reverse-ping - whats the plan for this patch?

@RKSimon does this show up in any codegen that went throw the middle-end?

There isn't that much in DAG that generates ABS nodes - foldAndOrOfSETCC is the closest to this I suppose?

Yeah, and the pattern that would generate ABS IntMin/0 there are also handled by the middle end.
If a case were this is needed comes up, I can resubmit, but for now just seems like unnecessary codes.