//===- bolt/Passes/TailDuplication.h ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This pass founds cases when BBs have layout: // #BB0: // <body> // jmp #BB2 // .... // #BB1 // <body> // #BB2: // <body> // // And duplicates #BB2 and puts it after #BB0: // #BB0: // <body> // #BB2: // <body> // .... // #BB1 // <body> // #BB2: // <body> // // The advantage is getting rid of an unconditional branch and hopefully to // improve i-cache performance by reducing fragmentation The disadvantage is // that if there is too much code duplication, we may end up evicting hot cache // lines and causing the opposite effect, hurting i-cache performance This needs // to be well balanced to achieve the optimal effect // //===----------------------------------------------------------------------===// #ifndef BOLT_PASSES_TAILDUPLICATION_H #define BOLT_PASSES_TAILDUPLICATION_H #include "bolt/Passes/BinaryPasses.h" namespace llvm { namespace bolt { /// Pass for duplicating blocks that would require a jump. class TailDuplication : public BinaryFunctionPass { … }; } // namespace bolt } // namespace llvm #endif