[CSSPGO] Unblock optimizations with pseudo probe instrumentation.
authorHongtao Yu <hoy@fb.com>
Mon, 8 Feb 2021 06:49:20 +0000 (22:49 -0800)
committerHongtao Yu <hoy@fb.com>
Wed, 10 Feb 2021 20:43:17 +0000 (12:43 -0800)
commit1cb47a063e2bbb04375ab52ed7377e8d555ef97d
tree333ba2f6a26633bf0b8bfab106dcbe4879c4b40c
parentc81d52997ac0d1206ea0fd4935964f4c8661daed
[CSSPGO] Unblock optimizations with pseudo probe instrumentation.

The IR/MIR pseudo probe intrinsics don't get materialized into real machine instructions and therefore they don't incur runtime cost directly. However, they come with indirect cost by blocking certain optimizations. Some of the blocking are intentional (such as blocking code merge) for better counts quality while the others are accidental. This change unblocks perf-critical optimizations that do not affect counts quality. They include:

1. IR InstCombine, sinking load operation to shorten lifetimes.
2. MIR LiveRangeShrink, similar to #1
3. MIR TwoAddressInstructionPass, i.e, opeq transform
4. MIR function argument copy elision
5. IR stack protection. (though not perf-critical but nice to have).

Reviewed By: wmi

Differential Revision: https://reviews.llvm.org/D95982
15 files changed:
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/include/llvm/IR/Instruction.h
llvm/lib/CodeGen/LiveRangeShrink.cpp
llvm/lib/CodeGen/MachineInstr.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/StackProtector.cpp
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/lib/IR/Instruction.cpp
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/SampleProfile/pseudo-probe-instcombine.ll [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-instsched.ll [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-peep.ll [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-twoaddr.ll [new file with mode: 0644]