]> granicus.if.org Git - llvm/commit
[SelectionDAG][Mips][Sparc] Don't allow SimplifyDemandedBits to constant fold TargetC...
authorCraig Topper <craig.topper@intel.com>
Fri, 20 Sep 2019 16:49:51 +0000 (16:49 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 20 Sep 2019 16:49:51 +0000 (16:49 +0000)
commit483a636ee08d880b0986ff7a342546b938ae1ab1
tree5f08aa63984f0982dc3f0be02e5d0c5b88f55f92
parentd3eb1f30d5bbe514bc61642602d66835b6f9f5f6
[SelectionDAG][Mips][Sparc] Don't allow SimplifyDemandedBits to constant fold TargetConstant nodes to a Constant.

Summary:
After the switch in SimplifyDemandedBits, it tries to create a
constant when possible. If the original node is a TargetConstant
the default in the switch will call computeKnownBits on the
TargetConstant which will succeed. This results in the
TargetConstant becoming a Constant. But TargetConstant exists to
avoid being changed.

I've fixed the two cases that relied on this in tree by explicitly
making the nodes constant instead of target constant. The Sparc
case is an old bug. The Mips case was recently introduced now that
ImmArg on intrinsics gets turned into a TargetConstant when the
SelectionDAG is created. I've removed the ImmArg since it lowers
to generic code.

Reviewers: arsenm, RKSimon, spatel

Subscribers: jyknight, sdardis, wdng, arichardson, hiraditya, fedor.sergeev, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372409 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/IntrinsicsMips.td
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/Target/Sparc/SparcISelLowering.cpp