1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[x86] add test/code comment for chain value use (PR46195); NFC

This commit is contained in:
Sanjay Patel 2020-06-04 08:50:42 -04:00
parent 99d7b2a3a2
commit 37da3e96e3
2 changed files with 36 additions and 2 deletions

View File

@ -1237,8 +1237,11 @@ SDValue DAGCombiner::PromoteIntBinOp(SDValue Op) {
SDValue RV =
DAG.getNode(ISD::TRUNCATE, DL, VT, DAG.getNode(Opc, DL, PVT, NN0, NN1));
// We are always replacing N0/N1's use in N and only need
// additional replacements if there are additional uses.
// We are always replacing N0/N1's use in N and only need additional
// replacements if there are additional uses.
// Note: We are checking uses of the *nodes* (SDNode) rather than values
// (SDValue) here because the node may reference multiple values
// (for example, the chain value of a load node).
Replace0 &= !N0->hasOneUse();
Replace1 &= (N0 != N1) && !N1->hasOneUse();

View File

@ -0,0 +1,31 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
; PR46195 - https://bugs.llvm.org/show_bug.cgi?id=46195
; It is not safe to sink the load after the call.
define void @translate(i16* %ptr) nounwind {
; CHECK-LABEL: translate:
; CHECK: # %bb.0:
; CHECK-NEXT: pushq %rbp
; CHECK-NEXT: pushq %rbx
; CHECK-NEXT: pushq %rax
; CHECK-NEXT: movq %rdi, %rbx
; CHECK-NEXT: movl $-32707, %ebp # imm = 0x803D
; CHECK-NEXT: andl (%rdi), %ebp
; CHECK-NEXT: callq maybe_mutate
; CHECK-NEXT: orl $514, %ebp # imm = 0x202
; CHECK-NEXT: movw %bp, (%rbx)
; CHECK-NEXT: addq $8, %rsp
; CHECK-NEXT: popq %rbx
; CHECK-NEXT: popq %rbp
; CHECK-NEXT: retq
%i0 = load i16, i16* %ptr, align 4
call void @maybe_mutate(i16* %ptr)
%i1 = and i16 %i0, -32707
%i2 = or i16 %i1, 514
store i16 %i2, i16* %ptr, align 4
ret void
}
declare void @maybe_mutate(i16*)