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
This commit is contained in:
Hans Wennborg 2017-08-23 15:43:28 +00:00
parent b2c0794e30
commit 66f6fc0a49
3 changed files with 12 additions and 3 deletions

View 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();

View 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'

View 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]]
}