LLVM: include/llvm/Analysis/ValueTracking.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_ANALYSIS_VALUETRACKING_H

15#define LLVM_ANALYSIS_VALUETRACKING_H

16

26#include

27#include

28

29namespace llvm {

30

45template class ArrayRef;

46

48

49

50

52

53

54

55

56

57

58

59

60

66 bool UseInstrInfo = true, unsigned Depth = 0);

67

68

73 bool UseInstrInfo = true,

74 unsigned Depth = 0);

75

76

82 bool UseInstrInfo = true,

83 unsigned Depth = 0);

84

87

89 unsigned Depth = 0);

90

93

94

95

96

99

100

103 unsigned Depth = 0);

104

105

110 unsigned Depth = 0);

111

112

113

115 Value *Arm, bool Invert,

117 unsigned Depth = 0);

118

119

123

124

125

126

127

128

130 bool OrZero = false,

134 bool UseInstrInfo = true,

135 unsigned Depth = 0);

136

139 unsigned Depth = 0);

140

142

144

145

146

147

148

149

150

152 unsigned Depth = 0);

153

154

155

156

157

159 bool NeedNSW = false, bool AllowPoison = true);

160

161

162

163

164

165

167

168

170 unsigned Depth = 0);

171

172

173

175 unsigned Depth = 0);

176

177

178

180 unsigned Depth = 0);

181

182

183

186

187

188

189

190

191

192

193

194

195

198

199

200

201

202

203

204

205

210 bool UseInstrInfo = true,

211 unsigned Depth = 0);

212

213

214

215

221 unsigned Depth = 0);

222

223

224

227

228

229

230

232 bool &TrueIfSigned);

233

234

235

236

237

238

239

240

241

242

243

245 const APInt &DemandedElts,

248 unsigned Depth = 0);

249

253 unsigned Depth = 0);

254

260 bool UseInstrInfo = true, unsigned Depth = 0);

261

262

266

270 unsigned Depth = 0);

271

272

273

274

276 unsigned Depth = 0);

277

278

279

280

281

282

283

284

285

288 unsigned Depth = 0);

289

290

291

292

294 unsigned Depth = 0);

295

296

298 unsigned Depth = 0);

299

300

301

302

304 unsigned Depth = 0);

305

306

307

308

311 unsigned Depth = 0);

312

313

314

316

317

318

320

321

322

323

324

325

326

328

329

330

331

332

333

334

337 std::optionalBasicBlock::iterator InsertBefore = std::nullopt);

338

339

340

341

342

343

346 bool AllowNonInbounds = true) {

347 APInt OffsetAPInt(DL.getIndexTypeSizeInBits(Ptr->getType()), 0);

350

353}

354inline const Value *

357 bool AllowNonInbounds = true) {

359 AllowNonInbounds);

360}

361

362

364

365

367

368

370

371

373

374

380

381

385};

386

387

388

389

391 ConstantDataArraySlice &Slice,

392 unsigned ElementSize,

394

395

396

397

398

399

400

402 bool TrimAtNul = true);

403

404

405

407

408

409

410

411

414 bool MustPreserveNullness);

416 bool MustPreserveNullness) {

418 const_cast<const CallBase *>(Call), MustPreserveNullness));

419}

420

421

422

423

424

425

426

428 const CallBase *Call, bool MustPreserveNullness);

429

430

431

432

433

434

439

440 const Value *VConst = V;

442}

443

444

445

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

477 SmallVectorImpl<const Value *> &Objects,

478 const LoopInfo *LI = nullptr,

480

481

482

484 SmallVectorImpl<Value *> &Objects);

485

486

487

490 bool OffsetZero = false) {

492}

493

494

496

497

498

500

501

502

503

504

505

506

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

541 const Instruction *I, const Instruction *CtxI = nullptr,

542 AssumptionCache *AC = nullptr, const DominatorTree *DT = nullptr,

543 const TargetLibraryInfo *TLI = nullptr, bool UseVariableInfo = true,

544 bool IgnoreUBImplyingAttrs = true);

545

551 bool UseVariableInfo = true,

552 bool IgnoreUBImplyingAttrs = true) {

553

555 IgnoreUBImplyingAttrs);

556}

557

558

559

561 const Instruction *I, bool IgnoreUBImplyingAttrs = true) {

563 false,

564 IgnoreUBImplyingAttrs);

