TargetLowering: Don't index into empty string.
authorWill Dietz <wdietz2@illinois.edu>
Sun, 13 Oct 2013 03:08:49 +0000 (03:08 +0000)
committerWill Dietz <wdietz2@illinois.edu>
Sun, 13 Oct 2013 03:08:49 +0000 (03:08 +0000)
(This is triggered by current lit tests)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192549 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 05b025c1482e5403363342c40ecf61d5f3c12bae..17631c0c9d9f089141375aed926003e337ffecde 100644 (file)
@@ -2012,7 +2012,7 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
 std::pair<unsigned, const TargetRegisterClass*> TargetLowering::
 getRegForInlineAsmConstraint(const std::string &Constraint,
                              MVT VT) const {
-  if (Constraint[0] != '{')
+  if (Constraint.empty() || Constraint[0] != '{')
     return std::make_pair(0u, static_cast<TargetRegisterClass*>(0));
   assert(*(Constraint.end()-1) == '}' && "Not a brace enclosed constraint?");