Skip to content

Commit 437a5ec

Browse files
author
Yonghong Song
committed
Remove undef-sccp.ll and use DiagnosticInfo for warning
The test undef-sccp.ll still uses 'undef' in the IR and clang-format complains it. In this particular case, 'undef' is generated in sroa and it needs a lot of other passes to reach sccp. So let us remove this test. The test itself can be accessed in https://gist.github.com/yonghong-song/11be8603ad9422f418f60b41beded047 which can be tested in llvm/test/CodeGen/BPF directory. DiagnosticInfo() is the recommended interface for warnings comparing to dbgs().
1 parent 5473901 commit 437a5ec

File tree

2 files changed

+6
-174
lines changed

2 files changed

+6
-174
lines changed

llvm/lib/Target/BPF/BPFCheckUndefIR.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "BPF.h"
1414
#include "llvm/IR/Constants.h"
15+
#include "llvm/IR/DiagnosticInfo.h"
1516
#include "llvm/IR/Instruction.h"
1617
#include "llvm/IR/Module.h"
1718
#include "llvm/IR/Type.h"
@@ -69,8 +70,11 @@ void BPFCheckUndefIR::HandleUnreachableInsn(Function &F, BasicBlock &BB,
6970
return;
7071
}
7172

72-
dbgs() << "WARNING: unreachable in func " << F.getName()
73-
<< ", due to uninitialized variable?\n";
73+
F.getContext().diagnose(
74+
DiagnosticInfoGeneric(Twine("unreachable in func ")
75+
.concat(F.getName())
76+
.concat(", due to uninitialized variable?"),
77+
DS_Warning));
7478
}
7579

7680
void BPFCheckUndefIR::BPFCheckInst(Function &F, BasicBlock &BB,

llvm/test/CodeGen/BPF/undef-sccp.ll

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)