[llvm] r370016 - [ValueTracking] Add AllowNonInbounds parameter to GetPointerBaseWithConstantOffset function
Hideto Ueno via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 23:30:33 PDT 2019
Author: uenoku
Date: Mon Aug 26 23:30:33 2019
New Revision: 370016
URL: http://llvm.org/viewvc/llvm-project?rev=370016&view=rev
Log:
[ValueTracking] Add AllowNonInbounds parameter to GetPointerBaseWithConstantOffset function
This commit was part of D65402.
Modified:
llvm/trunk/include/llvm/Analysis/ValueTracking.h
Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=370016&r1=370015&r2=370016&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original)
+++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Mon Aug 26 23:30:33 2019
@@ -242,19 +242,21 @@ class Value;
/// This is a wrapper around Value::stripAndAccumulateConstantOffsets that
/// creates and later unpacks the required APInt.
inline Value *GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
- const DataLayout &DL) {
+ const DataLayout &DL,
+ bool AllowNonInbounds = true) {
APInt OffsetAPInt(DL.getIndexTypeSizeInBits(Ptr->getType()), 0);
Value *Base =
- Ptr->stripAndAccumulateConstantOffsets(DL, OffsetAPInt,
- /* AllowNonInbounds */ true);
+ Ptr->stripAndAccumulateConstantOffsets(DL, OffsetAPInt, AllowNonInbounds);
+
Offset = OffsetAPInt.getSExtValue();
return Base;
}
- inline const Value *GetPointerBaseWithConstantOffset(const Value *Ptr,
- int64_t &Offset,
- const DataLayout &DL) {
- return GetPointerBaseWithConstantOffset(const_cast<Value *>(Ptr), Offset,
- DL);
+ inline const Value *
+ GetPointerBaseWithConstantOffset(const Value *Ptr, int64_t &Offset,
+ const DataLayout &DL,
+ bool AllowNonInbounds = true) {
+ return GetPointerBaseWithConstantOffset(const_cast<Value *>(Ptr), Offset, DL,
+ AllowNonInbounds);
}
/// Returns true if the GEP is based on a pointer to a string (array of
More information about the llvm-commits
mailing list