Index: llvm/lib/CodeGen/TypePromotion.cpp =================================================================== --- llvm/lib/CodeGen/TypePromotion.cpp +++ llvm/lib/CodeGen/TypePromotion.cpp @@ -868,6 +868,8 @@ continue; } + if (isa(V)) + continue; if (Sinks.count(cast(V))) continue; ++ToPromote; Index: llvm/test/CodeGen/AArch64/atomic-ops.ll =================================================================== --- llvm/test/CodeGen/AArch64/atomic-ops.ll +++ llvm/test/CodeGen/AArch64/atomic-ops.ll @@ -979,24 +979,23 @@ ; INLINE_ATOMICS-LABEL: test_atomic_cmpxchg_i8: ; INLINE_ATOMICS: // %bb.0: ; INLINE_ATOMICS-NEXT: // kill: def $w1 killed $w1 def $x1 -; INLINE_ATOMICS-NEXT: and w8, w0, #0xff ; INLINE_ATOMICS-NEXT: adrp x9, var8 ; INLINE_ATOMICS-NEXT: add x9, x9, :lo12:var8 ; INLINE_ATOMICS-NEXT: .LBB40_1: // %cmpxchg.start ; INLINE_ATOMICS-NEXT: // =>This Inner Loop Header: Depth=1 -; INLINE_ATOMICS-NEXT: ldaxrb w0, [x9] -; INLINE_ATOMICS-NEXT: cmp w0, w8 +; INLINE_ATOMICS-NEXT: ldaxrb w8, [x9] +; INLINE_ATOMICS-NEXT: cmp w8, w0, uxtb ; INLINE_ATOMICS-NEXT: b.ne .LBB40_4 ; INLINE_ATOMICS-NEXT: // %bb.2: // %cmpxchg.trystore ; INLINE_ATOMICS-NEXT: // in Loop: Header=BB40_1 Depth=1 ; INLINE_ATOMICS-NEXT: stxrb w10, w1, [x9] ; INLINE_ATOMICS-NEXT: cbnz w10, .LBB40_1 ; INLINE_ATOMICS-NEXT: // %bb.3: // %cmpxchg.end -; INLINE_ATOMICS-NEXT: // kill: def $w0 killed $w0 killed $x0 +; INLINE_ATOMICS-NEXT: mov w0, w8 ; INLINE_ATOMICS-NEXT: ret ; INLINE_ATOMICS-NEXT: .LBB40_4: // %cmpxchg.nostore ; INLINE_ATOMICS-NEXT: clrex -; INLINE_ATOMICS-NEXT: // kill: def $w0 killed $w0 killed $x0 +; INLINE_ATOMICS-NEXT: mov w0, w8 ; INLINE_ATOMICS-NEXT: ret ; ; OUTLINE_ATOMICS-LABEL: test_atomic_cmpxchg_i8: @@ -1016,24 +1015,23 @@ ; INLINE_ATOMICS-LABEL: test_atomic_cmpxchg_i16: ; INLINE_ATOMICS: // %bb.0: ; INLINE_ATOMICS-NEXT: // kill: def $w1 killed $w1 def $x1 -; INLINE_ATOMICS-NEXT: and w8, w0, #0xffff ; INLINE_ATOMICS-NEXT: adrp x9, var16 ; INLINE_ATOMICS-NEXT: add x9, x9, :lo12:var16 ; INLINE_ATOMICS-NEXT: .LBB41_1: // %cmpxchg.start ; INLINE_ATOMICS-NEXT: // =>This Inner Loop Header: Depth=1 -; INLINE_ATOMICS-NEXT: ldaxrh w0, [x9] -; INLINE_ATOMICS-NEXT: cmp w0, w8 +; INLINE_ATOMICS-NEXT: ldaxrh w8, [x9] +; INLINE_ATOMICS-NEXT: cmp w8, w0, uxth ; INLINE_ATOMICS-NEXT: b.ne .LBB41_4 ; INLINE_ATOMICS-NEXT: // %bb.2: // %cmpxchg.trystore ; INLINE_ATOMICS-NEXT: // in Loop: Header=BB41_1 Depth=1 ; INLINE_ATOMICS-NEXT: stlxrh w10, w1, [x9] ; INLINE_ATOMICS-NEXT: cbnz w10, .LBB41_1 ; INLINE_ATOMICS-NEXT: // %bb.3: // %cmpxchg.end -; INLINE_ATOMICS-NEXT: // kill: def $w0 killed $w0 killed $x0 +; INLINE_ATOMICS-NEXT: mov w0, w8 ; INLINE_ATOMICS-NEXT: ret ; INLINE_ATOMICS-NEXT: .LBB41_4: // %cmpxchg.nostore ; INLINE_ATOMICS-NEXT: clrex -; INLINE_ATOMICS-NEXT: // kill: def $w0 killed $w0 killed $x0 +; INLINE_ATOMICS-NEXT: mov w0, w8 ; INLINE_ATOMICS-NEXT: ret ; ; OUTLINE_ATOMICS-LABEL: test_atomic_cmpxchg_i16: Index: llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll =================================================================== --- llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll +++ llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll @@ -52,17 +52,16 @@ define i1 @test_return_bool(i8* %value, i8 %oldValue, i8 %newValue) { ; CHECK-LABEL: test_return_bool: ; CHECK: ; %bb.0: -; CHECK-NEXT: and w8, w1, #0xff ; CHECK-NEXT: ; kill: def $w2 killed $w2 def $x2 ; CHECK-NEXT: LBB1_1: ; %cmpxchg.start ; CHECK-NEXT: ; =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: ldaxrb w9, [x0] -; CHECK-NEXT: cmp w9, w8 +; CHECK-NEXT: ldaxrb w8, [x0] +; CHECK-NEXT: cmp w8, w1, uxtb ; CHECK-NEXT: b.ne LBB1_4 ; CHECK-NEXT: ; %bb.2: ; %cmpxchg.trystore ; CHECK-NEXT: ; in Loop: Header=BB1_1 Depth=1 -; CHECK-NEXT: stlxrb w9, w2, [x0] -; CHECK-NEXT: cbnz w9, LBB1_1 +; CHECK-NEXT: stlxrb w8, w2, [x0] +; CHECK-NEXT: cbnz w8, LBB1_1 ; CHECK-NEXT: ; %bb.3: ; CHECK-NEXT: mov w8, #1 ; CHECK-NEXT: eor w0, w8, #0x1 Index: llvm/test/CodeGen/AArch64/typepromotion-cost.ll =================================================================== --- llvm/test/CodeGen/AArch64/typepromotion-cost.ll +++ llvm/test/CodeGen/AArch64/typepromotion-cost.ll @@ -15,7 +15,6 @@ ; CHECK-NEXT: .LBB0_3: ; CHECK-NEXT: mov w9, #1 ; CHECK-NEXT: .LBB0_4: // %lor.end.sink.split -; CHECK-NEXT: and w8, w8, #0xffff ; CHECK-NEXT: cmp w8, w9 ; CHECK-NEXT: cset w0, eq ; CHECK-NEXT: ret