Skip to content

Commit 17b9a91

Browse files
committed
[InstCombine] canRewriteGEPAsOffset - don't dereference a dyn_cast<>. NFCI.
We know V is a IntToPtrInst or PtrToIntInst type so we know its a CastInst - so use cast<> directly. Prevents clang static analyzer warning that we could deference a null pointer.
1 parent 75d33a3 commit 17b9a91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ static bool canRewriteGEPAsOffset(Value *Start, Value *Base,
552552
return false;
553553

554554
if (isa<IntToPtrInst>(V) || isa<PtrToIntInst>(V)) {
555-
auto *CI = dyn_cast<CastInst>(V);
555+
auto *CI = cast<CastInst>(V);
556556
if (!CI->isNoopCast(DL))
557557
return false;
558558

0 commit comments

Comments
 (0)