summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-12-10 01:38:04 +0000
committerHans Wennborg <hans@hanshq.net>2015-12-10 01:38:04 +0000
commit2edb8fcf0dd66c86a9111c257de50652017fdfa4 (patch)
tree265729f9f9741850f9f0fe2fc57cb2d41e32cafc /clang/lib/CodeGen
parenteecc9e97d21536beed290d2fc7fe10f25e0ae08e (diff)
downloadbcm5719-llvm-2edb8fcf0dd66c86a9111c257de50652017fdfa4.tar.gz
bcm5719-llvm-2edb8fcf0dd66c86a9111c257de50652017fdfa4.zip
Mark MS inline ASM 'nodplicate' it it has labels (PR23715)
Duplicating it can lead to labels being defined twice. Differential revision: http://reviews.llvm.org/D15399 llvm-svn: 255201
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index b0ca80e9414..aae867bd3f8 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -1999,6 +1999,15 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
Result->addAttribute(llvm::AttributeSet::FunctionIndex,
llvm::Attribute::NoUnwind);
+ if (isa<MSAsmStmt>(&S)) {
+ // If the assembly contains any labels, mark the call noduplicate to prevent
+ // defining the same ASM label twice (PR23715). This is pretty hacky, but it
+ // works.
+ if (AsmString.find("__MSASMLABEL_") != std::string::npos)
+ Result->addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::NoDuplicate);
+ }
+
// Attach readnone and readonly attributes.
if (!HasSideEffect) {
if (ReadNone)
OpenPOWER on IntegriCloud