Skip to content

Commit 087e9e4

Browse files
committed
Revert "[CaptureTracking] Supports analysis for dervied pointers"
This reverts commit 87c0937.
1 parent 5ba4919 commit 087e9e4

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

llvm/lib/Analysis/CaptureTracking.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,6 @@ void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker,
424424
if (MaxUsesToExplore == 0)
425425
MaxUsesToExplore = DefaultMaxUsesToExplore;
426426

427-
// When analyzing a derived pointer, we need to analyze its underlying
428-
// object to determine whether it is captured.
429-
// E.g., `ptr + 1` is captured if `ptr` is captured.
430-
V = getUnderlyingObjectAggressive(V);
431427
SmallVector<const Use *, 20> Worklist;
432428
Worklist.reserve(getDefaultMaxUsesToExploreForCaptureTracking());
433429
SmallSet<const Use *, 20> Visited;

llvm/unittests/Analysis/CaptureTrackingTest.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -132,31 +132,3 @@ TEST(CaptureTracking, MultipleUsesInSameInstruction) {
132132
EXPECT_EQ(ICmp, CT.Captures[6]->getUser());
133133
EXPECT_EQ(1u, CT.Captures[6]->getOperandNo());
134134
}
135-
136-
TEST(CaptureTracking, DerivedPointerIfBasePointerCaptured) {
137-
StringRef Assembly = R"(
138-
declare void @bar(ptr)
139-
140-
define void @test() {
141-
%stkobj = alloca [2 x i32]
142-
%derived = getelementptr inbounds [2 x i32], ptr %stkobj, i64 0, i64 1
143-
store i32 1, ptr %derived
144-
call void @bar(ptr %stkobj)
145-
ret void
146-
}
147-
)";
148-
149-
LLVMContext Context;
150-
SMDiagnostic Error;
151-
auto M = parseAssemblyString(Assembly, Error, Context);
152-
ASSERT_TRUE(M) << "Bad assembly?";
153-
154-
Function *F = M->getFunction("test");
155-
BasicBlock *BB = &F->getEntryBlock();
156-
Instruction *StackObj = &*BB->begin();
157-
Instruction *DerviedPtr = StackObj->getNextNode();
158-
159-
// The base object and its derived pointer are both captured.
160-
EXPECT_TRUE(PointerMayBeCaptured(StackObj, true));
161-
EXPECT_TRUE(PointerMayBeCaptured(DerviedPtr, true));
162-
}

0 commit comments

Comments
 (0)