24 "ignore-redundant-instrumentation",
29 if (!M.getModuleFlag(Flag)) {
30 M.addModuleFlag(Module::ModFlagBehavior::Override, Flag, 1);
35 std::string diagInfo =
36 "Redundant instrumentation detected, with module flag: " +
38 M.getContext().diagnose(
64 for (
auto I = IP, E = BB.
end();
I != E; ++
I) {
65 bool KeepInEntry =
false;
66 if (
auto *AI = dyn_cast<AllocaInst>(
I)) {
67 if (AI->isStaticAlloca())
69 }
else if (
auto *
II = dyn_cast<IntrinsicInst>(
I)) {
70 if (
II->getIntrinsicID() == llvm::Intrinsic::localescape)
97 if (
auto Comdat =
F.getComdat())
105 Comdat *
C = M->getOrInsertComdat(
F.getName());
106 if (
T.isOSBinFormatELF() || (
T.isOSBinFormatCOFF() && !
F.isWeakForLinker()))
Module.h This file contains the declarations for the Module class.
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.
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.
Diagnostic information for IR instrumentation reporting.
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)
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.