[llvm] f2a6a97 - Fix MSVC "ignoring return value of function declared with 'nodiscard' attribute" warning. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 03:40:57 PDT 2023
Author: Simon Pilgrim
Date: 2023-05-23T11:40:33+01:00
New Revision: f2a6a9706925a64386a0833f9ff2a03017a90bb5
URL: https://github.com/llvm/llvm-project/commit/f2a6a9706925a64386a0833f9ff2a03017a90bb5
DIFF: https://github.com/llvm/llvm-project/commit/f2a6a9706925a64386a0833f9ff2a03017a90bb5.diff
LOG: Fix MSVC "ignoring return value of function declared with 'nodiscard' attribute" warning. NFC.
Added:
Modified:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 0c481b4367c4..ddfc9d037ddc 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6505,8 +6505,10 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
// If the default is unreachable, all case values are s>= MinCaseVal. Then
// we can try to attach nsw.
bool MayWrap = true;
- if (!DefaultIsReachable)
- MaxCaseVal->getValue().ssub_ov(MinCaseVal->getValue(), MayWrap);
+ if (!DefaultIsReachable) {
+ APInt Res = MaxCaseVal->getValue().ssub_ov(MinCaseVal->getValue(), MayWrap);
+ (void)Res;
+ }
TableIndex = Builder.CreateSub(SI->getCondition(), TableIndexOffset,
"switch.tableidx", /*HasNUW =*/false,
More information about the llvm-commits
mailing list