Skip to content

Commit 79a4e9d

Browse files
committed
Update DXILForwardHandleAccesses.cpp to look at Operand 0 instead of 1 to account for intrinsic changes.
1 parent 821e767 commit 79a4e9d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/DirectX/DXILForwardHandleAccesses.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ static bool forwardHandleAccesses(Function &F, DominatorTree &DT) {
8787
// store them so that we may delete the alloca matches
8888
case Intrinsic::lifetime_start:
8989
case Intrinsic::lifetime_end:
90-
if (II->arg_size() >= 2) {
91-
Value *Ptr = II->getArgOperand(1);
90+
if (II->arg_size() >= 1) {
91+
Value *Ptr = II->getArgOperand(0);
9292
if (auto *Alloca = dyn_cast<AllocaInst>(Ptr->stripPointerCasts()))
9393
LifeTimeIntrinsicMap[Alloca].push_back(II);
9494
}

llvm/test/CodeGen/DirectX/forward_handle_on_alloca.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ entry:
2727
%handle = tail call target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_1_0t(i32 0, i32 3, i32 1, i32 0, i1 false, ptr nonnull @name)
2828
store target("dx.RawBuffer", i32, 1, 0) %handle , ptr @global, align 4
2929
%val = load i32, ptr @global, align 4
30-
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %alloca)
30+
call void @llvm.lifetime.start.p0(ptr nonnull %alloca)
3131
store i32 %val , ptr %alloca, align 8
3232
%indirect = load target("dx.RawBuffer", i32, 1, 0), ptr %alloca, align 8
3333
%buff = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_i32_1_0t(target("dx.RawBuffer", i32, 1, 0) %indirect, i32 0)
3434
store i32 0, ptr %buff, align 4
35-
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %alloca)
35+
call void @llvm.lifetime.end.p0(ptr nonnull %alloca)
3636
ret void
3737
}

0 commit comments

Comments
 (0)