LLVM: lib/Analysis/GlobalsModRef.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

31

32using namespace llvm;

33

34#define DEBUG_TYPE "globalsmodref-aa"

35

37 "Number of global vars without address taken");

38STATISTIC(NumNonAddrTakenFunctions,"Number of functions without address taken");

39STATISTIC(NumNoMemFunctions, "Number of functions that do not access memory");

40STATISTIC(NumReadMemFunctions, "Number of functions that only read memory");

41STATISTIC(NumIndirectGlobalVars, "Number of indirect global objects");

42

43

44

45

46

47

48

49

50

51

52

53

55 "enable-unsafe-globalsmodref-alias-results", cl::init(false), cl::Hidden);

56

57

58

59

60

61

62

65

66

67

68

69 struct alignas(8) AlignedMap {

70 AlignedMap() = default;

71 AlignedMap(const AlignedMap &Arg) = default;

72 GlobalInfoMapType Map;

73 };

74

75

76 struct AlignedMapPointerTraits {

77 static inline void *getAsVoidPointer(AlignedMap *P) { return P; }

78 static inline AlignedMap *getFromVoidPointer(void *P) {

79 return (AlignedMap *)P;

80 }

81 static constexpr int NumLowBitsAvailable = 3;

82 static_assert(alignof(AlignedMap) >= (1 << NumLowBitsAvailable),

83 "AlignedMap insufficiently aligned to have enough low bits.");

84 };

85

86

87

88

89

90

91 enum { MayReadAnyGlobal = 4 };

92

93

94 static_assert((MayReadAnyGlobal & static_cast<int>(ModRefInfo::ModRef)) == 0,

95 "ModRef and the MayReadAnyGlobal flag bits overlap.");

96 static_assert(((MayReadAnyGlobal | static_cast<int>(ModRefInfo::ModRef)) >>

97 AlignedMapPointerTraits::NumLowBitsAvailable) == 0,

98 "Insufficient low bits to store our flag and ModRef info.");

99

100public:

103 delete Info.getPointer();

104 }

105

106

107

109 : Info(nullptr, Arg.Info.getInt()) {

110 if (const auto *ArgPtr = Arg.Info.getPointer())

111 Info.setPointer(new AlignedMap(*ArgPtr));

112 }

114 : Info(Arg.Info.getPointer(), Arg.Info.getInt()) {

115 Arg.Info.setPointerAndInt(nullptr, 0);

116 }

118 delete Info.getPointer();

119 Info.setPointerAndInt(nullptr, RHS.Info.getInt());

120 if (const auto *RHSPtr = RHS.Info.getPointer())

121 Info.setPointer(new AlignedMap(*RHSPtr));

122 return *this;

123 }

125 delete Info.getPointer();

126 Info.setPointerAndInt(RHS.Info.getPointer(), RHS.Info.getInt());

128 return *this;

129 }

130

131

132

136

137

141

142

144 Info.setInt(Info.getInt() | static_cast<int>(NewMRI));

145 }

146

147

148

149 bool mayReadAnyGlobal() const { return Info.getInt() & MayReadAnyGlobal; }

150

151

153

154

155

159 if (AlignedMap *P = Info.getPointer()) {

160 auto I = P->Map.find(&GV);

161 if (I != P->Map.end())

162 GlobalMRI |= I->second;

163 }

164 return GlobalMRI;

165 }

166

167

168

171

174

175 if (AlignedMap *P = FI.Info.getPointer())

176 for (const auto &G : P->Map)

178 }

179

181 AlignedMap *P = Info.getPointer();

182 if (P) {

183 P = new AlignedMap();

184 Info.setPointer(P);

185 }

186 auto &GlobalMRI = P->Map[&GV];

187 GlobalMRI |= NewMRI;

188 }

189

190

191

193 if (AlignedMap *P = Info.getPointer())

194 P->Map.erase(&GV);

195 }

196

197private:

198

199

200

201

202

204};

205

