[all-commits] [llvm/llvm-project] 5ff5cf: [X86] Use APInt::isSignedIntN instead of isIntN fo...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Dec 9 13:44:34 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ff5cf8e057782e3e648ecf5ccf1d9990b53ee90
      https://github.com/llvm/llvm-project/commit/5ff5cf8e057782e3e648ecf5ccf1d9990b53ee90
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
    A llvm/test/CodeGen/X86/pr48458.ll

  Log Message:
  -----------
  [X86] Use APInt::isSignedIntN instead of isIntN for 64-bit ANDs in X86DAGToDAGISel::IsProfitableToFold

Pretty sure we meant to be checking signed 32 immediates here
rather than unsigned 32 bit. I suspect I messed this up because
in MathExtras.h we have isIntN and isUIntN so isIntN differs in
signedness depending on whether you're using APInt or plain integers.

This fixes a case where we didn't fold a constant created
by shrinkAndImmediate. Since shrinkAndImmediate doesn't topologically
sort constants it creates, we can fail to convert the Constant
to a TargetConstant. This leads to very strange behavior later.

Fixes PR48458.




More information about the All-commits mailing list