Skip to content

Commit e7d1042

Browse files
committed
format
1 parent ab1e78d commit e7d1042

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

llvm/lib/Analysis/DXILResource.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -770,21 +770,22 @@ void DXILBindingMap::print(raw_ostream &OS, DXILResourceTypeMap &DRTM,
770770
}
771771
}
772772

773-
SmallVector<dxil::ResourceBindingInfo>::const_iterator DXILBindingMap::findByUse(const Value *Key) const {
774-
const CallInst *CI = dyn_cast<CallInst>(Key);
775-
if (!CI) {
776-
// TODO: Any other cases to follow up the tree?
777-
return Infos.end();
778-
}
779-
780-
switch (CI->getIntrinsicID()) {
781-
case Intrinsic::not_intrinsic:
782-
return Infos.end();
783-
case Intrinsic::dx_resource_handlefrombinding:
784-
return find(CI);
785-
}
773+
SmallVector<dxil::ResourceBindingInfo>::const_iterator
774+
DXILBindingMap::findByUse(const Value *Key) const {
775+
const CallInst *CI = dyn_cast<CallInst>(Key);
776+
if (!CI) {
777+
// TODO: Any other cases to follow up the tree?
778+
return Infos.end();
779+
}
786780

781+
switch (CI->getIntrinsicID()) {
782+
case Intrinsic::not_intrinsic:
787783
return Infos.end();
784+
case Intrinsic::dx_resource_handlefrombinding:
785+
return find(CI);
786+
}
787+
788+
return Infos.end();
788789
}
789790

790791
//===----------------------------------------------------------------------===//
@@ -845,7 +846,7 @@ bool DXILResourceBindingWrapperPass::runOnModule(Module &M) {
845846
return false;
846847
}
847848

848-
void DXILResourceBindingWrapperPass::releaseMemory() {
849+
void DXILResourceBindingWrapperPass::releaseMemory() {
849850
/*Map.reset();*/ }
850851

851852
void DXILResourceBindingWrapperPass::print(raw_ostream &OS,

llvm/unittests/Target/DirectX/UniqueResourceFromUseTests.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,29 @@ declare void @a.func(target("dx.RawBuffer", float, 1, 0) %handle)
5151
ASSERT_TRUE(M) << "Bad assembly?";
5252
DebugifyCustomPassManager Passes;
5353
Passes.add(createDXILResourceTypeWrapperPassPass());
54-
DXILResourceBindingWrapperPass* RBPass = new DXILResourceBindingWrapperPass();
54+
DXILResourceBindingWrapperPass *RBPass = new DXILResourceBindingWrapperPass();
5555
Passes.add(RBPass);
5656
Passes.run(*M);
5757

5858
const DXILBindingMap &DBM = RBPass->getBindingMap();
59-
for (const Function& F : M->functions()) {
59+
for (const Function &F : M->functions()) {
6060
if (F.getName() != "a.func") {
6161
continue;
6262
}
6363

6464
unsigned CalledResources = 0;
6565

66-
for (const User* U : F.users()) {
67-
const CallInst* CI = dyn_cast<CallInst>(U);
66+
for (const User *U : F.users()) {
67+
const CallInst *CI = dyn_cast<CallInst>(U);
6868
ASSERT_TRUE(CI) << "All users of @a.func must be CallInst";
6969

70-
const Value* Handle = CI->getArgOperand(0);
70+
const Value *Handle = CI->getArgOperand(0);
7171

72-
const auto* It = DBM.findByUse(Handle);
72+
const auto *It = DBM.findByUse(Handle);
7373
ASSERT_TRUE(It != DBM.end()) << "Handle should resolve into resource";
7474

75-
const llvm::dxil::ResourceBindingInfo::ResourceBinding& Binding = It->getBinding();
75+
const llvm::dxil::ResourceBindingInfo::ResourceBinding &Binding =
76+
It->getBinding();
7677
EXPECT_EQ(0u, Binding.RecordID);
7778
EXPECT_EQ(1u, Binding.Space);
7879
EXPECT_EQ(2u, Binding.LowerBound);
@@ -81,7 +82,7 @@ declare void @a.func(target("dx.RawBuffer", float, 1, 0) %handle)
8182
CalledResources++;
8283
}
8384

84-
EXPECT_EQ(1u, CalledResources) << "Expected exactly 1 resolved call to create resource";
85+
EXPECT_EQ(1u, CalledResources)
86+
<< "Expected exactly 1 resolved call to create resource";
8587
}
86-
8788
}

0 commit comments

Comments
 (0)