[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3.
authorHongtao Yu <hoy@fb.com>
Thu, 30 Sep 2021 16:13:41 +0000 (09:13 -0700)
committerHongtao Yu <hoy@fb.com>
Tue, 12 Oct 2021 16:44:12 +0000 (09:44 -0700)
commit098a0d8fbc4ea1c687dd68e445bd0f95e7d9d4ae
treed3cf411406d2d751e631b5df3ba73d561ae058ef
parentf05c95f10fc1d8171071735af8ad3a9e87633120
[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3.

This patch continues unblocking optimizations that are blocked by pseudo probe instrumentation.

Not exactly like DbgIntrinsics, PseudoProbe intrinsic has other attributes (such as mayread, maywrite, mayhaveSideEffect) that can block optimizations. The issues fixed are:
- Flipped default param of getFirstNonPHIOrDbg API to skip pseudo probes
- Unblocked CSE by avoiding pseudo probe from clobbering memory SSA
- Unblocked induction variable simpliciation
- Allow empty loop deletion by treating probe intrinsic isDroppable
- Some refactoring.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D110847
17 files changed:
llvm/include/llvm/IR/BasicBlock.h
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/CodeGen/Analysis.cpp
llvm/lib/IR/User.cpp
llvm/lib/Transforms/IPO/GlobalDCE.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/SampleProfile/pseudo-probe-cse.ll [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-loop-deletion.ll [new file with mode: 0644]