[all-commits] [llvm/llvm-project] a3aee2: [GlobalISel] Fix multiply with overflow intrinsics...

AE via All-commits all-commits at lists.llvm.org
Wed Sep 30 04:13:39 PDT 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a3aee2678d07e249dca18493d2acd898eefd48dd
      https://github.com/llvm/llvm-project/commit/a3aee2678d07e249dca18493d2acd898eefd48dd
  Author: Amara Emerson <amara at apple.com>
  Date:   2020-09-30 (Wed, 30 Sep 2020)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-mul.mir
    M llvm/test/CodeGen/Mips/GlobalISel/legalizer/mul.mir
    M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/mul.ll

  Log Message:
  -----------
  [GlobalISel] Fix multiply with overflow intrinsics legalization generating invalid MIR.

During lowering of G_UMULO and friends, the previous code moved the builder's
insertion point to be after the legalizing instruction. When that happened, if
there happened to be a "G_CONSTANT i32 0" immediately after, the CSEMIRBuilder
would try to find that constant during the buildConstant(zero) call, and since
it dominates itself would return the iterator unchanged, even though the def
of the constant was *after* the current insertion point. This resulted in the
compare being generated *before* the constant which it was using.

There's no need to modify the insertion point before building the mul-hi or
constant. Delaying moving the insert point ensures those are built/CSEd before
the G_ICMP is built.

Fixes PR47679

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

(cherry picked from commit 1d54e75cf26a4c60b66659d5d9c62f4bb9452b03)




More information about the All-commits mailing list