206void GlobalsAAResult::DeletionCallbackHandle::deleted() {

209 GAR->FunctionInfos.erase(F);

210

212 if (GAR->NonAddressTakenGlobals.erase(GV)) {

213

214

215 if (GAR->IndirectGlobals.erase(GV)) {

216

217 for (auto I = GAR->AllocsForIndirectGlobals.begin(),

218 E = GAR->AllocsForIndirectGlobals.end();

219 I != E; ++I)

220 if (I->second == GV)

221 GAR->AllocsForIndirectGlobals.erase(I);

222 }

223

224

225

226 for (auto &FIPair : GAR->FunctionInfos)

227 FIPair.second.eraseModRefInfoForGlobal(*GV);

228 }

229 }

230

231

232 GAR->AllocsForIndirectGlobals.erase(V);

233

234

236 GAR->Handles.erase(I);

237

238}

239

246

247

248

250GlobalsAAResult::getFunctionInfo(const Function *F) {

251 auto I = FunctionInfos.find(F);

252 if (I != FunctionInfos.end())

253 return &I->second;

254 return nullptr;

255}

256

257

258

259

260

261void GlobalsAAResult::AnalyzeGlobals(Module &M) {

264 if (F.hasLocalLinkage()) {

265 if (!AnalyzeUsesOfPointer(&F)) {

266

267 NonAddressTakenGlobals.insert(&F);

268 TrackedFunctions.insert(&F);

269 Handles.emplace_front(*this, &F);

270 Handles.front().I = Handles.begin();

271 ++NumNonAddrTakenFunctions;

272 } else

273 UnknownFunctionsWithLocalLinkage = true;

274 }

275

276 SmallPtrSet<Function *, 16> Readers, Writers;

277 for (GlobalVariable &GV : M.globals())

278 if (GV.hasLocalLinkage()) {

279 if (!AnalyzeUsesOfPointer(&GV, &Readers,

280 GV.isConstant() ? nullptr : &Writers)) {

281

282 NonAddressTakenGlobals.insert(&GV);

283 Handles.emplace_front(*this, &GV);

284 Handles.front().I = Handles.begin();

285

286 for (Function *Reader : Readers) {

287 if (TrackedFunctions.insert(Reader).second) {

288 Handles.emplace_front(*this, Reader);

289 Handles.front().I = Handles.begin();

290 }

291 FunctionInfos[Reader].addModRefInfoForGlobal(GV, ModRefInfo::Ref);

292 }

293

294 if (!GV.isConstant())

295 for (Function *Writer : Writers) {

296 if (TrackedFunctions.insert(Writer).second) {

297 Handles.emplace_front(*this, Writer);

298 Handles.front().I = Handles.begin();

299 }

300 FunctionInfos[Writer].addModRefInfoForGlobal(GV, ModRefInfo::Mod);

301 }

302 ++NumNonAddrTakenGlobalVars;

303

304

305 if (GV.getValueType()->isPointerTy() &&

306 AnalyzeIndirectGlobalMemory(&GV))

307 ++NumIndirectGlobalVars;

308 }

309 Readers.clear();

310 Writers.clear();

311 }

312}

313

314

315

316

317

318

319

320bool GlobalsAAResult::AnalyzeUsesOfPointer(Value *V,

321 SmallPtrSetImpl<Function *> *Readers,

322 SmallPtrSetImpl<Function *> *Writers,

323 GlobalValue *OkayStoreDest) {

324 if (V->getType()->isPointerTy())

325 return true;

326

327 for (Use &U : V->uses()) {

328 User *I = U.getUser();

330 if (Readers)

331 Readers->insert(LI->getParent()->getParent());

333 if (V == SI->getOperand(1)) {

334 if (Writers)

335 Writers->insert(SI->getParent()->getParent());

336 } else if (SI->getOperand(1) != OkayStoreDest) {

337 return true;

338 }

340 if (AnalyzeUsesOfPointer(I, Readers, Writers))

341 return true;

344 if (AnalyzeUsesOfPointer(I, Readers, Writers, OkayStoreDest))

345 return true;

348 if (II->getIntrinsicID() == Intrinsic::threadlocal_address &&

349 V == II->getArgOperand(0)) {

350 if (AnalyzeUsesOfPointer(II, Readers, Writers))

351 return true;

352 continue;

353 }

354 }

355

356

358

361 if (Writers)

363 } else {

364

365

366

368

369

370

371

372 if (F || F->isDeclaration())

373 return true;

374

375

376

377

381 return true;

382

383

384

385 if (Readers)

387 if (Writers)

389 }

