aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/CGStmt.cpp7
-rw-r--r--test/CodeGen/asm-inout.c10
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index f4bc5afd09..5b17b7b900 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -909,13 +909,16 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
if (Info.isReadWrite()) {
InOutConstraints += ',';
+ const Expr *InputExpr = S.getOutputExpr(i);
+ llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, InOutConstraints);
+
if (Info.allowsRegister())
InOutConstraints += llvm::utostr(i);
else
InOutConstraints += OutputConstraint;
- InOutArgTypes.push_back(Dest.getAddress()->getType());
- InOutArgs.push_back(Dest.getAddress());
+ InOutArgTypes.push_back(Arg->getType());
+ InOutArgs.push_back(Arg);
}
}
diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c
index e0e42a319d..0d8dbdfb9d 100644
--- a/test/CodeGen/asm-inout.c
+++ b/test/CodeGen/asm-inout.c
@@ -1,8 +1,18 @@
// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t &&
// RUN: grep "load i8\*\*\* %p.addr" %t | count 1
+// XFAIL
// PR3800
void f(void **p)
{
__asm__ volatile("" :"+m"(*p));
}
+
+#if 0
+// FIXME: Once this works again, we must verify that the code below behaves as expected
+// See PR4677.
+void f() {
+ unsigned _data = 42;
+ __asm__("bswap %0":"+r"(_data));
+}
+#endif