[all-commits] [llvm/llvm-project] d20e0c: Ensure SplitEdge to return the new block between t...

Bangtian Liu via All-commits all-commits at lists.llvm.org
Thu Dec 17 08:00:55 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d20e0c3444ad9ada550d9d6d1d56fd72948ae444
      https://github.com/llvm/llvm-project/commit/d20e0c3444ad9ada550d9d6d1d56fd72948ae444
  Author: Bangtian Liu <bangtian at cs.toronto.edu>
  Date:   2020-12-17 (Thu, 17 Dec 2020)

  Changed paths:
    M llvm/include/llvm/IR/BasicBlock.h
    M llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
    M llvm/lib/IR/BasicBlock.cpp
    M llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
    M llvm/test/CodeGen/AMDGPU/call-constexpr.ll
    M llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
    M llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

  Log Message:
  -----------
  Ensure SplitEdge to return the new block between the two given blocks

This PR implements the function splitBasicBlockBefore to address an
issue
that occurred during SplitEdge(BB, Succ, ...), inside splitBlockBefore.
The issue occurs in SplitEdge when the Succ has a single predecessor
and the edge between the BB and Succ is not critical. This produces
the result ‘BB->Succ->New’. The new function splitBasicBlockBefore
was added to splitBlockBefore to handle the issue and now produces
the correct result ‘BB->New->Succ’.

Below is an example of splitting the block bb1 at its first instruction.

/// Original IR
bb0:
	br bb1
bb1:
        %0 = mul i32 1, 2
	br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlock
bb0:
	br bb1
bb1:
	br bb1.split
bb1.split:
        %0 = mul i32 1, 2
	br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlockBefore
bb0:
	br bb1.split
bb1.split
	br bb1
bb1:
        %0 = mul i32 1, 2
	br bb2
bb2:

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




More information about the All-commits mailing list