Skip to content

Commit f3fa7aa

Browse files
committed
review: only validate loop metadata on a branch inst
1 parent 45abd19 commit f3fa7aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Target/DirectX/DXILValidateMetadata.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/IR/Constants.h"
1818
#include "llvm/IR/DiagnosticInfo.h"
1919
#include "llvm/IR/DiagnosticPrinter.h"
20+
#include "llvm/IR/Instructions.h"
2021
#include "llvm/IR/LLVMContext.h"
2122
#include "llvm/IR/Metadata.h"
2223
#include "llvm/IR/Module.h"
@@ -142,8 +143,9 @@ static void validateInstructionMetadata(Module &M) {
142143
for (Function &F : M)
143144
for (BasicBlock &BB : F)
144145
for (Instruction &I : BB) {
145-
if (MDNode *LoopMD = I.getMetadata(MDLoopKind))
146-
validateLoopMetadata(M, LoopMD);
146+
if (isa<BranchInst>(I))
147+
if (MDNode *LoopMD = I.getMetadata(MDLoopKind))
148+
validateLoopMetadata(M, LoopMD);
147149
}
148150
}
149151

0 commit comments

Comments
 (0)