390 }

393 return true;

395

397 return true;

398 } else {

399 return true;

400 }

401 }

402

403 return false;

404}

405

406

407

408

409

410

411

412

413bool GlobalsAAResult::AnalyzeIndirectGlobalMemory(GlobalVariable *GV) {

414

415

416 std::vector<Value *> AllocRelatedValues;

417

418

420 if (C->isNullValue())

421 return false;

422

423

424

425 for (User *U : GV->users()) {

427

428

429

430 if (AnalyzeUsesOfPointer(LI))

431 return false;

432

434

435 if (SI->getOperand(0) == GV)

436 return false;

437

438

440 continue;

441

442

444

446 return false;

447

448

449

450 if (AnalyzeUsesOfPointer(Ptr, nullptr, nullptr,

451 GV))

452 return false;

453

454

455 AllocRelatedValues.push_back(Ptr);

456 } else {

457

458 return false;

459 }

460 }

461

462

463

464 while (!AllocRelatedValues.empty()) {

465 AllocsForIndirectGlobals[AllocRelatedValues.back()] = GV;

466 Handles.emplace_front(*this, AllocRelatedValues.back());

467 Handles.front().I = Handles.begin();

468 AllocRelatedValues.pop_back();

469 }

470 IndirectGlobals.insert(GV);

471 Handles.emplace_front(*this, GV);

472 Handles.front().I = Handles.begin();

473 return true;

474}

475

476void GlobalsAAResult::CollectSCCMembership(CallGraph &CG) {

477

478

479 unsigned SCCID = 0;

480 for (scc_iterator<CallGraph *> I = scc_begin(&CG); I.isAtEnd(); ++I) {

481 const std::vector<CallGraphNode *> &SCC = *I;

482 assert(SCC.empty() && "SCC with no functions?");

483

484 for (auto *CGN : SCC)

485 if (Function *F = CGN->getFunction())

486 FunctionToSCCMap[F] = SCCID;

487 ++SCCID;

488 }

489}

490

491

492

493

494

495void GlobalsAAResult::AnalyzeCallGraph(CallGraph &CG, Module &M) {

496

497

498 for (scc_iterator<CallGraph *> I = scc_begin(&CG); I.isAtEnd(); ++I) {

499 const std::vector<CallGraphNode *> &SCC = *I;

500 assert(SCC.empty() && "SCC with no functions?");

501

503

504 if (F || F->isDefinitionExact()) {

505

506

507

508 for (auto *Node : SCC)

509 FunctionInfos.erase(Node->getFunction());

510 continue;

511 }

512

514 Handles.emplace_front(*this, F);

515 Handles.front().I = Handles.begin();

516 bool KnowNothing = false;

517

518

519

520

521

522

523

524

525 auto MaySyncOrCallIntoModule = [](const Function &F) {

526 return F.isDeclaration() || F.hasNoSync() ||

527 F.hasFnAttribute(Attribute::NoCallback);

528 };

529

530

531

532 for (unsigned i = 0, e = SCC.size(); i != e && !KnowNothing; ++i) {

533 if (F) {

534 KnowNothing = true;

535 break;

536 }

537

538 if (F->isDeclaration() || F->hasOptNone()) {

539

540 if (F->doesNotAccessMemory()) {

541

542 } else if (F->onlyReadsMemory()) {

544 if (F->onlyAccessesArgMemory() && MaySyncOrCallIntoModule(*F))

545

546

547 FI.setMayReadAnyGlobal();

548 } else {

550 if (F->onlyAccessesArgMemory())

551 FI.setMayReadAnyGlobal();

552 if (MaySyncOrCallIntoModule(*F)) {

553 KnowNothing = true;

554 break;

555 }

556 }

557 continue;

558 }

559

561 CI != E && !KnowNothing; ++CI)

562 if (Function *Callee = CI->second->getFunction()) {

563 if (FunctionInfo *CalleeFI = getFunctionInfo(Callee)) {

564

565 FI.addFunctionInfo(*CalleeFI);

566 } else {

567

568

569 CallGraphNode *CalleeNode = CG[Callee];

571 KnowNothing = true;

572 }

573 } else {

574 KnowNothing = true;

575 }

576 }

577

578

579

580 if (KnowNothing) {

581 for (auto *Node : SCC)

582 FunctionInfos.erase(Node->getFunction());

583 continue;

584 }

585

586

587 for (auto *Node : SCC) {

589 break;

590

591

592

593

594 if (Node->getFunction()->hasOptNone())

595 continue;

596

599 break;

600

601

602

604 continue;

605

606

607

608 if (I.mayReadFromMemory())

610 if (I.mayWriteToMemory())

612 }

613 }