565}

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

585 unsigned Opcode, const Instruction *Inst, const Instruction *CtxI = nullptr,

586 AssumptionCache *AC = nullptr, const DominatorTree *DT = nullptr,

587 const TargetLibraryInfo *TLI = nullptr, bool UseVariableInfo = true,

588 bool IgnoreUBImplyingAttrs = true);

589

590

591

592

593

594

595

596

597

599

600

601

603

604

605

606

607

608

609

610

612 const Instruction *CxtI,

613 const DominatorTree *DT = nullptr,

614 bool AllowEphemerals = false);

615

616

617

618

620 const Instruction *CtxI);

621

632

634 const Value *RHS,

635 const SimplifyQuery &SQ,

636 bool IsNSW = false);

638 const Value *RHS,

639 const SimplifyQuery &SQ);

641 const WithCache<const Value *> &LHS, const WithCache<const Value *> &RHS,

642 const SimplifyQuery &SQ);

644 const WithCache<const Value *> &LHS, const WithCache<const Value *> &RHS,

645 const SimplifyQuery &SQ);

646

648 const SimplifyQuery &SQ);

650 const Value *RHS,

651 const SimplifyQuery &SQ);

653 const Value *RHS,

654 const SimplifyQuery &SQ);

655

656

657

658

660 const DominatorTree &DT);

661

662

663

665

666

667

669 bool UseInstrInfo = true,

670 AssumptionCache *AC = nullptr,

671 const Instruction *CtxI = nullptr,

672 const DominatorTree *DT = nullptr,

673 unsigned Depth = 0);

674

675

677 const WithCache<const Value *> &V, bool ForSigned, const SimplifyQuery &SQ);

678

679

680

681

682

683

684

685

686

687

688

689

690

691

693

694

695

696

697

698

700

701

702

703

707 unsigned ScanLimit = 32);

708

709

712

713

714

715

716

718 const Loop *L);

719

720

721

722

723

724

725

726

727

728

730

731

733

734

735

736

738 const SmallPtrSetImpl<const Value *> &KnownPoison);

739

740

741

742

743

744

745

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

768 bool ConsiderFlagsAndMetadata = true);

770 bool ConsiderFlagsAndMetadata = true);

771

772

773

774

776

777

778

779

780

781

782

783

784

785

788 const Instruction *CtxI = nullptr,

789 const DominatorTree *DT = nullptr,

790 unsigned Depth = 0);

791

792

794 AssumptionCache *AC = nullptr,

795 const Instruction *CtxI = nullptr,

796 const DominatorTree *DT = nullptr,

797 unsigned Depth = 0);

798

802 unsigned Depth = 0) {

803

804

806}

807

808

810 AssumptionCache *AC = nullptr,

811 const Instruction *CtxI = nullptr,

812 const DominatorTree *DT = nullptr,

813 unsigned Depth = 0);

814

815

816

817

818

819

820

821

823 Instruction *OnPathTo,

824 DominatorTree *DT);

825

826

827

828

829

830LLVM_ABI std::optional<std::pair<CmpPredicate, Constant *>>

832

833

845

846

847

856

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

892

902

903

904

906 CmpInst *CmpI, Value *TrueVal, Value *FalseVal, Value *&LHS, Value *&RHS,

908 unsigned Depth = 0);

909

910

913 bool Ordered = false);

914

915

916

918 bool Ordered = false);

919

920

921

923

924

925

927

929

930

931

933

934

935

936

937

938

939LLVM_ABI std::pair<Intrinsic::ID, bool>

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

967 Value *&Start, Value *&Step);

968

969

971 Value *&Start, Value *&Step);

972

973

974

975

976

977

978

979

980

981

982

983

985 PHINode *&P, Value *&Init,

986 Value *&OtherOp);

987

988

989

990

991

992

993

994

995

996

997

1000 bool LHSIsTrue = true, unsigned Depth = 0);

1003 const Value *RHSOp1, const DataLayout &DL,

1004 bool LHSIsTrue = true, unsigned Depth = 0);

1005

1006

1007

1010 const DataLayout &DL);

1013 const Instruction *ContextI, const DataLayout &DL);

1014

1015

1016

1017

1020 function_ref<void(Value *)> InsertAffected);

1021

1022

