Skip to content

Commit 86dea5a

Browse files
committed
[SanitizerCoverage] Avoid use of ConstantExpr::getCast() (NFC)
Work on APInt instead.
1 parent 5cacf4e commit 86dea5a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,9 @@ void ModuleSanitizerCoverage::InjectTraceForSwitch(
823823
Int64Ty->getScalarSizeInBits())
824824
Cond = IRB.CreateIntCast(Cond, Int64Ty, false);
825825
for (auto It : SI->cases()) {
826-
Constant *C = It.getCaseValue();
827-
if (C->getType()->getScalarSizeInBits() <
828-
Int64Ty->getScalarSizeInBits())
829-
C = ConstantExpr::getCast(CastInst::ZExt, It.getCaseValue(), Int64Ty);
826+
ConstantInt *C = It.getCaseValue();
827+
if (C->getType()->getScalarSizeInBits() < 64)
828+
C = ConstantInt::get(C->getContext(), C->getValue().zext(64));
830829
Initializers.push_back(C);
831830
}
832831
llvm::sort(drop_begin(Initializers, 2),

0 commit comments

Comments
 (0)