[all-commits] [llvm/llvm-project] 5c2db1: [GISel]: Fix one more CSE Non determinism

proaditya via All-commits all-commits at lists.llvm.org
Thu Aug 27 09:06:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c2db1655b2ac2a699d29165513c16894373e566
      https://github.com/llvm/llvm-project/commit/5c2db1655b2ac2a699d29165513c16894373e566
  Author: Aditya Nandakumar <aditya_nandakumar at apple.com>
  Date:   2020-08-27 (Thu, 27 Aug 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CSEInfo.h
    M llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
    M llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
    M llvm/lib/CodeGen/GlobalISel/Combiner.cpp

  Log Message:
  -----------
  [GISel]: Fix one more CSE Non determinism

https://reviews.llvm.org/D86676

Sometimes we can have the following code

 x:gpr(s32) = G_OP

Say we build G_OP2 to the same x and then delete the previous instruction. Using something like

 Register X = ...;
 auto NewMIB = CSEBuilder.buildOp2(X, ... args);

Currently there's a mismatch in how NewMIB is profiled and inserted into the CSEMap (ie it doesn't consider register bank/register class along with type).Unify the profiling by refactoring and calling the common method.

This was found by turning on the CSEInfo::verify in at the end of each of our GISel passes which turns inconsistent state/non determinism in CSEing into crashes which likely usually indicates missing calls to Observer on mutations (the most common case). Here non determinism usually means not cseing sometimes, but almost never about producing incorrect code.
Also this patch adds this verification at the end of the combiners as well.




More information about the All-commits mailing list