[all-commits] [llvm/llvm-project] 14c1e9: [ARM] Remove condition that could never be true

Peter Smith via All-commits all-commits at lists.llvm.org
Tue Apr 7 02:09:44 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 14c1e987546ef161769aa619bb9de21c943721ec
      https://github.com/llvm/llvm-project/commit/14c1e987546ef161769aa619bb9de21c943721ec
  Author: Peter Smith <peter.smith at arm.com>
  Date:   2020-04-07 (Tue, 07 Apr 2020)

  Changed paths:
    M llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
    M llvm/test/MC/Disassembler/ARM/invalid-armv7.txt

  Log Message:
  -----------
  [ARM] Remove condition that could never be true

>From Arm v8 Architecture Reference Manual F5.1.84 LDREXD
The ldrexd instruction in Arm state has the following conditions:

t = UInt(Rt); t2 = t + 1; n = UInt(Rn);
if Rt<0> == '1' || t2 == 15 || n == 15 then UNPREDICTABLE;

In when Rt is odd or if Rt is 14 (making t2 15).

In the implementation when the pair is the UNPREDICTABLE R14_R15 we
would ideally return SOFT_FAIL. We can't because there is no R14_R15
value for us to return so we fail early returning FAIL.

The early return for registers outside the bounds of the table means
the check for Rt == 14 (0xE) redundant which causes a static analyzer
to flag the condition as never being true.

To fix the warning I've removed the check and replaced with a comment
explaining the difference with the specification.

Fixes pr41660

Differential Revision: https://reviews.llvm.org/D77463




More information about the All-commits mailing list