Skip to content

[SER] Transform RayDesc in ScalarReplHLSL for robust lowering #7435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/dxc/HLSL/HLOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ const unsigned kAnnotateNodeHandleNodePropIdx = 2;
const unsigned kAnnotateNodeRecordHandleNodeRecordPropIdx = 2;

// HitObject::MakeMiss
const unsigned kHitObjectMakeMiss_NumOp = 8;
const unsigned kHitObjectMakeMiss_NumOp = 5;
const unsigned kHitObjectMakeMissRayDescOpIdx = 4;

// HitObject::TraceRay
Expand Down
39 changes: 12 additions & 27 deletions lib/HLSL/HLOperationLower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6217,35 +6217,20 @@ Value *TranslateHitObjectMake(CallInst *CI, IntrinsicOp IOP, OP::OpCode Opcode,

DXASSERT_NOMSG(CI->getNumArgOperands() ==
HLOperandIndex::kHitObjectMakeMiss_NumOp);
Value *RayFlags = CI->getArgOperand(SrcIdx++);
Value *MissShaderIdx = CI->getArgOperand(SrcIdx++);
DXASSERT_NOMSG(SrcIdx == HLOperandIndex::kHitObjectMakeMissRayDescOpIdx);
Value *RayDescOrigin = CI->getArgOperand(SrcIdx++);
Value *RayDescOriginX =
Builder.CreateExtractElement(RayDescOrigin, (uint64_t)0);
Value *RayDescOriginY =
Builder.CreateExtractElement(RayDescOrigin, (uint64_t)1);
Value *RayDescOriginZ =
Builder.CreateExtractElement(RayDescOrigin, (uint64_t)2);

Value *RayDescTMin = CI->getArgOperand(SrcIdx++);
Value *RayDescDirection = CI->getArgOperand(SrcIdx++);
Value *RayDescDirectionX =
Builder.CreateExtractElement(RayDescDirection, (uint64_t)0);
Value *RayDescDirectionY =
Builder.CreateExtractElement(RayDescDirection, (uint64_t)1);
Value *RayDescDirectionZ =
Builder.CreateExtractElement(RayDescDirection, (uint64_t)2);

Value *RayDescTMax = CI->getArgOperand(SrcIdx++);
const unsigned DxilNumArgs = DxilInst_HitObject_MakeMiss::arg_TMax + 1;
Value *Args[DxilNumArgs];
Args[0] = nullptr; // Opcode
unsigned DestIdx = 1;
Args[DestIdx++] = CI->getArgOperand(SrcIdx++); // RayFlags
Args[DestIdx++] = CI->getArgOperand(SrcIdx++); // MissShaderIdx
Value *RayDescPtr = CI->getArgOperand(SrcIdx++);
DestIdx = LoadRayDescElementsIntoArgs(Args, &Helper.hlslOP, Builder,
RayDescPtr, DestIdx);
DXASSERT_NOMSG(SrcIdx == CI->getNumArgOperands());
DXASSERT_NOMSG(DestIdx == DxilNumArgs);

Value *OutHitObject = TrivialDxilOperation(
Opcode,
{nullptr, RayFlags, MissShaderIdx, RayDescOriginX, RayDescOriginY,
RayDescOriginZ, RayDescTMin, RayDescDirectionX, RayDescDirectionY,
RayDescDirectionZ, RayDescTMax},
Helper.voidTy, CI, HlslOP);
Value *OutHitObject =
TrivialDxilOperation(Opcode, Args, Helper.voidTy, CI, HlslOP);
Builder.CreateStore(OutHitObject, HitObjectPtr);
return nullptr;
}
Expand Down
58 changes: 28 additions & 30 deletions lib/Transforms/Scalar/ScalarReplAggregatesHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,9 +1539,7 @@ void isSafeForScalarRepl(Instruction *I, uint64_t Offset, AllocaInfo &Info) {
// TODO: should we check HL parameter type for UDT overload instead of
// basing on IOP?
IntrinsicOp opcode = static_cast<IntrinsicOp>(GetHLOpcode(CI));
if (IntrinsicOp::IOP_TraceRay == opcode ||
IntrinsicOp::MOP_DxHitObject_TraceRay == opcode ||
IntrinsicOp::MOP_DxHitObject_Invoke == opcode ||
if (IntrinsicOp::MOP_DxHitObject_Invoke == opcode ||
IntrinsicOp::IOP_ReportHit == opcode ||
IntrinsicOp::IOP_CallShader == opcode) {
return MarkUnsafe(Info, User);
Expand Down Expand Up @@ -2687,7 +2685,7 @@ void SROA_Helper::RewriteCallArg(CallInst *CI, unsigned ArgIdx, bool bIn,
Builder.SetInsertPoint(CI->getNextNode());
MemCpyInst *cpy = cast<MemCpyInst>(Builder.CreateMemCpy(
userTyV, Alloca, DL.getTypeAllocSize(userTyElt), false));
RewriteMemIntrin(cpy, cpy->getRawSource());
RewriteMemIntrin(cpy, cpy->getRawDest());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has fewer than expected, but nevertheless extant, though potentially subtle effects. What prompted it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was erroneously triggering the memcpy-undef-to-undef-optimization inRewriteMemIntrin for the out-copy. This change makes the in and out RewriteMemIntrin calls symmetric and resolves the mis-optimization.

}
}

Expand Down Expand Up @@ -2756,18 +2754,21 @@ void SROA_Helper::RewriteCall(CallInst *CI) {
/*loadElts*/ false);
DeadInsts.push_back(CI);
} break;
case IntrinsicOp::IOP_TraceRay: {
if (OldVal ==
CI->getArgOperand(HLOperandIndex::kTraceRayRayDescOpIdx)) {
RewriteCallArg(CI, HLOperandIndex::kTraceRayRayDescOpIdx,
/*bIn*/ true, /*bOut*/ false);
} else {
DXASSERT(OldVal ==
CI->getArgOperand(HLOperandIndex::kTraceRayPayLoadOpIdx),
"else invalid TraceRay");
RewriteCallArg(CI, HLOperandIndex::kTraceRayPayLoadOpIdx,
/*bIn*/ true, /*bOut*/ true);
case IntrinsicOp::IOP_TraceRay:
case IntrinsicOp::MOP_DxHitObject_TraceRay: {
const int RayDescIdx =
IOP == IntrinsicOp::IOP_TraceRay
? HLOperandIndex::kTraceRayRayDescOpIdx
: HLOperandIndex::kHitObjectTraceRay_RayDescOpIdx;
if (OldVal == CI->getArgOperand(RayDescIdx)) {
RewriteCallArg(CI, RayDescIdx, /*bIn*/ true, /*bOut*/ false);
break;
}
const int PayloadIdx = CI->getNumArgOperands() - 1;
DXASSERT(OldVal == CI->getArgOperand(PayloadIdx),
"else invalid TraceRay");
RewriteCallArg(CI, PayloadIdx,
/*bIn*/ true, /*bOut*/ true);
} break;
case IntrinsicOp::IOP_ReportHit: {
RewriteCallArg(CI, HLOperandIndex::kReportIntersectionAttributeOpIdx,
Expand All @@ -2780,21 +2781,10 @@ void SROA_Helper::RewriteCall(CallInst *CI) {
case IntrinsicOp::MOP_DxHitObject_MakeMiss: {
if (OldVal ==
CI->getArgOperand(HLOperandIndex::kHitObjectMakeMissRayDescOpIdx)) {
RewriteWithFlattenedHLIntrinsicCall(CI, OldVal, NewElts,
/*loadElts*/ true);
DeadInsts.push_back(CI);
RewriteCallArg(CI, HLOperandIndex::kHitObjectMakeMissRayDescOpIdx,
/*bIn*/ true, /*bOut*/ false);
}
} break;
case IntrinsicOp::MOP_TraceRayInline: {
if (OldVal ==
CI->getArgOperand(HLOperandIndex::kTraceRayInlineRayDescOpIdx)) {
RewriteWithFlattenedHLIntrinsicCall(CI, OldVal, NewElts,
/*loadElts*/ true);
DeadInsts.push_back(CI);
break;
}
}
LLVM_FALLTHROUGH;
case IntrinsicOp::MOP_DxHitObject_FromRayQuery: {
const bool IsWithAttrs =
CI->getNumArgOperands() ==
Expand All @@ -2808,7 +2798,6 @@ void SROA_Helper::RewriteCall(CallInst *CI) {
CI,
HLOperandIndex::kHitObjectFromRayQuery_WithAttrs_AttributeOpIdx,
/*bIn*/ true, /*bOut*/ false);
break;
}

// For RayQuery methods, we want to replace the RayQuery this pointer
Expand All @@ -2817,8 +2806,17 @@ void SROA_Helper::RewriteCall(CallInst *CI) {
RewriteWithFlattenedHLIntrinsicCall(CI, OldVal, NewElts,
/*loadElts*/ true);
DeadInsts.push_back(CI);
break;
} break;
case IntrinsicOp::MOP_TraceRayInline: {
if (OldVal ==
CI->getArgOperand(HLOperandIndex::kTraceRayInlineRayDescOpIdx)) {
RewriteWithFlattenedHLIntrinsicCall(CI, OldVal, NewElts,
/*loadElts*/ true);
DeadInsts.push_back(CI);
break;
}
}
LLVM_FALLTHROUGH;
default:
// RayQuery this pointer replacement.
if (OldVal->getType()->isPointerTy() &&
Expand Down
121 changes: 121 additions & 0 deletions tools/clang/test/CodeGenDXIL/hlsl/objects/HitObject/multi_raydesc.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// RUN: %dxc %s -T lib_6_9 -DPRESET_LOCAL_RAYDESC=1 | FileCheck %s --check-prefix LOCAL
// RUN: %dxc %s -T lib_6_9 -DPRESET_CBUFFER_RAYDESC_NORQ=1 | FileCheck %s --check-prefix CBUFFER

// cbank load lowering bug:
// COM: %dxc %s -T lib_6_9 -DPRESET_CBUFFER_RAYDESC=1 | FileCheck %s --check-prefix CBUFFER_RQ

#if PRESET_LOCAL_RAYDESC
// Single local RayDesc with using ops

#define RD0 1
// #define RD1 1
#define HIT1 1
#define HIT2 1
#define HIT3 1
#define HIT4 1

// LOCAL: %{{[^ ]+}} = call %dx.types.HitObject @dx.op.hitObject_MakeMiss(i32 265, i32 0, i32 0, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00) ; HitObject_MakeMiss(RayFlags,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax)
// LOCAL: %{{[^ ]+}} = call %dx.types.HitObject @dx.op.hitObject_TraceRay.struct.PerRayData(i32 262, %dx.types.Handle %{{[^ ]+}}, i32 256, i32 255, i32 0, i32 0, i32 0, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, %struct.PerRayData* nonnull %{{[^ ]+}}) ; HitObject_TraceRay(accelerationStructure,rayFlags,instanceInclusionMask,rayContributionToHitGroupIndex,multiplierForGeometryContributionToHitGroupIndex,missShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)
// LOCAL: call void @dx.op.rayQuery_TraceRayInline(i32 179, i32 %{{[^ ]+}}, %dx.types.Handle %{{[^ ]+}}, i32 0, i32 255, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00) ; RayQuery_TraceRayInline(rayQueryHandle,accelerationStructure,rayFlags,instanceInclusionMask,origin_X,origin_Y,origin_Z,tMin,direction_X,direction_Y,direction_Z,tMax)
// LOCAL: call void @dx.op.traceRay.struct.PerRayData(i32 157, %dx.types.Handle %{{[^ ]+}}, i32 256, i32 255, i32 0, i32 0, i32 0, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, %struct.PerRayData* nonnull %{{[^ ]+}}) ; TraceRay(AccelerationStructure,RayFlags,InstanceInclusionMask,RayContributionToHitGroupIndex,MultiplierForGeometryContributionToShaderIndex,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)

#endif


#if PRESET_CBUFFER_RAYDESC_NORQ
// RayDesc served from cbuffer

// #define RD0 1
#define RD1 1
#define HIT1 1
#define HIT2 1
// #define HIT3 1
#define HIT4 1

// CBUFFER: %[[LD00:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH:[^ ]+]], i32 0) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD0O0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD00]], 0
// CBUFFER: %[[RD0O1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD00]], 1
// CBUFFER: %[[RD0O2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD00]], 2
// CBUFFER: %[[RD0MIN:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD00]], 3
// CBUFFER: %[[LD01:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH]], i32 1) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD0D0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD01]], 0
// CBUFFER: %[[RD0D1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD01]], 1
// CBUFFER: %[[RD0D2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD01]], 2
// CBUFFER: %[[RD0MAX:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD01]], 3
// CBUFFER: %{{[^ ]+}} = call %dx.types.HitObject @dx.op.hitObject_MakeMiss(i32 265, i32 0, i32 0, float %[[RD0O0]], float %[[RD0O1]], float %[[RD0O2]], float %[[RD0MIN]], float %[[RD0D0]], float %[[RD0D1]], float %[[RD0D2]], float %[[RD0MAX]]) ; HitObject_MakeMiss(RayFlags,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax)

// CBUFFER: %[[LD10:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH]], i32 0) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD1O0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD10]], 0
// CBUFFER: %[[RD1O1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD10]], 1
// CBUFFER: %[[RD1O2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD10]], 2
// CBUFFER: %[[RD1MIN:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD10]], 3
// CBUFFER: %[[LD11:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH]], i32 1) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD1D0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD11]], 0
// CBUFFER: %[[RD1D1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD11]], 1
// CBUFFER: %[[RD1D2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD11]], 2
// CBUFFER: %[[RD1MAX:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD11]], 3
// CBUFFER: %{{[^ ]+}} = call %dx.types.HitObject @dx.op.hitObject_TraceRay.struct.PerRayData(i32 262, %dx.types.Handle %{{[^ ]+}}, i32 256, i32 255, i32 0, i32 0, i32 0, float %[[RD1O0]], float %[[RD1O1]], float %[[RD1O2]], float %[[RD1MIN]], float %[[RD1D0]], float %[[RD1D1]], float %[[RD1D2]], float %[[RD1MAX]], %struct.PerRayData* nonnull %{{[^ ]+}}) ; HitObject_TraceRay(accelerationStructure,rayFlags,instanceInclusionMask,rayContributionToHitGroupIndex,multiplierForGeometryContributionToHitGroupIndex,missShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)

// CBUFFER: %[[LD20:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH]], i32 0) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD2O0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD20]], 0
// CBUFFER: %[[RD2O1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD20]], 1
// CBUFFER: %[[RD2O2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD20]], 2
// CBUFFER: %[[RD2MIN:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD20]], 3
// CBUFFER: %[[LD21:[^ ]+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[CBH]], i32 1) ; CBufferLoadLegacy(handle,regIndex)
// CBUFFER: %[[RD2D0:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD21]], 0
// CBUFFER: %[[RD2D1:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD21]], 1
// CBUFFER: %[[RD2D2:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD21]], 2
// CBUFFER: %[[RD2MAX:[^ ]+]] = extractvalue %dx.types.CBufRet.f32 %[[LD21]], 3
// CBUFFER: call void @dx.op.traceRay.struct.PerRayData(i32 157, %dx.types.Handle %{{[^ ]+}}, i32 256, i32 255, i32 0, i32 0, i32 0, float %[[RD2O0]], float %[[RD2O1]], float %[[RD2O2]], float %[[RD2MIN]], float %[[RD2D0]], float %[[RD2D1]], float %[[RD2D2]], float %[[RD2MAX]], %struct.PerRayData* nonnull %{{[^ ]+}}) ; TraceRay(AccelerationStructure,RayFlags,InstanceInclusionMask,RayContributionToHitGroupIndex,MultiplierForGeometryContributionToShaderIndex,MissShaderIndex,Origin_X,Origin_Y,Origin_Z,TMin,Direction_X,Direction_Y,Direction_Z,TMax,payload)

#endif

#if PRESET_CBUFFER_RAYDESC
// TraceRayInline with RayDesc from cbuffer
// Lowering broken

// #define RD0 1
#define RD1 1
// #define HIT1 1
// #define HIT2 1
#define HIT3 1
// #define HIT4 1
#endif


struct[raypayload] PerRayData
{
};

RaytracingAccelerationStructure topObject : register(t0);

#if RD1
RayDesc ray;
#endif

[shader("raygeneration")]
void raygen()
{
#if RD0
RayDesc ray = {{0, 1, 2}, 3, {4, 5, 6}, 7};
#endif

PerRayData payload;
#if HIT1
dx::HitObject hit1 = dx::HitObject::MakeMiss(RAY_FLAG_NONE, 0, ray);
dx::MaybeReorderThread(hit1);
#endif
#if HIT2
dx::HitObject hit2 = dx::HitObject::TraceRay(topObject, RAY_FLAG_SKIP_TRIANGLES, 0xFF, 0, 0, 0, ray, payload);
dx::MaybeReorderThread(hit2);
#endif
#if HIT3
RayQuery<RAY_FLAG_NONE> rayQuery;
rayQuery.TraceRayInline(topObject, RAY_FLAG_NONE, 0xFF, ray);
dx::HitObject hit3 = dx::HitObject::FromRayQuery(rayQuery);
dx::MaybeReorderThread(hit3);
#endif
#if HIT4
TraceRay(topObject, RAY_FLAG_SKIP_TRIANGLES, 0xFF, 0, 0, 0, ray, payload);
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ entry:
%hit = alloca %dx.types.HitObject, align 4
%tmp = alloca %dx.types.HitObject, align 4
%ray = alloca %struct.RayDesc, align 4
; CHECK-NOT: %{{[^ ]+}} = alloca %struct.RayDesc
; CHECK: %[[RDA:[^ ]+]] = alloca %struct.RayDesc
; CHECK: %[[RDO:[^ ]+]] = alloca <3 x float>
; CHECK: %[[RDMIN:[^ ]+]] = alloca float
; CHECK: %[[RDD:[^ ]+]] = alloca <3 x float>
; CHECK: %[[RDTMAX:[^ ]+]] = alloca float
%tmp2 = alloca %dx.types.HitObject, align 4
; CHECK: %[[HIT0:[^ ]+]] = alloca %dx.types.HitObject, align 4
; CHECK: %[[HIT1:[^ ]+]] = alloca %dx.types.HitObject, align 4
; CHECK: %[[HIT2:[^ ]+]] = alloca %dx.types.HitObject, align 4
; CHECK-NOT: alloca
%0 = bitcast %dx.types.HitObject* %hit to i8*, !dbg !23 ; line:42 col:3
call void @llvm.lifetime.start(i64 4, i8* %0) #0, !dbg !23 ; line:42 col:3
; CHECK: %[[THIS0:[^ ]+]] = call %dx.types.HitObject* @"dx.hl.op..%dx.types.HitObject* (i32, %dx.types.HitObject*)"(i32 358, %dx.types.HitObject* %[[HIT0]])
Expand All @@ -61,15 +66,20 @@ entry:
store float 1.000000e+03, float* %8, !dbg !30 ; line:44 col:17
%9 = bitcast %dx.types.HitObject* %tmp2 to i8*, !dbg !31 ; line:45 col:3
call void @llvm.lifetime.start(i64 4, i8* %9) #0, !dbg !31 ; line:45 col:3
; CHECK: store <3 x float> zeroinitializer, <3 x float>* %[[pRDO:[^ ]+]],
; CHECK: store float 0.000000e+00, float* %[[pRDTMIN:[^ ]+]],
; CHECK: store <3 x float> <float 0.000000e+00, float 1.000000e+00, float 0x3FA99999A0000000>, <3 x float>* %[[pRDD:[^ ]+]],
; CHECK: store float 1.000000e+03, float* %[[pRDTMAX:[^ ]+]],
; CHECK-DAG: %[[RDO:[^ ]+]] = load <3 x float>, <3 x float>* %[[pRDO]],
; CHECK-DAG: %[[RDTMIN:[^ ]+]] = load float, float* %[[pRDTMIN]],
; CHECK-DAG: %[[RDD:[^ ]+]] = load <3 x float>, <3 x float>* %[[pRDD]],
; CHECK-DAG: %[[RDTMAX:[^ ]+]] = load float, float* %[[pRDTMAX]],
; CHECK: call void @"dx.hl.op..void (i32, %dx.types.HitObject*, i32, i32, <3 x float>, float, <3 x float>, float)"(i32 387, %dx.types.HitObject* %[[HIT2]], i32 0, i32 1, <3 x float> %[[RDO]], float %[[RDTMIN]], <3 x float> %[[RDD]], float %[[RDTMAX]])
; CHECK: %[[OPTR:[^ ]+]] = getelementptr inbounds %struct.RayDesc, %struct.RayDesc* %[[RDA]], i32 0, i32 0
; CHECK: %[[O:[^ ]+]] = load <3 x float>, <3 x float>* %[[RDO]]
; CHECK: store <3 x float> %[[O]], <3 x float>* %[[OPTR]]
; CHECK: %[[MINPTR:[^ ]+]] = getelementptr inbounds %struct.RayDesc, %struct.RayDesc* %[[RDA]], i32 0, i32 1
; CHECK: %[[MIN:[^ ]+]] = load float, float* %[[RDMIN]]
; CHECK: store float %[[MIN]], float* %[[MINPTR]]
; CHECK: %[[DIRPTR:[^ ]+]] = getelementptr inbounds %struct.RayDesc, %struct.RayDesc* %[[RDA]], i32 0, i32 2
; CHECK: %[[DIR:[^ ]+]] = load <3 x float>, <3 x float>* %[[RDD]]
; CHECK: store <3 x float> %[[DIR]], <3 x float>* %[[DIRPTR]]
; CHECK: %[[MAXPTR:[^ ]+]] = getelementptr inbounds %struct.RayDesc, %struct.RayDesc* %[[RDA]], i32 0, i32 3
; CHECK: %[[MAX:[^ ]+]] = load float, float* %[[RDTMAX]]
; CHECK: store float %[[MAX]], float* %[[MAXPTR]]
; CHECK: call void @"dx.hl.op..void (i32, %dx.types.HitObject*, i32, i32, %struct.RayDesc*)"(i32 387, %dx.types.HitObject* %[[HIT2]], i32 0, i32 1, %struct.RayDesc* %[[RDA]])

call void @"dx.hl.op..void (i32, %dx.types.HitObject*, i32, i32, %struct.RayDesc*)"(i32 387, %dx.types.HitObject* %tmp2, i32 0, i32 1, %struct.RayDesc* %ray), !dbg !31 ; line:45 col:3
%10 = bitcast %dx.types.HitObject* %tmp2 to i8*, !dbg !31 ; line:45 col:3
call void @llvm.lifetime.end(i64 4, i8* %10) #0, !dbg !31 ; line:45 col:3
Expand Down
Loading