1023

1026

1027

1028

1029

1030

1031

1034 SmallPtrSetImpl<const Constant *> &Constants,

1035 unsigned MaxCount, bool AllowUndefOrPoison = true);

1036

1037}

1038

1039#endif

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

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")

This file contains the declarations for the subclasses of Constant, which represent the different fla...

ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))

const SmallVectorImpl< MachineOperand > & Cond

static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")

static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")

Class for arbitrary precision integers.

int64_t getSExtValue() const

Get sign extended value.

an instruction to allocate memory on the stack

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

A cache of @llvm.assume calls within a function.

InstListType::const_iterator const_iterator

InstListType::iterator iterator

Instruction iterators...

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

Predicate

This enumeration lists the possible predicates for CmpInst subclasses.

An array constant whose element type is a simple 1/2/4/8-byte integer or float/double,...

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

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

Convenience struct for specifying and reasoning about fast-math flags.

A wrapper class for inspecting calls to intrinsic functions.

Represents a single loop in the control flow graph.

This is a utility class that provides an abstraction for the common functionality between Instruction...

StringRef - Represent a constant reference to a string, i.e.

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

A Use represents the edge between a Value definition and its users.

LLVM Value Representation.

Type * getType() const

All values are typed, get the type of this value.

LLVM_ABI const Value * stripAndAccumulateConstantOffsets(const DataLayout &DL, APInt &Offset, bool AllowNonInbounds, bool AllowInvariantGroup=false, function_ref< bool(Value &Value, APInt &Offset)> ExternalAnalysis=nullptr, bool LookThroughIntToPtr=false) const

Accumulate the constant offset this value has compared to a base pointer.

Represents an op.with.overflow intrinsic.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI bool haveNoCommonBitsSet(const WithCache< const Value * > &LHSCache, const WithCache< const Value * > &RHSCache, const SimplifyQuery &SQ)

Return true if LHS and RHS have no common bits set.

LLVM_ABI bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root, Instruction *OnPathTo, DominatorTree *DT)

Return true if undefined behavior would provable be executed on the path to OnPathTo if Root produced...

LLVM_ABI Intrinsic::ID getInverseMinMaxIntrinsic(Intrinsic::ID MinMaxID)

LLVM_ABI bool willNotFreeBetween(const Instruction *Assume, const Instruction *CtxI)

Returns true, if no instruction between Assume and CtxI may free memory and the function is marked as...

OverflowResult

Definition ValueTracking.h:622

@ NeverOverflows

Never overflows.

Definition ValueTracking.h:630

@ AlwaysOverflowsHigh

Always overflows in the direction of signed/unsigned max value.

Definition ValueTracking.h:626

@ AlwaysOverflowsLow

Always overflows in the direction of signed/unsigned min value.

Definition ValueTracking.h:624

@ MayOverflow

May or may not overflow.

Definition ValueTracking.h:628

LLVM_ABI KnownFPClass computeKnownFPClass(const Value *V, const APInt &DemandedElts, FPClassTest InterestedClasses, const SimplifyQuery &SQ, unsigned Depth=0)

Determine which floating-point classes are valid for V, and return them in KnownFPClass bit sets.

LLVM_ABI bool isValidAssumeForContext(const Instruction *I, const Instruction *CxtI, const DominatorTree *DT=nullptr, bool AllowEphemerals=false)

Return true if it is valid to use the assumptions provided by an assume intrinsic,...

LLVM_ABI bool canCreatePoison(const Operator *Op, bool ConsiderFlagsAndMetadata=true)

LLVM_ABI bool mustTriggerUB(const Instruction *I, const SmallPtrSetImpl< const Value * > &KnownPoison)

Return true if the given instruction must trigger undefined behavior when I is executed with any oper...

LLVM_ABI bool isKnownNeverInfinity(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if the floating-point scalar value is not an infinity or if the floating-point vector val...

LLVM_ABI void computeKnownBitsFromContext(const Value *V, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth=0)

Merge bits known from context-dependent facts into Known.

LLVM_ABI bool isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI)

LLVM_ABI bool isSignBitCheck(ICmpInst::Predicate Pred, const APInt &RHS, bool &TrueIfSigned)

Given an exploded icmp instruction, return true if the comparison only checks the sign bit.

