OSDN Git Service

bpf: add missing RegState to notify MachineInstr verifier necessary register usage
authorYonghong Song <yhs@fb.com>
Fri, 27 Jul 2018 16:58:52 +0000 (16:58 +0000)
committerYonghong Song <yhs@fb.com>
Fri, 27 Jul 2018 16:58:52 +0000 (16:58 +0000)
commit767b5de4f4a1c3cf031a65f0afe97f3fb2305998
treec176c9e2e27256093960159bfe84f8c93141b98e
parent6f446a56af7c0f0f9fc0beb942092737c4b7b9a6
bpf: add missing RegState to notify MachineInstr verifier necessary register usage

Errors like the following are reported by:

  https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Dclang-2Dx86-5F64-2Dexpensive-2Dchecks-2Dwin_builds_11261&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=929oWPCf7Bf2qQnir4GBtowB8ZAlIRWsAdTfRkDaK-g&s=9k-wbEUVpUm474hhzsmAO29VXVvbxJPWD9RTgCD71fQ&e=

  *** Bad machine code: Explicit definition marked as use ***
  - function:    cal_align1
  - basic block: %bb.0 entry (0x47edd98)
  - instruction: LDB $r3, $r2, 0
  - operand 0:   $r3

This is because RegState info was missing for ScratchReg inside
expandMEMCPY. This caused incomplete register usage information to
MachineInstr verifier which then would complain as there could be potential
code-gen issue if the complained MachineInstr is used in place where
register usage information matters even though the memcpy expanding is not
in such case as it happens at the last stage of IR optimization pipeline.

We should always specify those register usage information which compiler
couldn't deduct automatically whenever we add a hardware register manually.

Reported-by: Builder llvm-clang-x86_64-expensive-checks-win Build #11261
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338134 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/BPF/BPFInstrInfo.cpp
test/CodeGen/BPF/memcpy-expand-in-order.ll