24 "ignore-redundant-instrumentation",
33 DiagnosticInfoInstrumentation(
const Twine &DiagMsg,
42 if (!M.getModuleFlag(Flag)) {
43 M.addModuleFlag(Module::ModFlagBehavior::Override, Flag, 1);
48 std::string diagInfo =
49 "Redundant instrumentation detected, with module flag: " +
51 M.getContext().diagnose(
52 DiagnosticInfoInstrumentation(diagInfo, DiagnosticSeverity::DS_Warning));
76 for (
auto I = IP, E = BB.
end();
I != E; ++
I) {
77 bool KeepInEntry =
false;
78 if (
auto *AI = dyn_cast<AllocaInst>(
I)) {
79 if (AI->isStaticAlloca())
81 }
else if (
auto *
II = dyn_cast<IntrinsicInst>(
I)) {
82 if (
II->getIntrinsicID() == llvm::Intrinsic::localescape)
116 Comdat *
C = M->getOrInsertComdat(
F.getName());
117 if (
T.isOSBinFormatELF() || (
T.isOSBinFormatCOFF() && !
F.isWeakForLinker()))
static cl::opt< bool > ClIgnoreRedundantInstrumentation("ignore-redundant-instrumentation", cl::desc("Ignore redundant instrumentation"), cl::Hidden, cl::init(false))
static BasicBlock::iterator moveBeforeInsertPoint(BasicBlock::iterator I, BasicBlock::iterator IP)
Moves I before IP. Returns new insert point.
Module.h This file contains the declarations for the Module class.
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
InstListType::iterator iterator
Instruction iterators...
@ NoDeduplicate
No deduplication is performed.
static Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
This is an important base class in LLVM.
This is the base abstract class for diagnostic reporting in the backend.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
Interface for custom diagnostic printing.
const BasicBlock & getEntryBlock() const
void setAlignment(Align Align)
Sets the alignment attribute of the GlobalObject.
void setUnnamedAddr(UnnamedAddr Val)
Module * getParent()
Get the module that this global value is contained inside of...
@ PrivateLinkage
Like Internal, but omit from symbol table.
void setCodeModel(CodeModel::Model CM)
Change the code model for this global.
A Module instance is used to store all the information related to an LLVM module.
std::optional< CodeModel::Model > getCodeModel() const
Returns the code model (tiny, small, kernel, medium or large model)
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
ArchType getArch() const
Get the parsed architecture type of this triple.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Type * getType() const
All values are typed, get the type of this value.
@ C
The default llvm calling convention, compatible with C.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
GlobalVariable * createPrivateGlobalForString(Module &M, StringRef Str, bool AllowMerging, Twine NamePrefix="")
Comdat * getOrCreateFunctionComdat(Function &F, Triple &T)
void setGlobalVariableLargeSection(const Triple &TargetTriple, GlobalVariable &GV)
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
BasicBlock::iterator PrepareToSplitEntryBlock(BasicBlock &BB, BasicBlock::iterator IP)
Instrumentation passes often insert conditional checks into entry blocks.
bool checkIfAlreadyInstrumented(Module &M, StringRef Flag)
Check if module has flag attached, if not add the flag.
This struct is a compact representation of a valid (non-zero power of two) alignment.