614

615 if (isModSet(FI.getModRefInfo()))

616 ++NumReadMemFunctions;

618 ++NumNoMemFunctions;

619

620

621

622

623

625 for (unsigned i = 1, e = SCC.size(); i != e; ++i)

626 FunctionInfos[SCC[i]->getFunction()] = CachedFI;

627 }

628}

629

630

631

632

641 do {

643

646

647

648

649

650

651

652 continue;

653

654

655

656

657

659 return false;

660

663 continue;

664 }

672 continue;

673 }

675 for (const Value *Op : PN->incoming_values()) {

677 if (Visited.insert(Op).second)

679 }

680 continue;

681 }

682

683 return false;

684 } while (!Inputs.empty());

685

686

687 return true;

688}

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715bool GlobalsAAResult::isNonEscapingGlobalNoAlias(const GlobalValue *GV,

717 const Instruction *CtxI) {

718

719

720

721

722

723

724

725

726

727 if (V->getType()->isPointerTy())

728 return true;

729

730 SmallPtrSet<const Value *, 8> Visited;

731 SmallVector<const Value *, 8> Inputs;

735 do {

737

739

740

741 if (InputGV == GV)

742 return false;

743

744

745

748 if (GVar && InputGVar &&

749 !GVar->isDeclaration() && !InputGVar->isDeclaration() &&

750 !GVar->isInterposable() && !InputGVar->isInterposable()) {

751 Type *GVType = GVar->getInitializer()->getType();

752 Type *InputGVType = InputGVar->getInitializer()->getType();

754 (DL.getTypeAllocSize(GVType) > 0) &&

755 (DL.getTypeAllocSize(InputGVType) > 0))

756 continue;

757 }

758

759

760

761 return false;

762 }

763

766

767

768

769 continue;

770 }

771

772 if (CtxI)

774

777 continue;

778 }

779

780

781

782

783

785 return false;

786

788

789

792

793 continue;

794

795 return false;

796 }

804 continue;

805 }

807 for (const Value *Op : PN->incoming_values()) {

809 if (Visited.insert(Op).second)

811 }

812 continue;

813 }

814

815

816

817

818 return false;

819 } while (!Inputs.empty());

820

821

822 return true;

823}

824

826 ModuleAnalysisManager::Invalidator &) {

827

828

830 return !PAC.preservedWhenStateless();

831}

832

833

834

835

839

840 const Value *UV1 =

842 const Value *UV2 =

844

845

846

849 if (GV1 || GV2) {

850

851

852 if (GV1 && !NonAddressTakenGlobals.count(GV1))

853 GV1 = nullptr;

854 if (GV2 && !NonAddressTakenGlobals.count(GV2))

855 GV2 = nullptr;

856

857

858

859 if (GV1 && GV2 && GV1 != GV2)

861

862

863

864

866 if ((GV1 || GV2) && GV1 != GV2)

868

869

870

871 if ((GV1 || GV2) && GV1 != GV2) {

873 const Value *UV = GV1 ? UV2 : UV1;

874 if (isNonEscapingGlobalNoAlias(GV, UV, CtxI))

876 }

877

878

879

880 }

881

882

883

884

885 GV1 = GV2 = nullptr;

888 if (IndirectGlobals.count(GV))

889 GV1 = GV;

892 if (IndirectGlobals.count(GV))

893 GV2 = GV;

894

895

896

897 if (!GV1)

898 GV1 = AllocsForIndirectGlobals.lookup(UV1);

899 if (!GV2)

900 GV2 = AllocsForIndirectGlobals.lookup(UV2);

