[llvm] 86dea5a - [SanitizerCoverage] Avoid use of ConstantExpr::getCast() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 02:17:37 PDT 2023
Author: Nikita Popov
Date: 2023-09-29T11:14:06+02:00
New Revision: 86dea5aab835f37b6e7c3b5a477c8a00881be62f
URL: https://github.com/llvm/llvm-project/commit/86dea5aab835f37b6e7c3b5a477c8a00881be62f
DIFF: https://github.com/llvm/llvm-project/commit/86dea5aab835f37b6e7c3b5a477c8a00881be62f.diff
LOG: [SanitizerCoverage] Avoid use of ConstantExpr::getCast() (NFC)
Work on APInt instead.
Added:
Modified:
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index 605bc6afa3cec0d..c2c6245d1851f5e 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -823,10 +823,9 @@ void ModuleSanitizerCoverage::InjectTraceForSwitch(
Int64Ty->getScalarSizeInBits())
Cond = IRB.CreateIntCast(Cond, Int64Ty, false);
for (auto It : SI->cases()) {
- Constant *C = It.getCaseValue();
- if (C->getType()->getScalarSizeInBits() <
- Int64Ty->getScalarSizeInBits())
- C = ConstantExpr::getCast(CastInst::ZExt, It.getCaseValue(), Int64Ty);
+ ConstantInt *C = It.getCaseValue();
+ if (C->getType()->getScalarSizeInBits() < 64)
+ C = ConstantInt::get(C->getContext(), C->getValue().zext(64));
Initializers.push_back(C);
}
llvm::sort(drop_begin(Initializers, 2),
More information about the llvm-commits
mailing list