LLVM_ABI const Value * getArgumentAliasingToReturnedPointer(const CallBase *Call, bool MustPreserveNullness)

This function returns call pointer argument that is considered the same by aliasing rules.

LLVM_ABI bool isAssumeLikeIntrinsic(const Instruction *I)

Return true if it is an intrinsic that cannot be speculated but also cannot trap.

LLVM_ABI AllocaInst * findAllocaForValue(Value *V, bool OffsetZero=false)

Returns unique alloca where the value comes from, or nullptr.

LLVM_ABI APInt getMinMaxLimit(SelectPatternFlavor SPF, unsigned BitWidth)

Return the minimum or maximum constant value for the specified integer min/max flavor and type.

LLVM_ABI bool isOnlyUsedInZeroComparison(const Instruction *CxtI)

LLVM_ABI bool getConstantStringInfo(const Value *V, StringRef &Str, bool TrimAtNul=true)

This function computes the length of a null-terminated C string pointed to by V.

LLVM_ABI bool onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V)

Return true if the only users of this pointer are lifetime markers or droppable instructions.

LLVM_ABI Value * stripNullTest(Value *V)

Returns the inner value X if the expression has the form f(X) where f(X) == 0 if and only if X == 0,...

LLVM_ABI bool getUnderlyingObjectsForCodeGen(const Value *V, SmallVectorImpl< Value * > &Objects)

This is a wrapper around getUnderlyingObjects and adds support for basic ptrtoint+arithmetic+inttoptr...

LLVM_ABI std::pair< Intrinsic::ID, bool > canConvertToMinOrMaxIntrinsic(ArrayRef< Value * > VL)

Check if the values in VL are select instructions that can be converted to a min or max (vector) intr...

LLVM_ABI bool getConstantDataArrayInfo(const Value *V, ConstantDataArraySlice &Slice, unsigned ElementSize, uint64_t Offset=0)

Returns true if the value V is a pointer into a ConstantDataArray.

LLVM_ABI bool isGuaranteedToExecuteForEveryIteration(const Instruction *I, const Loop *L)

Return true if this function can prove that the instruction I is executed for every iteration of the ...

Value * GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset, const DataLayout &DL, bool AllowNonInbounds=true)

Analyze the specified pointer to see if it can be expressed as a base pointer plus a constant offset.

Definition ValueTracking.h:344

LLVM_ABI bool isSafeToSpeculativelyExecute(const Instruction *I, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true, bool IgnoreUBImplyingAttrs=true)

Return true if the instruction does not have any effects besides calculating the result and does not ...

LLVM_ABI CmpInst::Predicate getMinMaxPred(SelectPatternFlavor SPF, bool Ordered=false)

Return the canonical comparison predicate for the specified minimum/maximum flavor.

LLVM_ABI bool canIgnoreSignBitOfZero(const Use &U)

Return true if the sign bit of the FP value can be ignored by the user when the value is zero.

LLVM_ABI bool isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)

Returns true if V cannot be undef, but may be poison.

LLVM_ABI ConstantRange computeConstantRange(const Value *V, bool ForSigned, bool UseInstrInfo=true, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)

Determine the possible constant range of an integer or vector of integer value.

LLVM_ABI bool MaskedValueIsZero(const Value *V, const APInt &Mask, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if 'V & Mask' is known to be zero.

LLVM_ABI bool isOverflowIntrinsicNoWrap(const WithOverflowInst *WO, const DominatorTree &DT)

Returns true if the arithmetic part of the WO 's result is used only along the paths control dependen...

LLVM_ABI bool matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, Value *&Start, Value *&Step)