901

902

903

904

905 if (GV1 && GV2 && GV1 != GV2)

907

908

909

910

912 if ((GV1 || GV2) && GV1 != GV2)

914

916}

917

921 if (Call->doesNotAccessMemory())

925

926

927

928 for (const auto &A : Call->args()) {

931

932

934

939 }))

940 return ConservativeResult;

941

943 return ConservativeResult;

944 }

945

946

948}

949

954

955

956

959

960

961 if (GV->hasLocalLinkage() && !UnknownFunctionsWithLocalLinkage)

962 if (const Function *F = Call->getCalledFunction())

963 if (NonAddressTakenGlobals.count(GV))

965 Known = FI->getModRefInfoForGlobal(*GV) |

966 getModRefInfoForArgument(Call, GV, AAQI);

967

968 return Known;

969}

970

971GlobalsAAResult::GlobalsAAResult(

975

976GlobalsAAResult::GlobalsAAResult(GlobalsAAResult &&Arg)

978 NonAddressTakenGlobals(std::move(Arg.NonAddressTakenGlobals)),

979 IndirectGlobals(std::move(Arg.IndirectGlobals)),

980 AllocsForIndirectGlobals(std::move(Arg.AllocsForIndirectGlobals)),

981 FunctionInfos(std::move(Arg.FunctionInfos)),

982 Handles(std::move(Arg.Handles)) {

983

984 for (auto &H : Handles) {

986 H.GAR = this;

987 }

988}

989

991

995 GlobalsAAResult Result(M.getDataLayout(), GetTLI);

996

997

998 Result.CollectSCCMembership(CG);

999

1000

1001 Result.AnalyzeGlobals(M);

1002

1003

1004 Result.AnalyzeCallGraph(CG, M);

1005

1006 return Result;

1007}

1008

1010

1020

1025 G->NonAddressTakenGlobals.clear();

1026 G->UnknownFunctionsWithLocalLinkage = false;

1027 G->IndirectGlobals.clear();

1028 G->AllocsForIndirectGlobals.clear();

1029 G->FunctionInfos.clear();

1030 G->FunctionToSCCMap.clear();

1031 G->Handles.clear();

1032 G->CollectSCCMembership(CG);

1033 G->AnalyzeGlobals(M);

1034 G->AnalyzeCallGraph(CG, M);

1035 }

1037}

1038

1041 "Globals Alias Analysis", false, true)

1046

1050

1052

1056 };

1059 return false;

1060}

1061

1063 Result.reset();

1064 return false;

1065}

1066

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Expand Atomic instructions

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...

static cl::opt< bool > EnableUnsafeGlobalsModRefAliasResults("enable-unsafe-globalsmodref-alias-results", cl::init(false), cl::Hidden)

static bool isNonEscapingGlobalNoAliasWithLoad(const GlobalValue *GV, const Value *V, int &Depth, const DataLayout &DL)

Definition GlobalsModRef.cpp:633

This is the interface for a simple mod/ref and alias analysis over globals.

Value * getPointer(Value *Ptr)

Module.h This file contains the declarations for the Module class.

This header defines various interfaces for pass management in LLVM.

Machine Check Debug Module

uint64_t IntrinsicInst * II

FunctionAnalysisManager FAM

#define INITIALIZE_PASS_DEPENDENCY(depName)

#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)

#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)

This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...

This file defines the SmallPtrSet class.

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...

#define STATISTIC(VARNAME, DESC)

The mod/ref information collected for a particular function.

Definition GlobalsModRef.cpp:63

FunctionInfo & operator=(FunctionInfo &&RHS)

Definition GlobalsModRef.cpp:124

void eraseModRefInfoForGlobal(const GlobalValue &GV)

Clear a global's ModRef info.

Definition GlobalsModRef.cpp:192

void setMayReadAnyGlobal()

Sets this function as potentially reading from any global.

Definition GlobalsModRef.cpp:152

void addModRefInfo(ModRefInfo NewMRI)

Adds new ModRefInfo for this function to its state.

Definition GlobalsModRef.cpp:143

void addFunctionInfo(const FunctionInfo &FI)

Add mod/ref info from another function into ours, saturating towards ModRef.

