Skip to content

Commit

Permalink
Remove undef-sccp.ll and use DiagnosticInfo for warning
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
Yonghong Song committed Feb 21, 2025
1 parent a5811fb commit fcbcd8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 174 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Target/BPF/BPFCheckUndefIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "BPF.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
Expand Down Expand Up @@ -69,8 +70,11 @@ void BPFCheckUndefIR::HandleUnreachableInsn(Function &F, BasicBlock &BB,
return;
}

dbgs() << "WARNING: unreachable in func " << F.getName()
<< ", due to uninitialized variable?\n";
F.getContext().diagnose(
DiagnosticInfoGeneric(Twine("unreachable in func ")
.concat(F.getName())
.concat(", due to uninitialized variable?"),
DS_Warning));
}

void BPFCheckUndefIR::BPFCheckInst(Function &F, BasicBlock &BB,
Expand Down
172 changes: 0 additions & 172 deletions llvm/test/CodeGen/BPF/undef-sccp.ll

This file was deleted.

0 comments on commit fcbcd8e

Please sign in to comment.