[PATCH] Legalize SetCC needs logical NOT

Pete Cooper peter_cooper at apple.com
Mon May 12 16:34:52 PDT 2014


Good catch!

Committed with the comment change in r208641.

Thanks for the review Hal.

Pete
On May 12, 2014, at 3:38 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> Peter,
> 
> 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.
> 
> -Hal
> 
> ----- 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140512/b09cbce8/attachment.html>


More information about the llvm-commits mailing list