Skip to content

Commit 5b239db

Browse files
committed
[AutoUpgrade] Add Default Case to Avoid Path to Assertion (NFCI)
We have been running Polyspace on the LLVM codebase and the following path to assertion was flagged. 1 - Assignment to local pointer 'NewCall' - AutoUpgrade.cpp[4443, 13] 2 - Entering switch case - AutoUpgrade.cpp[4516, 3] 3 - Not entering if statement (if-condition false) - AutoUpgrade.cpp[4519, 5] 4 - Not entering if statement (if-condition false) - AutoUpgrade.cpp[4523, 5] 5 - Not entering if statement (if-condition false) - AutoUpgrade.cpp[4548, 12] 6 - Assertion - AutoUpgrade.cpp[4896, 3] This updated adds a Default Case to avoid the path and removes an unnecessary else after return.
1 parent bcf0f8d commit 5b239db

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4545,6 +4545,9 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
45454545
Ret = Builder.CreateInsertVector(RetTy, Ret, V, Idx);
45464546
}
45474547
NewCall = dyn_cast<CallInst>(Ret);
4548+
} else {
4549+
DefaultCase();
4550+
return;
45484551
}
45494552
break;
45504553
}
@@ -5015,11 +5018,9 @@ bool llvm::UpgradeDebugInfo(Module &M) {
50155018
if (!BrokenDebugInfo)
50165019
// Everything is ok.
50175020
return false;
5018-
else {
5019-
// Diagnose malformed debug info.
5020-
DiagnosticInfoIgnoringInvalidDebugMetadata Diag(M);
5021-
M.getContext().diagnose(Diag);
5022-
}
5021+
// Diagnose malformed debug info.
5022+
DiagnosticInfoIgnoringInvalidDebugMetadata Diag(M);
5023+
M.getContext().diagnose(Diag);
50235024
}
50245025
bool Modified = StripDebugInfo(M);
50255026
if (Modified && Version != DEBUG_METADATA_VERSION) {

0 commit comments

Comments
 (0)