[all-commits] [llvm/llvm-project] 96f372: [AsmWriter] Construct SlotTracker with the function

kazutakahirata via All-commits all-commits at lists.llvm.org
Tue Oct 20 15:02:19 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 96f372c1e7402595edd2ae9f86b9bdfa22dc1045
      https://github.com/llvm/llvm-project/commit/96f372c1e7402595edd2ae9f86b9bdfa22dc1045
  Author: Kazu Hirata <kazu at google.com>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M llvm/lib/IR/AsmWriter.cpp
    A llvm/test/Other/bb-badref.ll

  Log Message:
  -----------
  [AsmWriter] Construct SlotTracker with the function

This patch teaches BasicBlock::print to construct an instance of
SlotTracker with the containing function.

Without this patch, we dump:

*** IR Dump After LoopInstSimplifyPass ***
; Preheader:
  br label %1

; Loop:
<badref>:                                         ; preds = %1, %0
  br label %1

Note "<badref>" above.  This happens because BasicBlock::print calls:

  SlotTracker SlotTable(this->getModule());

Note that this constructor does not add the contents of functions to
the slot table.  That is, basic blocks are left unnumbered.

This patch fixes the problem by switching to:

  SlotTracker SlotTable(this->getParent());

which does add the contents of the Module and the function,
this->getParent(), to the slot table.

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




More information about the All-commits mailing list