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

Bangtian Liu via All-commits all-commits at lists.llvm.org
Tue Dec 15 15:32:59 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf638d793c489632bbcf0ee0fbf9d0f8c76e1f48
      https://github.com/llvm/llvm-project/commit/cf638d793c489632bbcf0ee0fbf9d0f8c76e1f48
  Author: Bangtian Liu <bangtian at cs.toronto.edu>
  Date:   2020-12-15 (Tue, 15 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