[PATCH] Legalize SetCC needs logical NOT

Hal Finkel hfinkel at anl.gov
Mon May 12 15:38:45 PDT 2014


Yep, this looks reasonable. Please also update the comment above SelectionDAGLegalize::LegalizeSetCCCondCode which currently reads (in part):

/// If the SETCC has been legalized using the inverse condcode, then LHS and
/// RHS will be unchanged, CC will set to the inverted condcode, and NeedInvert
/// will be set to true. The caller must invert the result of the SETCC with
/// SelectionDAG::getNOT() or take equivalent action to swap the effect of a
/// true/false result.


----- Original Message -----
> From: "Pete Cooper" <peter_cooper at apple.com>
> To: "llvm-commits" <llvm-commits at cs.uiuc.edu>
> Sent: Monday, May 12, 2014 5:25:14 PM
> Subject: [PATCH] Legalize SetCC needs logical NOT
> Hi all
> Please review this patch to use a logical not when inverting a SetCC.
> The problem is that if I have something like
> i8 = setcc
> then using an xor with 0xFF will give the wrong answer when the
> boolean contents are ZeroOrOne.
> Unfortunately I couldn’t find a single target which goes wrong here
> so I can’t generate a test case. Putting ‘llvm_unreachable’ in here
> just doesn’t hit, but hopefully its clear from the patch that
> there’s an obvious issue.
> Thanks,
> Pete
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory

More information about the llvm-commits mailing list