Index: lib/Transforms/NaCl/PNaClABISimplify.cpp |
diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp |
index 4f8e0e4f877286a75b820e7da620fe30cb8a7f30..f662ada99a30d1bd13f4b5c4cfb640a09de4e201 100644 |
--- a/lib/Transforms/NaCl/PNaClABISimplify.cpp |
+++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp |
@@ -30,10 +30,8 @@ void llvm::PNaClABISimplifyAddPreOptPasses(PassManager &PM) { |
// LowerExpect converts Intrinsic::expect into branch weights, |
// which can then be removed after BlockPlacement. |
PM.add(createLowerExpectIntrinsicPass()); |
- // Rewrite unsupported intrinsics and inline assembly directives to |
- // simpler and portable constructs. |
+ // Rewrite unsupported intrinsics to simpler and portable constructs. |
PM.add(createRewriteLLVMIntrinsicsPass()); |
- PM.add(createRewriteAsmDirectivesPass()); |
// LowerInvoke prevents use of C++ exception handling, which is not |
// yet supported in the PNaCl ABI. |
PM.add(createLowerInvokePass()); |
@@ -98,6 +96,10 @@ void llvm::PNaClABISimplifyAddPostOptPasses(PassManager &PM) { |
PM.add(createExpandGetElementPtrPass()); |
// Rewrite atomic and volatile instructions with intrinsic calls. |
PM.add(createRewriteAtomicsPass()); |
+ // Remove ``asm("":::"memory")``. This must occur after rewriting |
+ // atomics: a ``fence seq_cst`` surrounded by ``asm("":::"memory")`` |
+ // has special meaning and is translated differently. |
+ PM.add(createRemoveAsmMemoryPass()); |
// ReplacePtrsWithInts assumes that getelementptr instructions and |
// ConstantExprs have already been expanded out. |
PM.add(createReplacePtrsWithIntsPass()); |