Definition GlobalsModRef.cpp:169

~FunctionInfo()

Definition GlobalsModRef.cpp:102

ModRefInfo getModRefInfo() const

Returns the ModRefInfo info for this function.

Definition GlobalsModRef.cpp:138

FunctionInfo()=default

Checks to document the invariants of the bit packing here.

FunctionInfo & operator=(const FunctionInfo &RHS)

Definition GlobalsModRef.cpp:117

void addModRefInfoForGlobal(const GlobalValue &GV, ModRefInfo NewMRI)

Definition GlobalsModRef.cpp:180

ModRefInfo globalClearMayReadAnyGlobal(int I) const

This method clears MayReadAnyGlobal bit added by GlobalsAAResult to return the corresponding ModRefIn...

Definition GlobalsModRef.cpp:133

bool mayReadAnyGlobal() const

Returns whether this function may read any global variable, and we don't know which global.

Definition GlobalsModRef.cpp:149

FunctionInfo(FunctionInfo &&Arg)

Definition GlobalsModRef.cpp:113

FunctionInfo(const FunctionInfo &Arg)

Definition GlobalsModRef.cpp:108

ModRefInfo getModRefInfoForGlobal(const GlobalValue &GV) const

Returns the ModRefInfo info for this function w.r.t.

Definition GlobalsModRef.cpp:156

The Input class is used to parse a yaml document into in-memory structs and vectors.

This class stores info we want to provide to or retain within an alias query.

The possible results of an alias query.

@ MayAlias

The two locations may or may not alias.

@ NoAlias

The two locations do not alias at all.

PassT::Result * getCachedResult(IRUnitT &IR) const

Get the cached result of an analysis pass for a given IR unit.

PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)

Get the result of an analysis pass for a given IR unit.

Represent the analysis usage information of a pass.

AnalysisUsage & addRequired()

void setPreservesAll()

Set by analyses that do not transform their input at all.

Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...

bool doesNotCapture(unsigned OpNo) const

Determine whether this data operand is not captured.

Function * getCalledFunction() const

Returns the function called, or null if this is an indirect function invocation or the function signa...

bool hasFnAttr(Attribute::AttrKind Kind) const

Determine whether this call has the given attribute.

unsigned getArgOperandNo(const Use *U) const

Given a use for a arg operand, get the arg operand number that corresponds to it.

bool isArgOperand(const Use *U) const

bool isDataOperand(const Use *U) const

An analysis pass to compute the CallGraph for a Module.

std::vector< CallRecord >::iterator iterator

The ModulePass which wraps up a CallGraph and the logic to build it.

The basic data container for the call graph of a Module of IR.

A parsed version of the target data layout string in and methods for querying it.

bool hasLocalLinkage() const

const Constant * getInitializer() const

getInitializer - Return the initializer for this global variable.

An alias analysis result set for globals.

LLVM_ABI ~GlobalsAAResult()

LLVM_ABI ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)

Definition GlobalsModRef.cpp:950

LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA, ModuleAnalysisManager::Invalidator &)

Definition GlobalsModRef.cpp:825

static LLVM_ABI GlobalsAAResult analyzeModule(Module &M, std::function< const TargetLibraryInfo &(Function &F)> GetTLI, CallGraph &CG)

Definition GlobalsModRef.cpp:992

LLVM_ABI MemoryEffects getMemoryEffects(const Function *F)

getMemoryEffects - Return the behavior of the specified function if called from the specified call si...

Definition GlobalsModRef.cpp:240

LLVM_ABI AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI)

alias - If one of the pointers is to a global that we are tracking, and the other is some random poin...

Definition GlobalsModRef.cpp:836

Legacy wrapper pass to provide the GlobalsAAResult object.

void getAnalysisUsage(AnalysisUsage &AU) const override

getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...

Definition GlobalsModRef.cpp:1067

GlobalsAAWrapperPass()

Definition GlobalsModRef.cpp:1051

bool runOnModule(Module &M) override

runOnModule - Virtual method overriden by subclasses to process the module being operated on.

Definition GlobalsModRef.cpp:1053

bool doFinalization(Module &M) override

doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...

Definition GlobalsModRef.cpp:1062

Analysis pass providing a never-invalidated alias analysis result.

