]> granicus.if.org Git - llvm/commit
[SelectionDAG] TargetLowering::SimplifyDemandedBits how to properly calculate KnownZe...
authorCraig Topper <craig.topper@gmail.com>
Mon, 10 Apr 2017 07:06:44 +0000 (07:06 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 10 Apr 2017 07:06:44 +0000 (07:06 +0000)
commit1fafa7b072d516956f427b3a419cb782c67314ef
tree215f8076da2d944cd1b447182a70afa0b32e74a5
parent17e3b0ef514b74b33c8f2edaf0dc90e4f4e9d249
[SelectionDAG] TargetLowering::SimplifyDemandedBits how to properly calculate KnownZero bits for ISD::SETCC and ISD::AssertZExt

Summary:
For SETCC we aren't calculating the KnownZero bits at all. I've copied the code from computeKnownZero over for this.

For AssertZExt we were only setting KnownZero for bits that were demanded. But the upper bits are zero whether they were demanded or not.

I'm interested in fixing this because my belief is the first part of the ISD::AND handling code in SimplifyDemandedBits largely exists because of these two bugs. In that code we go to computeKnownBits for the LHS and optimize a RHS constant. Because computeKnownBits handles SETCC and AssertZExt correctly we get better information sometimes than when we call SimplifyDemandedBits on the LHS later. With these two issues fixed in SimplifyDemandedBits I was able to remove that computeKnownBits call and still pass all X86 tests. I'll submit that change in a separate patch.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31715

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299839 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/TargetLowering.cpp