[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)
commit1b7b4b467f03322f37b20ccee5cdef0c9ecec5d4
tree6b287e8419167bbb4ca5f698c6e139f6b5c266e7
parentf6398fb72c9e2d224ecc837d0e5713e008afbcb2
[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

llvm-svn: 372409
llvm/include/llvm/IR/IntrinsicsMips.td
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Target/Sparc/SparcISelLowering.cpp