Skip to content

Commit 8ac48fe

Browse files
author
joaosaffran
committed
addressing nit
1 parent ac44b3b commit 8ac48fe

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "llvm/IR/DataLayout.h"
4141
#include "llvm/IR/Dominators.h"
4242
#include "llvm/IR/FPEnv.h"
43+
#include "llvm/IR/Instruction.h"
4344
#include "llvm/IR/IntrinsicInst.h"
4445
#include "llvm/IR/Intrinsics.h"
4546
#include "llvm/IR/MDBuilder.h"
@@ -2081,8 +2082,8 @@ void CodeGenFunction::EmitBranchOnBoolExpr(
20812082
Weights = createProfileWeights(TrueCount, CurrentCount - TrueCount);
20822083
}
20832084

2084-
auto *BrInst = Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights,
2085-
Unpredictable);
2085+
llvm::Instruction *BrInst = Builder.CreateCondBr(CondV, TrueBlock, FalseBlock,
2086+
Weights, Unpredictable);
20862087
switch (HLSLControlFlowAttr) {
20872088
case HLSLControlFlowHintAttr::Microsoft_branch:
20882089
case HLSLControlFlowHintAttr::Microsoft_flatten: {

clang/test/AST/HLSL/HLSLControlFlowHint.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export int flatten(int X){
2929
}
3030

3131
// CHECK: FunctionDecl 0x{{[0-9A-Fa-f]+}} <{{.*}}> {{.*}} used no_attr 'int (int)'
32-
// CHECK-NO: AttributedStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>
33-
// CHECK-NO: -HLSLControlFlowHintAttr
32+
// CHECK-NOT: AttributedStmt 0x{{[0-9A-Fa-f]+}} <<invalid sloc>
33+
// CHECK-NOT: -HLSLControlFlowHintAttr
3434
export int no_attr(int X){
3535
int resp;
3636
if (X > 0) {

clang/test/CodeGenHLSL/HLSLControlFlowHint.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export int test_flatten(int X){
3232
}
3333

3434
// CHECK: define {{.*}} i32 {{.*}}test_no_attr{{.*}}(i32 {{.*}} [[VALD:%.*]])
35-
// CHECK-NO: !hlsl.controlflow.hint
35+
// CHECK-NOT: !hlsl.controlflow.hint
3636
export int test_no_attr(int X){
3737
int resp;
3838
if (X > 0) {

llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/ADT/Twine.h"
1616
#include "llvm/Analysis/DXILMetadataAnalysis.h"
1717
#include "llvm/Analysis/DXILResource.h"
18+
#include "llvm/IR/BasicBlock.h"
1819
#include "llvm/IR/Constants.h"
1920
#include "llvm/IR/DiagnosticInfo.h"
2021
#include "llvm/IR/DiagnosticPrinter.h"
@@ -299,11 +300,11 @@ static MDTuple *emitTopLevelLibraryNode(Module &M, MDNode *RMD,
299300
// TODO: We might need to refactor this to be more generic,
300301
// in case we need more metadata to be replaced.
301302
static void translateBranchMetadata(Module &M) {
302-
for (auto &F : M) {
303-
for (auto &BB : F) {
304-
auto *BBTerminatorInst = BB.getTerminator();
303+
for (Function &F : M) {
304+
for (BasicBlock &BB : F) {
305+
Instruction *BBTerminatorInst = BB.getTerminator();
305306

306-
auto *HlslControlFlowMD =
307+
MDNode *HlslControlFlowMD =
307308
BBTerminatorInst->getMetadata("hlsl.controlflow.hint");
308309

309310
if (!HlslControlFlowMD)
@@ -313,14 +314,14 @@ static void translateBranchMetadata(Module &M) {
313314
"invalid operands for hlsl.controlflow.hint");
314315

315316
MDBuilder MDHelper(M.getContext());
316-
auto *Op1 =
317+
ConstantInt *Op1 =
317318
mdconst::extract<ConstantInt>(HlslControlFlowMD->getOperand(1));
318319

319320
SmallVector<llvm::Metadata *, 2> Vals(
320321
ArrayRef<Metadata *>{MDHelper.createString("dx.controlflow.hints"),
321322
MDHelper.createConstant(Op1)});
322323

323-
auto *MDNode = llvm::MDNode::get(M.getContext(), Vals);
324+
MDNode *MDNode = llvm::MDNode::get(M.getContext(), Vals);
324325

325326
BBTerminatorInst->setMetadata("dx.controlflow.hints", MDNode);
326327
BBTerminatorInst->setMetadata("hlsl.controlflow.hint", nullptr);

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2800,7 +2800,8 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
28002800
case Intrinsic::spv_selection_merge: {
28012801
auto MIB =
28022802
BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpSelectionMerge));
2803-
assert(I.getOperand(1).isMBB());
2803+
assert(I.getOperand(1).isMBB() &&
2804+
"operand 1 to spv_selection_merge must be a basic block");
28042805
MIB.addMBB(I.getOperand(1).getMBB());
28052806
MIB.addImm(getSelectionOperandForImm(I.getOperand(2).getImm()));
28062807
return MIB.constrainAllUses(TII, TRI, RBI);

0 commit comments

Comments
 (0)