diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 20 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 6 | 
2 files changed, 23 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 87ace6f66b0..148a3805b3b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -31,6 +31,7 @@  #include "llvm/CodeGen/MachineFrameInfo.h"  #include "llvm/CodeGen/MachineFunction.h"  #include "llvm/CodeGen/MachineMemOperand.h" +#include "llvm/CodeGen/MachineRegisterInfo.h"  #include "llvm/CodeGen/RuntimeLibcalls.h"  #include "llvm/CodeGen/SelectionDAGAddressAnalysis.h"  #include "llvm/CodeGen/SelectionDAGNodes.h" @@ -3202,6 +3203,25 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,      Known.One &= Known2.One;      break;    } +  case ISD::CopyFromReg: { +    auto R = cast<RegisterSDNode>(Op.getOperand(1)); +    const unsigned Reg = R->getReg(); + +    const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); +    if (!TRI->isVirtualRegister(Reg)) +      break; + +    const MachineRegisterInfo *MRI = &MF->getRegInfo(); +    if (!MRI->hasOneDef(Reg)) +      break; + +    const FunctionLoweringInfo::LiveOutInfo *LOI = FLI->GetLiveOutRegInfo(Reg); +    if (!LOI || LOI->Known.getBitWidth() != BitWidth) +      break; + +    Known = LOI->Known; +    break; +  }    case ISD::FrameIndex:    case ISD::TargetFrameIndex:      TLI->computeKnownBitsForFrameIndex(Op, Known, DemandedElts, *this, Depth); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 061a7d9b8f3..f1047aeae6b 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -19580,10 +19580,10 @@ static SDValue LowerAndToBT(SDValue And, ISD::CondCode CC,        DAG.MaskedValueIsZero(BitNo, APInt(BitNo.getValueSizeInBits(), 32)))      Src = DAG.getNode(ISD::TRUNCATE, dl, MVT::i32, Src); -  // If the operand types disagree, extend the shift amount to match.  Since -  // BT ignores high bits (like shifts) we can use anyextend. +  // If the operand types disagree, extend or truncate the shift amount to match. +  // Since BT ignores high bits (like shifts) we can use anyextend for the extension.    if (Src.getValueType() != BitNo.getValueType()) -    BitNo = DAG.getNode(ISD::ANY_EXTEND, dl, Src.getValueType(), BitNo); +    BitNo = DAG.getAnyExtOrTrunc(BitNo, dl, Src.getValueType());    X86CC = DAG.getConstant(CC == ISD::SETEQ ? X86::COND_AE : X86::COND_B,                            dl, MVT::i8);  | 