Attempt to match a simple first order recurrence cycle of the form: iv = phi Ty [Start,...

LLVM_ABI OverflowResult computeOverflowForUnsignedMul(const Value *LHS, const Value *RHS, const SimplifyQuery &SQ, bool IsNSW=false)

LLVM_ABI SelectPatternFlavor getInverseMinMaxFlavor(SelectPatternFlavor SPF)

Return the inverse minimum/maximum flavor of the specified flavor.

constexpr unsigned MaxAnalysisRecursionDepth

Definition ValueTracking.h:47

LLVM_ABI void adjustKnownBitsForSelectArm(KnownBits &Known, Value *Cond, Value *Arm, bool Invert, const SimplifyQuery &Q, unsigned Depth=0)

Adjust Known for the given select Arm to include information from the select Cond.

LLVM_ABI bool isKnownNegative(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Returns true if the given value is known be negative (i.e.

LLVM_ABI OverflowResult computeOverflowForSignedSub(const Value *LHS, const Value *RHS, const SimplifyQuery &SQ)

SelectPatternFlavor

Specific patterns of select instructions we can match.

Definition ValueTracking.h:834

@ SPF_ABS

Floating point maxnum.

Definition ValueTracking.h:842

@ SPF_NABS

Absolute value.

Definition ValueTracking.h:843

@ SPF_FMAXNUM

Floating point minnum.

Definition ValueTracking.h:841

@ SPF_UMIN

Signed minimum.

Definition ValueTracking.h:837

@ SPF_UMAX

Signed maximum.

Definition ValueTracking.h:839

@ SPF_SMIN

Definition ValueTracking.h:836

@ SPF_SMAX

Unsigned minimum.

Definition ValueTracking.h:838

@ SPF_UNKNOWN

Definition ValueTracking.h:835

@ SPF_FMINNUM

Unsigned maximum.

Definition ValueTracking.h:840

LLVM_ABI bool isIntrinsicReturningPointerAliasingArgumentWithoutCapturing(const CallBase *Call, bool MustPreserveNullness)

{launder,strip}.invariant.group returns pointer that aliases its argument, and it only captures point...

LLVM_ABI bool impliesPoison(const Value *ValAssumedPoison, const Value *V)

Return true if V is poison given that ValAssumedPoison is already poison.

LLVM_ABI SelectPatternResult getSelectPattern(CmpInst::Predicate Pred, SelectPatternNaNBehavior NaNBehavior=SPNB_NA, bool Ordered=false)

Determine the pattern for predicate X Pred Y ? X : Y.

FPClassTest

Floating-point class tests, supported by 'is_fpclass' intrinsic.

LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)

Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...

LLVM_ABI bool programUndefinedIfPoison(const Instruction *Inst)

LLVM_ABI SelectPatternResult matchSelectPattern(Value *V, Value *&LHS, Value *&RHS, Instruction::CastOps *CastOp=nullptr, unsigned Depth=0)

Pattern match integer [SU]MIN, [SU]MAX and ABS idioms, returning the kind and providing the out param...

LLVM_ABI bool matchSimpleBinaryIntrinsicRecurrence(const IntrinsicInst *I, PHINode *&P, Value *&Init, Value *&OtherOp)

Attempt to match a simple value-accumulating recurrence of the form: llvm.intrinsic....

LLVM_ABI bool cannotBeNegativeZero(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if we can prove that the specified FP value is never equal to -0.0.

LLVM_ABI bool programUndefinedIfUndefOrPoison(const Instruction *Inst)

Return true if this function can prove that if Inst is executed and yields a poison value or undef bi...

LLVM_ABI bool collectPossibleValues(const Value *V, SmallPtrSetImpl< const Constant * > &Constants, unsigned MaxCount, bool AllowUndefOrPoison=true)

Enumerates all possible immediate values of V and inserts them into the set Constants.

constexpr unsigned MaxLookupSearchDepth

The max limit of the search depth in DecomposeGEPExpression() and getUnderlyingObject().

Definition ValueTracking.h:51

LLVM_ABI uint64_t GetStringLength(const Value *V, unsigned CharSize=8)

If we can compute the length of the string pointed to by the specified pointer, return 'len+1'.

LLVM_ABI OverflowResult computeOverflowForSignedMul(const Value *LHS, const Value *RHS, const SimplifyQuery &SQ)

LLVM_ABI ConstantRange getVScaleRange(const Function *F, unsigned BitWidth)

Determine the possible constant range of vscale with the given bit width, based on the vscale_range f...

LLVM_ABI bool canCreateUndefOrPoison(const Operator *Op, bool ConsiderFlagsAndMetadata=true)

canCreateUndefOrPoison returns true if Op can create undef or poison from non-undef & non-poison oper...

LLVM_ABI bool isKnownInversion(const Value *X, const Value *Y)

Return true iff:

LLVM_ABI bool intrinsicPropagatesPoison(Intrinsic::ID IID)

Return whether this intrinsic propagates poison for all operands.

LLVM_ABI bool isNotCrossLaneOperation(const Instruction *I)

Return true if the instruction doesn't potentially cross vector lanes.

LLVM_ABI bool isKnownNonZero(const Value *V, const SimplifyQuery &Q, unsigned Depth=0)

Return true if the given value is known to be non-zero when defined.

iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >

LLVM_ABI bool isSafeToSpeculativelyExecuteWithOpcode(unsigned Opcode, const Instruction *Inst, const Instruction *CtxI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr, const TargetLibraryInfo *TLI=nullptr, bool UseVariableInfo=true, bool IgnoreUBImplyingAttrs=true)

This returns the same result as isSafeToSpeculativelyExecute if Opcode is the actual opcode of Inst.

LLVM_ABI bool onlyUsedByLifetimeMarkers(const Value *V)

Return true if the only users of this pointer are lifetime markers.

LLVM_ABI Intrinsic::ID getIntrinsicForCallSite(const CallBase &CB, const TargetLibraryInfo *TLI)

Map a call instruction to an intrinsic ID.

LLVM_ABI const Value * getUnderlyingObjectAggressive(const Value *V)

Like getUnderlyingObject(), but will try harder to find a single underlying object.

LLVM_ABI Intrinsic::ID getMinMaxIntrinsic(SelectPatternFlavor SPF)

Convert given SPF to equivalent min/max intrinsic.

LLVM_ABI SelectPatternResult matchDecomposedSelectPattern(CmpInst *CmpI, Value *TrueVal, Value *FalseVal, Value *&LHS, Value *&RHS, FastMathFlags FMF=FastMathFlags(), Instruction::CastOps *CastOp=nullptr, unsigned Depth=0)

Determine the pattern that a select with the given compare as its predicate and given values as its t...

LLVM_ABI OverflowResult computeOverflowForSignedAdd(const WithCache< const Value * > &LHS, const WithCache< const Value * > &RHS, const SimplifyQuery &SQ)

LLVM_ABI bool propagatesPoison(const Use &PoisonOp)

Return true if PoisonOp's user yields poison or raises UB if its operand PoisonOp is poison.

LLVM_ABI ConstantRange computeConstantRangeIncludingKnownBits(const WithCache< const Value * > &V, bool ForSigned, const SimplifyQuery &SQ)

Combine constant ranges from computeConstantRange() and computeKnownBits().

SelectPatternNaNBehavior

Behavior when a floating point min/max is given one NaN and one non-NaN as input.

Definition ValueTracking.h:848

@ SPNB_RETURNS_NAN

NaN behavior not applicable.

Definition ValueTracking.h:850

@ SPNB_RETURNS_OTHER

Given one NaN input, returns the NaN.

Definition ValueTracking.h:851

@ SPNB_RETURNS_ANY

Given one NaN input, returns the non-NaN.

Definition ValueTracking.h:852

@ SPNB_NA

Definition ValueTracking.h:849

LLVM_ABI bool isKnownNonEqual(const Value *V1, const Value *V2, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if the given values are known to be non-equal when defined.

DWARFExpression::Operation Op

bool isSafeToSpeculativelyExecuteWithVariableReplaced(const Instruction *I, bool IgnoreUBImplyingAttrs=true)

Don't use information from its non-constant operands.

Definition ValueTracking.h:560

LLVM_ABI bool isGuaranteedNotToBeUndefOrPoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)

Return true if this function can prove that V does not have undef bits and is never poison.

ArrayRef(const T &OneElt) -> ArrayRef< T >

LLVM_ABI unsigned ComputeNumSignBits(const Value *Op, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)

Return the number of times the sign bit of the register is replicated into the other bits.

LLVM_ABI KnownBits analyzeKnownBitsFromAndXorOr(const Operator *I, const KnownBits &KnownLHS, const KnownBits &KnownRHS, const SimplifyQuery &SQ, unsigned Depth=0)

Using KnownBits LHS/RHS produce the known bits for logic op (and/xor/or).

LLVM_ABI OverflowResult computeOverflowForUnsignedSub(const Value *LHS, const Value *RHS, const SimplifyQuery &SQ)

LLVM_ABI bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)

Return true if this function can prove that the instruction I will always transfer execution to one o...

LLVM_ABI bool isKnownNeverInfOrNaN(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if the floating-point value can never contain a NaN or infinity.

LLVM_ABI bool isKnownNeverNaN(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if the floating-point scalar value is not a NaN or if the floating-point vector value has...

LLVM_ABI Value * isBytewiseValue(Value *V, const DataLayout &DL)

If the specified value can be set by repeating the same byte in memory, return the i8 value that it i...

LLVM_ABI std::optional< std::pair< CmpPredicate, Constant * > > getFlippedStrictnessPredicateAndConstant(CmpPredicate Pred, Constant *C)

Convert an integer comparison with a constant RHS into an equivalent form with the strictness flipped...

LLVM_ABI unsigned ComputeMaxSignificantBits(const Value *Op, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)

Get the upper bound on bit size for this Value Op as a signed integer.

LLVM_ABI OverflowResult computeOverflowForUnsignedAdd(const WithCache< const Value * > &LHS, const WithCache< const Value * > &RHS, const SimplifyQuery &SQ)

LLVM_ABI bool isKnownToBeAPowerOfTwo(const Value *V, const DataLayout &DL, bool OrZero=false, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)

Return true if the given value is known to have exactly one bit set when defined.

LLVM_ABI std::optional< bool > isImpliedByDomCondition(const Value *Cond, const Instruction *ContextI, const DataLayout &DL)

Return the boolean condition value in the context of the given instruction if it is known based on do...

LLVM_ABI bool isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)

Returns true if V cannot be poison, but may be undef.

LLVM_ABI void computeKnownBitsFromRangeMetadata(const MDNode &Ranges, KnownBits &Known)

Compute known bits from the range metadata.

LLVM_ABI Value * FindInsertedValue(Value *V, ArrayRef< unsigned > idx_range, std::optional< BasicBlock::iterator > InsertBefore=std::nullopt)

Given an aggregate and an sequence of indices, see if the scalar value indexed is already around as a...

LLVM_ABI bool isKnownNegation(const Value *X, const Value *Y, bool NeedNSW=false, bool AllowPoison=true)

Return true if the two given values are negation.

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 bool isKnownPositive(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Returns true if the given value is known be positive (i.e.

LLVM_ABI bool isKnownNonNegative(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Returns true if the give value is known to be non-negative.

LLVM_ABI bool cannotBeOrderedLessThanZero(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return true if we can prove that the specified FP value is either NaN or never less than -0....

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 mayHaveNonDefUseDependency(const Instruction &I)

Returns true if the result or effects of the given instructions I depend values not reachable through...

LLVM_ABI std::optional< bool > isImpliedCondition(const Value *LHS, const Value *RHS, const DataLayout &DL, bool LHSIsTrue=true, unsigned Depth=0)

Return true if RHS is known to be implied true by LHS.

LLVM_ABI std::optional< bool > computeKnownFPSignBit(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)

Return false if we can prove that the specified FP value's sign bit is 0.

LLVM_ABI bool canIgnoreSignBitOfNaN(const Use &U)

Return true if the sign bit of the FP value can be ignored by the user when the value is NaN.

LLVM_ABI void findValuesAffectedByCondition(Value *Cond, bool IsAssume, function_ref< void(Value *)> InsertAffected)

Call InsertAffected on all Values whose known bits / value may be affected by the condition Cond.

Represents offset+length into a ConstantDataArray.

Definition ValueTracking.h:363

uint64_t Length

Length of the slice.

Definition ValueTracking.h:372

uint64_t Offset

Slice starts at this Offset.

Definition ValueTracking.h:369

uint64_t operator[](unsigned I) const

Convenience accessor for elements in the slice.

Definition ValueTracking.h:382

void move(uint64_t Delta)

Moves the Offset and adjusts Length accordingly.

Definition ValueTracking.h:375

const ConstantDataArray * Array

ConstantDataArray pointer.

Definition ValueTracking.h:366

Definition ValueTracking.h:857

SelectPatternFlavor Flavor

Definition ValueTracking.h:858

bool Ordered

Only applicable if Flavor is SPF_FMINNUM or SPF_FMAXNUM.

Definition ValueTracking.h:861

static bool isMinOrMax(SelectPatternFlavor SPF)

When implementing this min/max pattern as fcmp; select, does the fcmp have to be ordered?

Definition ValueTracking.h:866

SelectPatternNaNBehavior NaNBehavior

Definition ValueTracking.h:859