Skip to content

Commit 9671d28

Browse files
author
Yonghong Song
committed
Do not do checking for returning undef value
Upstream does not like to check undef value and clang-format will fail due to this. Let us remove checking for returning undef value. A related test is also removed.
1 parent 4e58639 commit 9671d28

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

llvm/lib/Target/BPF/BPFCheckUndefIR.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// Check 'undef' and 'unreachable' IRs and issue proper warnings.
9+
// Check 'unreachable' IRs and issue proper warnings.
1010
//
1111
//===----------------------------------------------------------------------===//
1212

@@ -34,7 +34,6 @@ class BPFCheckUndefIR final : public ModulePass {
3434
private:
3535
void BPFCheckUndefIRImpl(Function &F);
3636
void BPFCheckInst(Function &F, BasicBlock &BB, Instruction &I);
37-
void HandleReturnInsn(Function &F, ReturnInst *I);
3837
void HandleUnreachableInsn(Function &F, BasicBlock &BB, Instruction &I);
3938
};
4039
} // End anonymous namespace
@@ -45,17 +44,6 @@ INITIALIZE_PASS(BPFCheckUndefIR, DEBUG_TYPE, "BPF Check Undef IRs", false,
4544

4645
ModulePass *llvm::createBPFCheckUndefIR() { return new BPFCheckUndefIR(); }
4746

48-
void BPFCheckUndefIR::HandleReturnInsn(Function &F, ReturnInst *I) {
49-
Value *RetValue = I->getReturnValue();
50-
// PoisonValue is a special UndefValue where compiler intentionally to
51-
// poisons a value since it shouldn't be used.
52-
if (!RetValue || isa<PoisonValue>(RetValue) || !isa<UndefValue>(RetValue))
53-
return;
54-
55-
dbgs() << "WARNING: return undefined value in func " << F.getName()
56-
<< ", due to uninitialized variable?\n";
57-
}
58-
5947
void BPFCheckUndefIR::HandleUnreachableInsn(Function &F, BasicBlock &BB,
6048
Instruction &I) {
6149
// LLVM may create a switch statement with default to a 'unreachable' basic
@@ -87,16 +75,8 @@ void BPFCheckUndefIR::HandleUnreachableInsn(Function &F, BasicBlock &BB,
8775

8876
void BPFCheckUndefIR::BPFCheckInst(Function &F, BasicBlock &BB,
8977
Instruction &I) {
90-
switch (I.getOpcode()) {
91-
case Instruction::Ret:
92-
HandleReturnInsn(F, cast<ReturnInst>(&I));
93-
break;
94-
case Instruction::Unreachable:
78+
if (I.getOpcode() == Instruction::Unreachable)
9579
HandleUnreachableInsn(F, BB, I);
96-
break;
97-
default:
98-
break;
99-
}
10080
}
10181

10282
void BPFCheckUndefIR::BPFCheckUndefIRImpl(Function &F) {

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

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

0 commit comments

Comments
 (0)