# RUN: llc -mtriple x86_64 -run-pass=x86-prelegalizer-combiner %s -o - | FileCheck %s # RUN: llc -mtriple x86_64 -passes=x86-prelegalizer-combiner-pass %s -o - | FileCheck %s --- name: right_ident_sub tracksRegLiveness: true body: | bb.0.entry: liveins: $eax ; Fold (x - 0) -> x ; CHECK-LABEL: name: right_ident_sub ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_SUB %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_add tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x + 0) -> x ; CHECK-LABEL: name: right_ident_add ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_ADD %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_or tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x || 0) -> x ; CHECK-LABEL: name: right_ident_or ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_OR %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_xor tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x | 0) -> x ; CHECK-LABEL: name: right_ident_xor ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_XOR %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_shl tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x << 0) -> x ; CHECK-LABEL: name: right_ident_shl ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_SHL %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_ashr tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x ashr 0) -> x ; CHECK-LABEL: name: right_ident_ashr ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_ASHR %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_lshr tracksRegLiveness: true body: | bb.1.entry: liveins: $eax ; Fold (x lshr 0) -> x ; CHECK-LABEL: name: right_ident_lshr ; CHECK: liveins: $eax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %x(s32) ; CHECK-NEXT: RET implicit $eax %x:_(s32) = COPY $eax %cst:_(s32) = G_CONSTANT i32 0 %op:_(s32) = G_LSHR %x(s32), %cst $eax = COPY %op(s32) RET implicit $eax ... --- name: right_ident_ptr_add tracksRegLiveness: true body: | bb.1.entry: liveins: $rax ; Fold (x + 0) -> x ; CHECK-LABEL: name: right_ident_ptr_add ; CHECK: liveins: $rax ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %x:_(p0) = COPY $rax ; CHECK-NEXT: $rax = COPY %x(p0) ; CHECK-NEXT: RET implicit $rax %x:_(p0) = COPY $rax %cst:_(s64) = G_CONSTANT i64 0 %op:_(p0) = G_PTR_ADD %x(p0), %cst $rax = COPY %op(p0) RET implicit $rax ... --- name: right_identity_rotl tracksRegLiveness: true body: | bb.0: liveins: $eax, $ebx ; CHECK-LABEL: name: right_identity_rotl ; CHECK: liveins: $eax, $ebx ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %copy:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %copy(s32) ; CHECK-NEXT: RET implicit $eax %copy:_(s32) = COPY $eax %zero:_(s32) = G_CONSTANT i32 0 %rot:_(s32) = G_ROTL %copy(s32), %zero(s32) $eax = COPY %rot(s32) RET implicit $eax ... --- name: right_identity_rotr tracksRegLiveness: true body: | bb.0: liveins: $eax, $ebx ; CHECK-LABEL: name: right_identity_rotr ; CHECK: liveins: $eax, $ebx ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: %copy:_(s32) = COPY $eax ; CHECK-NEXT: $eax = COPY %copy(s32) ; CHECK-NEXT: RET implicit $eax %copy:_(s32) = COPY $eax %zero:_(s32) = G_CONSTANT i32 0 %rot:_(s32) = G_ROTR %copy(s32), %zero(s32) $eax = COPY %rot(s32) RET implicit $eax ...