Skip to content

Commit 1c721cf

Browse files
committed
clang-format
1 parent 3f1d72f commit 1c721cf

File tree

3 files changed

+77
-75
lines changed

3 files changed

+77
-75
lines changed

llvm/include/llvm/Target/TargetVerifier.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- llvm/Target/TargetVerifier.h - LLVM IR Target Verifier ---*- C++ -*-===//
1+
//===-- llvm/Target/TargetVerifier.h - LLVM IR Target Verifier --*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -20,8 +20,8 @@
2020
#ifndef LLVM_TARGET_VERIFIER_H
2121
#define LLVM_TARGET_VERIFIER_H
2222

23-
#include "llvm/IR/PassManager.h"
2423
#include "llvm/IR/Module.h"
24+
#include "llvm/IR/PassManager.h"
2525
#include "llvm/TargetParser/Triple.h"
2626

2727
namespace llvm {
@@ -59,10 +59,11 @@ class TargetVerify {
5959
/// This calls the Message-only version so that the above is easier to set
6060
/// a breakpoint on.
6161
template <typename T1, typename... Ts>
62-
void CheckFailed(const Twine &Message, const T1 &V1, const Ts &... Vs) {
62+
void CheckFailed(const Twine &Message, const T1 &V1, const Ts &...Vs) {
6363
CheckFailed(Message);
6464
WriteValues({V1, Vs...});
6565
}
66+
6667
public:
6768
Module *Mod;
6869
Triple TT;
@@ -73,8 +74,7 @@ class TargetVerify {
7374
bool IsValid = true;
7475

7576
TargetVerify(Module *Mod)
76-
: Mod(Mod), TT(Mod->getTargetTriple()),
77-
MessagesStr(Messages) {}
77+
: Mod(Mod), TT(Mod->getTargetTriple()), MessagesStr(Messages) {}
7878

7979
virtual bool run(Function &F) = 0;
8080
};

llvm/include/llvm/Target/TargetVerify/AMDGPUTargetVerifier.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
//===-- llvm/Target/TargetVerify/AMDGPUTargetVerifier.h - AMDGPU ---*- C++ -*-===//
2-
////
3-
//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
//// See https://llvm.org/LICENSE.txt for license information.
5-
//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
////
7-
////===----------------------------------------------------------------------===//
8-
////
9-
//// This file defines target verifier interfaces that can be used for some
10-
//// validation of input to the system, and for checking that transformations
11-
//// haven't done something bad. In contrast to the Verifier or Lint, the
12-
//// TargetVerifier looks for constructions invalid to a particular target
13-
//// machine.
14-
////
15-
//// To see what specifically is checked, look at an individual backend's
16-
//// TargetVerifier.
17-
////
18-
////===----------------------------------------------------------------------===//
1+
//===-- llvm/Target/TargetVerify/AMDGPUTargetVerifier.h - AMDGPU -- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines target verifier interfaces that can be used for some
10+
// validation of input to the system, and for checking that transformations
11+
// haven't done something bad. In contrast to the Verifier or Lint, the
12+
// TargetVerifier looks for constructions invalid to a particular target
13+
// machine.
14+
//
15+
// To see what specifically is checked, look at an individual backend's
16+
// TargetVerifier.
17+
//
18+
//===----------------------------------------------------------------------===//
1919

2020
#ifndef LLVM_AMDGPU_TARGET_VERIFIER_H
2121
#define LLVM_AMDGPU_TARGET_VERIFIER_H
2222

2323
#include "llvm/Target/TargetVerifier.h"
2424

25-
#include "llvm/Analysis/UniformityAnalysis.h"
2625
#include "llvm/Analysis/PostDominators.h"
26+
#include "llvm/Analysis/UniformityAnalysis.h"
2727
#include "llvm/IR/Dominators.h"
2828

2929
namespace llvm {
@@ -43,10 +43,10 @@ class AMDGPUTargetVerify : public TargetVerify {
4343
PostDominatorTree *PDT = nullptr;
4444
UniformityInfo *UA = nullptr;
4545

46-
AMDGPUTargetVerify(Module *Mod)
47-
: TargetVerify(Mod), Mod(Mod) {}
46+
AMDGPUTargetVerify(Module *Mod) : TargetVerify(Mod), Mod(Mod) {}
4847

49-
AMDGPUTargetVerify(Module *Mod, DominatorTree *DT, PostDominatorTree *PDT, UniformityInfo *UA)
48+
AMDGPUTargetVerify(Module *Mod, DominatorTree *DT, PostDominatorTree *PDT,
49+
UniformityInfo *UA)
5050
: TargetVerify(Mod), Mod(Mod), DT(DT), PDT(PDT), UA(UA) {}
5151

5252
bool run(Function &F) override;

llvm/lib/Target/AMDGPU/AMDGPUTargetVerifier.cpp

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
//===-- AMDGPUTargetVerifier.cpp - AMDGPU -------------------------*- C++ -*-===//
2-
////
3-
//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
//// See https://llvm.org/LICENSE.txt for license information.
5-
//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
////
7-
////===----------------------------------------------------------------------===//
8-
////
9-
//// This file defines target verifier interfaces that can be used for some
10-
//// validation of input to the system, and for checking that transformations
11-
//// haven't done something bad. In contrast to the Verifier or Lint, the
12-
//// TargetVerifier looks for constructions invalid to a particular target
13-
//// machine.
14-
////
15-
//// To see what specifically is checked, look at an individual backend's
16-
//// TargetVerifier.
17-
////
18-
////===----------------------------------------------------------------------===//
1+
//===-- AMDGPUTargetVerifier.cpp - AMDGPU -----------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines target verifier interfaces that can be used for some
10+
// validation of input to the system, and for checking that transformations
11+
// haven't done something bad. In contrast to the Verifier or Lint, the
12+
// TargetVerifier looks for constructions invalid to a particular target
13+
// machine.
14+
//
15+
// To see what specifically is checked, look at an individual backend's
16+
// TargetVerifier.
17+
//
18+
//===----------------------------------------------------------------------===//
1919

20-
#include "AMDGPU.h"
2120
#include "llvm/Target/TargetVerify/AMDGPUTargetVerifier.h"
21+
#include "AMDGPU.h"
2222

23-
#include "llvm/Analysis/UniformityAnalysis.h"
2423
#include "llvm/Analysis/PostDominators.h"
25-
#include "llvm/Support/Debug.h"
24+
#include "llvm/Analysis/UniformityAnalysis.h"
2625
#include "llvm/IR/Dominators.h"
2726
#include "llvm/IR/Function.h"
2827
#include "llvm/IR/IntrinsicInst.h"
2928
#include "llvm/IR/IntrinsicsAMDGPU.h"
3029
#include "llvm/IR/Module.h"
3130
#include "llvm/IR/Value.h"
31+
#include "llvm/Support/Debug.h"
3232

3333
#include "llvm/Support/raw_ostream.h"
3434

@@ -39,53 +39,52 @@ using namespace llvm;
3939
do { \
4040
if (!(C)) { \
4141
TargetVerify::CheckFailed(__VA_ARGS__); \
42-
return false; \
4342
} \
4443
} while (false)
4544

4645
namespace llvm {
4746

4847
static bool isShader(CallingConv::ID CC) {
49-
switch(CC) {
50-
case CallingConv::AMDGPU_VS:
51-
case CallingConv::AMDGPU_LS:
52-
case CallingConv::AMDGPU_HS:
53-
case CallingConv::AMDGPU_ES:
54-
case CallingConv::AMDGPU_GS:
55-
case CallingConv::AMDGPU_PS:
56-
case CallingConv::AMDGPU_CS_Chain:
57-
case CallingConv::AMDGPU_CS_ChainPreserve:
58-
case CallingConv::AMDGPU_CS:
59-
return true;
60-
default:
61-
return false;
48+
switch (CC) {
49+
case CallingConv::AMDGPU_VS:
50+
case CallingConv::AMDGPU_LS:
51+
case CallingConv::AMDGPU_HS:
52+
case CallingConv::AMDGPU_ES:
53+
case CallingConv::AMDGPU_GS:
54+
case CallingConv::AMDGPU_PS:
55+
case CallingConv::AMDGPU_CS_Chain:
56+
case CallingConv::AMDGPU_CS_ChainPreserve:
57+
case CallingConv::AMDGPU_CS:
58+
return true;
59+
default:
60+
return false;
6261
}
6362
}
6463

6564
bool AMDGPUTargetVerify::run(Function &F) {
6665
// Ensure shader calling convention returns void
6766
if (isShader(F.getCallingConv()))
68-
Check(F.getReturnType() == Type::getVoidTy(F.getContext()), "Shaders must return void");
67+
Check(F.getReturnType() == Type::getVoidTy(F.getContext()),
68+
"Shaders must return void");
6969

7070
for (auto &BB : F) {
7171

7272
for (auto &I : BB) {
7373

74-
if (auto *CI = dyn_cast<CallInst>(&I))
75-
{
74+
if (auto *CI = dyn_cast<CallInst>(&I)) {
7675
// Ensure no kernel to kernel calls.
7776
CallingConv::ID CalleeCC = CI->getCallingConv();
78-
if (CalleeCC == CallingConv::AMDGPU_KERNEL)
79-
{
80-
CallingConv::ID CallerCC = CI->getParent()->getParent()->getCallingConv();
77+
if (CalleeCC == CallingConv::AMDGPU_KERNEL) {
78+
CallingConv::ID CallerCC =
79+
CI->getParent()->getParent()->getCallingConv();
8180
Check(CallerCC != CallingConv::AMDGPU_KERNEL,
82-
"A kernel may not call a kernel", CI->getParent()->getParent());
81+
"A kernel may not call a kernel", CI->getParent()->getParent());
8382
}
8483

8584
// Ensure chain intrinsics are followed by unreachables.
8685
if (CI->getIntrinsicID() == Intrinsic::amdgcn_cs_chain)
8786
Check(isa_and_present<UnreachableInst>(CI->getNextNode()),
88-
"llvm.amdgcn.cs.chain must be followed by unreachable", CI);
87+
"llvm.amdgcn.cs.chain must be followed by unreachable", CI);
8988
}
9089
}
9190
}
@@ -98,7 +97,8 @@ bool AMDGPUTargetVerify::run(Function &F) {
9897
return true;
9998
}
10099

101-
PreservedAnalyses AMDGPUTargetVerifierPass::run(Function &F, FunctionAnalysisManager &AM) {
100+
PreservedAnalyses AMDGPUTargetVerifierPass::run(Function &F,
101+
FunctionAnalysisManager &AM) {
102102
auto *Mod = F.getParent();
103103

104104
auto UA = &AM.getResult<UniformityInfoAnalysis>(F);
@@ -122,9 +122,10 @@ struct AMDGPUTargetVerifierLegacyPass : public FunctionPass {
122122
std::unique_ptr<AMDGPUTargetVerify> TV;
123123
bool FatalErrors = false;
124124

125-
AMDGPUTargetVerifierLegacyPass(bool FatalErrors) : FunctionPass(ID),
126-
FatalErrors(FatalErrors) {
127-
initializeAMDGPUTargetVerifierLegacyPassPass(*PassRegistry::getPassRegistry());
125+
AMDGPUTargetVerifierLegacyPass(bool FatalErrors)
126+
: FunctionPass(ID), FatalErrors(FatalErrors) {
127+
initializeAMDGPUTargetVerifierLegacyPassPass(
128+
*PassRegistry::getPassRegistry());
128129
}
129130

130131
bool doInitialization(Module &M) override {
@@ -167,4 +168,5 @@ FunctionPass *createAMDGPUTargetVerifierLegacyPass(bool FatalErrors) {
167168
return new AMDGPUTargetVerifierLegacyPass(FatalErrors);
168169
}
169170
} // namespace llvm
170-
INITIALIZE_PASS(AMDGPUTargetVerifierLegacyPass, "amdgpu-tgtverifier", "AMDGPU Target Verifier", false, false)
171+
INITIALIZE_PASS(AMDGPUTargetVerifierLegacyPass, "amdgpu-tgtverifier",
172+
"AMDGPU Target Verifier", false, false)

0 commit comments

Comments
 (0)