Skip to content

Commit db1340c

Browse files
committed
!fixup remove left over code.
1 parent b9aef84 commit db1340c

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

llvm/lib/Analysis/Loads.cpp

Lines changed: 5 additions & 30 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,36 +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 && AC && !V->canBeFreed()) {
207-
/// Look through assumes to see if both dereferencability and alignment can
208-
/// be proven by an assume if needed.
209-
RetainedKnowledge AlignRK;
210-
RetainedKnowledge DerefRK;
211-
bool IsAligned = V->getPointerAlignment(DL) >= Alignment;
212-
if (getKnowledgeForValue(
213-
V, {Attribute::Dereferenceable, Attribute::Alignment}, *AC,
214-
[&](RetainedKnowledge RK, Instruction *Assume, auto) {
215-
if (!isValidAssumeForContext(Assume, CtxI, DT))
216-
return false;
217-
if (RK.AttrKind == Attribute::Alignment)
218-
AlignRK = std::max(AlignRK, RK);
219-
if (RK.AttrKind == Attribute::Dereferenceable)
220-
DerefRK = std::max(DerefRK, RK);
221-
IsAligned |= AlignRK && AlignRK.ArgValue >= Alignment.value();
222-
if (IsAligned && DerefRK &&
223-
DerefRK.ArgValue >= Size.getZExtValue())
224-
return true; // We have found what we needed so we stop looking
225-
return false; // Other assumes may have better information. so
226-
// keep looking
227-
}))
228-
return true;
229-
}
230-
231206
return isDereferenceableAndAlignedPointerViaAssumption(
232207
V, Alignment,
233208
[Size](const RetainedKnowledge &RK) {

0 commit comments

Comments
 (0)