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

AE via All-commits all-commits at lists.llvm.org
Tue Sep 29 18:41:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d54e75cf26a4c60b66659d5d9c62f4bb9452b03
      https://github.com/llvm/llvm-project/commit/1d54e75cf26a4c60b66659d5d9c62f4bb9452b03
  Author: Amara Emerson <amara at apple.com>
  Date:   2020-09-29 (Tue, 29 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




More information about the All-commits mailing list