Skip to content

Commit 7175d97

Browse files
committed
!fixup remove left over code.
1 parent 55f01a3 commit 7175d97

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

llvm/lib/Analysis/Loads.cpp

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ static bool isDereferenceableAndAlignedPointerViaAssumption(
3636
function_ref<bool(const RetainedKnowledge &RK)> CheckSize,
3737
const DataLayout &DL, const Instruction *CtxI, AssumptionCache *AC,
3838
const DominatorTree *DT) {
39+
// Dereferenceable information from assumptions is only valid if the value
40+
// cannot be freed between the assumption and use. For now just use the
41+
// information for values that cannot be freed in the function.
42+
// TODO: More precisely check if the pointer can be freed between assumption
43+
// and use.
3944
if (!CtxI || Ptr->canBeFreed())
4045
return false;
4146
/// Look through assumes to see if both dereferencability and alignment can
@@ -198,40 +203,6 @@ static bool isDereferenceableAndAlignedPointer(
198203
Size, DL, CtxI, AC, DT, TLI,
199204
Visited, MaxDepth);
200205

201-
// Dereferenceable information from assumptions is only valid if the value
202-
// cannot be freed between the assumption and use. For now just use the
203-
// information for values that cannot be freed in the function.
204-
// TODO: More precisely check if the pointer can be freed between assumption
205-
// and use.
206-
if (CtxI) {
207-
const Value *UO = getUnderlyingObjectAggressive(V);
208-
if (!V->canBeFreed() || (UO && !UO->canBeFreed())) {
209-
/// Look through assumes to see if both dereferencability and alignment
210-
/// can be proven by an assume if needed.
211-
RetainedKnowledge AlignRK;
212-
RetainedKnowledge DerefRK;
213-
bool IsAligned = V->getPointerAlignment(DL) >= Alignment;
214-
if (getKnowledgeForValue(
215-
V, {Attribute::Dereferenceable, Attribute::Alignment}, AC,
216-
[&](RetainedKnowledge RK, Instruction *Assume, auto) {
217-
if (!isValidAssumeForContext(Assume, CtxI, DT))
218-
return false;
219-
if (RK.AttrKind == Attribute::Alignment)
220-
AlignRK = std::max(AlignRK, RK);
221-
if (RK.AttrKind == Attribute::Dereferenceable)
222-
DerefRK = std::max(DerefRK, RK);
223-
IsAligned |= AlignRK && AlignRK.ArgValue >= Alignment.value();
224-
if (IsAligned && DerefRK &&
225-
DerefRK.ArgValue >= Size.getZExtValue())
226-
return true; // We have found what we needed so we stop
227-
// looking
228-
return false; // Other assumes may have better information. so
229-
// keep looking
230-
}))
231-
return true;
232-
}
233-
}
234-
235206
return isDereferenceableAndAlignedPointerViaAssumption(
236207
V, Alignment,
237208
[Size](const RetainedKnowledge &RK) {

0 commit comments

Comments
 (0)