[all-commits] [llvm/llvm-project] 586c05: [DAGCombiner] Replace a hardcoded constant in visi...

topperc via All-commits all-commits at lists.llvm.org
Sun Apr 5 20:36:53 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 586c051a27070fc7fa3b04f220ed2b3e73c685b7
      https://github.com/llvm/llvm-project/commit/586c051a27070fc7fa3b04f220ed2b3e73c685b7
  Author: Craig Topper <craig.topper at gmail.com>
  Date:   2020-04-05 (Sun, 05 Apr 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

  Log Message:
  -----------
  [DAGCombiner] Replace a hardcoded constant in visitZERO_EXTEND with a proper check for the condition its trying to protect.

This code is replacing a shift with a new shift on an extended type.
If the shift amount type can't represent the maximum shift amount
for the new type, the amount needs to be extended to a type that
can.

Previously, the code just hardcoded a check for 256 bits which
seems to have been an assumption that the original shift amount
was MVT::i8. But that seems more catered to a specific target
like X86 that uses i8 as its legal shift amount type. Other
targets may use different types.

This commit changes the code to look at the real type of the shift
amount and makes sure it has enough bits for the Log2 of the
new type. There are similar checks to this in SelectionDAGBuilder
and LegalizeIntegerTypes.




More information about the All-commits mailing list