Skip to content

Commit 66f6fc0

Browse files
committedAug 23, 2017
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 llvm-svn: 311565
1 parent b2c0794 commit 66f6fc0

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed
 

‎llvm/lib/Transforms/Scalar/LowerAtomic.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ class LowerAtomicLegacyPass : public FunctionPass {
155155
}
156156

157157
bool runOnFunction(Function &F) override {
158-
if (skipFunction(F))
159-
return false;
158+
// Don't skip optnone functions; atomics still need to be lowered.
160159
FunctionAnalysisManager DummyFAM;
161160
auto PA = Impl.run(F, DummyFAM);
162161
return !PA.areAllPreserved();

‎llvm/test/Feature/optnone-opt.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ attributes #0 = { optnone noinline }
5757
; Additional IR passes that opt doesn't turn on by default.
5858
; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination'
5959
; OPT-MORE-DAG: Skipping pass 'Dead Instruction Elimination'
60-
; OPT-MORE-DAG: Skipping pass 'Lower atomic intrinsics
6160

6261
; Loop IR passes that opt doesn't turn on by default.
6362
; OPT-LOOP-DAG: Skipping pass 'Delete dead loops'

‎llvm/test/Transforms/LowerAtomic/atomic-swap.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@ define i8 @swap() {
2626
ret i8 %j
2727
; CHECK: ret i8 [[INST]]
2828
}
29+
30+
31+
define i8 @swap_optnone() noinline optnone {
32+
; CHECK-LABEL: @swap_optnone(
33+
%i = alloca i8
34+
%j = atomicrmw xchg i8* %i, i8 42 monotonic
35+
; CHECK: [[INST:%[a-z0-9]+]] = load
36+
; CHECK-NEXT: store
37+
ret i8 %j
38+
; CHECK: ret i8 [[INST]]
39+
}

0 commit comments

Comments
 (0)
Please sign in to comment.