]> granicus.if.org Git - llvm/commitdiff
Merging r311565:
authorHans Wennborg <hans@hanshq.net>
Wed, 23 Aug 2017 21:30:37 +0000 (21:30 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 23 Aug 2017 21:30:37 +0000 (21:30 +0000)
------------------------------------------------------------------------
r311565 | hans | 2017-08-23 08:43:28 -0700 (Wed, 23 Aug 2017) | 8 lines

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

The lowering isn't really an optimization, so optnone shouldn't make a
difference. ARM relies on the pass running when using "-mthread-model
single", because in that mode, it doesn't run AtomicExpand. See bug for
more details.

Differential Revision: https://reviews.llvm.org/D37040
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@311602 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LowerAtomic.cpp
test/Feature/optnone-opt.ll
test/Transforms/LowerAtomic/atomic-swap.ll

index 08e60b16bedffcdd418b12c8d0b3c924af7fd37b..6f77c5bd0d07939d624e28c6aa47454195d2d626 100644 (file)
@@ -155,8 +155,7 @@ public:
   }
 
   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();
index 6410afb6be99a49a6671548706a50232d32881f3..ae0e1a48acc585d7b6c70d77d91b6aaf121eaeb8 100644 (file)
@@ -57,7 +57,6 @@ attributes #0 = { optnone noinline }
 ; 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 77000527a11f2c6f29126c14989751bb79b40b0b..59a5caed481cf1360cccca3cba7c0fb3d806684e 100644 (file)
@@ -26,3 +26,14 @@ define i8 @swap() {
   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]]
+}