If an input constraint refers to an output constraint, it should have the same constraint info as the output constraint. Fixes PR3417
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63127 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 4adff72..939ebec 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -932,7 +932,9 @@
std::string InOutConstraints;
std::vector<llvm::Value*> InOutArgs;
std::vector<const llvm::Type*> InOutArgTypes;
-
+
+ llvm::SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos;
+
for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) {
std::string OutputConstraint(S.getOutputConstraint(i)->getStrData(),
S.getOutputConstraint(i)->getByteLength());
@@ -942,6 +944,8 @@
Info);
assert(result && "Failed to parse output constraint"); result=result;
+ OutputConstraintInfos.push_back(Info);
+
// Simplify the output constraint.
OutputConstraint = SimplifyConstraint(OutputConstraint.c_str() + 1, Target);
@@ -993,6 +997,7 @@
bool result = Target.validateInputConstraint(InputConstraint.c_str(),
S.begin_output_names(),
S.end_output_names(),
+ &OutputConstraintInfos[0],
Info); result=result;
assert(result && "Failed to parse input constraint");