]> granicus.if.org Git - llvm/commit
[Lint] Avoid failed assertion by fetching the proper pointer type
authorMikael Holmen <mikael.holmen@ericsson.com>
Tue, 3 Oct 2017 06:03:49 +0000 (06:03 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Tue, 3 Oct 2017 06:03:49 +0000 (06:03 +0000)
commit42c9fd02c2e5f782133f6f340344b150b53c927f
treecc021c7be9ce1942a348855dd52711c2035aa1ca
parent42d7f5ca74d809ccda29b4cc22163252a40c4dc0
[Lint] Avoid failed assertion by fetching the proper pointer type

Summary:
When checking if a constant expression is a noop cast we fetched the
IntPtrType by doing DL->getIntPtrType(V->getType())). However, there can
be cases where V doesn't return a pointer, and then getIntPtrType()
triggers an assertion.

Now we pass DataLayout to isNoopCast so the method itself can determine
what the IntPtrType is.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D37894

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314763 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/InstrTypes.h
lib/Analysis/Lint.cpp
lib/IR/Instructions.cpp
test/Analysis/Lint/noop-cast-expr-no-pointer.ll [new file with mode: 0644]