[PATCH] D37040: LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 08:44:38 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311565: LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020) (authored by hans).

Changed prior to commit:
  https://reviews.llvm.org/D37040?vs=112263&id=112374#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37040

Files:
  llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
  llvm/trunk/test/Feature/optnone-opt.ll
  llvm/trunk/test/Transforms/LowerAtomic/atomic-swap.ll


Index: llvm/trunk/test/Feature/optnone-opt.ll
===================================================================
--- llvm/trunk/test/Feature/optnone-opt.ll
+++ llvm/trunk/test/Feature/optnone-opt.ll
@@ -57,7 +57,6 @@
 ; Additional IR passes that opt doesn't turn on by default.
 ; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; OPT-MORE-DAG: Skipping pass 'Dead Instruction Elimination'
-; OPT-MORE-DAG: Skipping pass 'Lower atomic intrinsics
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; OPT-LOOP-DAG: Skipping pass 'Delete dead loops'
Index: llvm/trunk/test/Transforms/LowerAtomic/atomic-swap.ll
===================================================================
--- llvm/trunk/test/Transforms/LowerAtomic/atomic-swap.ll
+++ llvm/trunk/test/Transforms/LowerAtomic/atomic-swap.ll
@@ -26,3 +26,14 @@
   ret i8 %j
 ; CHECK: ret i8 [[INST]]
 }
+
+
+define i8 @swap_optnone() noinline optnone {
+; CHECK-LABEL: @swap_optnone(
+  %i = alloca i8
+  %j = atomicrmw xchg i8* %i, i8 42 monotonic
+; CHECK: [[INST:%[a-z0-9]+]] = load
+; CHECK-NEXT: store
+  ret i8 %j
+; CHECK: ret i8 [[INST]]
+}
Index: llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
@@ -155,8 +155,7 @@
   }
 
   bool runOnFunction(Function &F) override {
-    if (skipFunction(F))
-      return false;
+    // Don't skip optnone functions; atomics still need to be lowered.
     FunctionAnalysisManager DummyFAM;
     auto PA = Impl.run(F, DummyFAM);
     return !PA.areAllPreserved();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37040.112374.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170823/31a5c489/attachment.bin>


More information about the llvm-commits mailing list