[all-commits] [llvm/llvm-project] 47e2fa: [X86] Do not allow FixupSetCC to relax constraints

Harald van Dijk via All-commits all-commits at lists.llvm.org
Sat Nov 28 09:47:20 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 47e2fafbf3d933532f46ef6e8515e7005df52758
      https://github.com/llvm/llvm-project/commit/47e2fafbf3d933532f46ef6e8515e7005df52758
  Author: Harald van Dijk <harald at gigawatt.nl>
  Date:   2020-11-28 (Sat, 28 Nov 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86FixupSetCC.cpp

  Log Message:
  -----------
  [X86] Do not allow FixupSetCC to relax constraints

The build bots caught two additional pre-existing problems exposed by the test change part of my change https://reviews.llvm.org/D91339, when expensive checks are enabled. https://reviews.llvm.org/D91924 fixes one of them, this fixes the other.

FixupSetCC will change code in the form of

  %setcc = SETCCr ...
  %ext1 = MOVZX32rr8 %setcc

to

  %zero = MOV32r0
  %setcc = SETCCr ...
  %ext2 = INSERT_SUBREG %zero, %setcc, %subreg.sub_8bit

and replace uses of %ext1 with %ext2.

The register class for %ext2 did not take into account any constraints on %ext1, which may have been required by its uses. This change ensures that the original constraints are honoured, by instead of creating a new %ext2 register, reusing %ext1 and further constraining it as needed. This requires a slight reorganisation to account for the fact that it is possible for the constraining to fail, in which case no changes should be made.

Reviewed By: RKSimon

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




More information about the All-commits mailing list