diff options
-rw-r--r-- | lib/Transforms/Scalar/LowerAtomic.cpp | 3 | ||||
-rw-r--r-- | test/Feature/optnone-opt.ll | 1 | ||||
-rw-r--r-- | test/Transforms/LowerAtomic/atomic-swap.ll | 11 |
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LowerAtomic.cpp b/lib/Transforms/Scalar/LowerAtomic.cpp index 08e60b16bed..6f77c5bd0d0 100644 --- a/lib/Transforms/Scalar/LowerAtomic.cpp +++ b/lib/Transforms/Scalar/LowerAtomic.cpp @@ -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(); diff --git a/test/Feature/optnone-opt.ll b/test/Feature/optnone-opt.ll index 6410afb6be9..ae0e1a48acc 100644 --- a/test/Feature/optnone-opt.ll +++ b/test/Feature/optnone-opt.ll @@ -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' diff --git a/test/Transforms/LowerAtomic/atomic-swap.ll b/test/Transforms/LowerAtomic/atomic-swap.ll index 77000527a11..59a5caed481 100644 --- a/test/Transforms/LowerAtomic/atomic-swap.ll +++ b/test/Transforms/LowerAtomic/atomic-swap.ll @@ -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]] +} |