Index: clang/lib/CodeGen/CGStmt.cpp =================================================================== --- clang/lib/CodeGen/CGStmt.cpp +++ clang/lib/CodeGen/CGStmt.cpp @@ -2094,25 +2094,23 @@ if (Info.allowsRegister() || !Info.allowsMemory()) { if (CodeGenFunction::hasScalarEvaluationKind(InputType)) { Arg = EmitLoadOfLValue(InputValue, Loc).getScalarVal(); - } else { - llvm::Type *Ty = ConvertType(InputType); - uint64_t Size = CGM.getDataLayout().getTypeSizeInBits(Ty); - if (Size <= 64 && llvm::isPowerOf2_64(Size)) { - Ty = llvm::IntegerType::get(getLLVMContext(), Size); - Ty = llvm::PointerType::getUnqual(Ty); - - Arg = Builder.CreateLoad( - Builder.CreateBitCast(InputValue.getAddress(*this), Ty)); - } else { - Arg = InputValue.getPointer(*this); - ConstraintStr += '*'; - } + return Arg; + } + llvm::Type *Ty = ConvertType(InputType); + uint64_t Size = CGM.getDataLayout().getTypeSizeInBits(Ty); + if (Size <= 64 && llvm::isPowerOf2_64(Size)) { + Ty = llvm::IntegerType::get(getLLVMContext(), Size); + Ty = llvm::PointerType::getUnqual(Ty); + Arg = Builder.CreateLoad( + Builder.CreateBitCast(InputValue.getAddress(*this), Ty)); + return Arg; } - } else { - Arg = InputValue.getPointer(*this); - ConstraintStr += '*'; } + Arg = InputValue.getPointer(*this); + if (!isa(InputType)) + ConstraintStr += '*'; + return Arg; } Index: clang/test/CodeGen/X86/inline_asm_blocks_call.c =================================================================== --- /dev/null +++ clang/test/CodeGen/X86/inline_asm_blocks_call.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -O0 -fasm-blocks -triple=x86_64-unknown-unknown -mrelocation-model pic -pic-level 1 -S -emit-llvm -o - -Wall -Werror | FileCheck %s + +extern void sincos_asm (); + +void foo () +{ +// The constrain of "void (...)* @sincos_asm" for call in inline asm should be 'm' not indirect address "*m". +// CHECK: call void asm sideeffect inteldialect "call qword ptr ${0:P}\0A\09ret", "m,~{dirflag},~{fpsr},~{flags}"(void (...)* @sincos_asm) + __asm{ + call sincos_asm + ret }; +}