LLVM_ABI GlobalsAAResult run(Module &M, ModuleAnalysisManager &AM)

Definition GlobalsModRef.cpp:1011

LLVM_ABI const Function * getFunction() const

Return the function this instruction belongs to.

An instruction for reading from memory.

static MemoryEffectsBase unknown()

Representation for a specific memory location.

static MemoryLocation getBeforeOrAfter(const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())

Return a location that may access any location before or after Ptr, while remaining within the underl...

const Value * Ptr

The address of the start of the location.

ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...

A Module instance is used to store all the information related to an LLVM module.

unsigned getOpcode() const

Return the opcode for this Instruction or ConstantExpr.

AnalysisType & getAnalysis() const

getAnalysis() - This function is used by subclasses to get to the analysis information ...

PointerIntPair - This class implements a pair of a pointer and small integer.

void setPointerAndInt(PointerTy PtrVal, IntType IntVal) &

PointerTy getPointer() const

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

PreservedAnalysisChecker getChecker() const

Build a checker for this PreservedAnalyses and the specified analysis type.

std::pair< iterator, bool > insert(PtrType Ptr)

Inserts Ptr if and only if there is no element in the container equal to Ptr.

SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

Analysis pass providing the TargetLibraryInfo.

Provides information about what library functions are available for the current target.

bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const

Return true if it makes sense to take the size of this type.

Value * getValPtr() const

LLVM Value Representation.

iterator_range< user_iterator > users()

LLVM_ABI const Value * stripPointerCastsForAliasAnalysis() const

Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.

const ParentTy * getParent() const

@ C

The default llvm calling convention, compatible with C.

initializer< Ty > init(const Ty &Val)

@ User

could "use" a pointer

NodeAddr< NodeBase * > Node

LLVM_ABI iterator begin() const

This is an optimization pass for GlobalISel generic memory operations.

FunctionAddr VTableAddr Value

bool all_of(R &&range, UnaryPredicate P)

Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

scc_iterator< T > scc_begin(const T &G)

Construct the begin iterator for a deduced graph type T.

InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy

Provide the FunctionAnalysisManager to Module proxy.

LLVM_ABI bool isNoAliasCall(const Value *V)

Return true if this pointer is returned by a noalias function.

MemoryEffectsBase< IRMemLocation > MemoryEffects

Summary of how a function affects memory in the program.

LLVM_ABI ModulePass * createGlobalsAAWrapperPass()

Definition GlobalsModRef.cpp:1047

bool isModSet(const ModRefInfo MRI)

LLVM_ABI bool NullPointerIsDefined(const Function *F, unsigned AS=0)

Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...

bool isModOrRefSet(const ModRefInfo MRI)

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

ModRefInfo

Flags indicating whether a memory access modifies or references memory.

@ Ref

The access may reference the value stored in memory.

@ ModRef

The access may reference and may modify the value stored in memory.

@ Mod

The access may modify the value stored in memory.

@ NoModRef

The access neither references nor modifies the value stored in memory.

DWARFExpression::Operation Op

LLVM_ABI Value * getFreedOperand(const CallBase *CB, const TargetLibraryInfo *TLI)

If this if a call to a free function, return the freed operand.

bool isModAndRefSet(const ModRefInfo MRI)

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.

LLVM_ABI const Value * getUnderlyingObject(const Value *V, unsigned MaxLookup=MaxLookupSearchDepth)

This method strips off any GEP address adjustments, pointer casts or llvm.threadlocal....

LLVM_ABI void getUnderlyingObjects(const Value *V, SmallVectorImpl< const Value * > &Objects, const LoopInfo *LI=nullptr, unsigned MaxLookup=MaxLookupSearchDepth)

This method is similar to getUnderlyingObject except that it can look through phi and select instruct...

LLVM_ABI bool isIdentifiedObject(const Value *V)

Return true if this pointer refers to a distinct and identifiable object.

AnalysisManager< Module > ModuleAnalysisManager

Convenience typedef for the Module analysis manager.

Implement std::hash so that hash_code can be used in STL containers.

A special type used by analysis passes to provide an address that identifies that particular analysis...

LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)

Definition GlobalsModRef.cpp:1021