Extract the load/store type verification to a separate function.
authorFilipe Cabecinhas <me@filcab.net>
Mon, 18 May 2015 21:48:55 +0000 (21:48 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Mon, 18 May 2015 21:48:55 +0000 (21:48 +0000)
commit70a2c7260a80c483ce8877630653132b1ff265cf
tree2e919dd793a535832836c25f762c867b4d6151ba
parent05ef67b6b9f1efe216cb4c1bbe0e75b178b5fba2
Extract the load/store type verification to a separate function.

Summary:
Added isLoadableOrStorableType to PointerType.

We were doing some checks in some places, occasionally assert()ing instead
of telling the caller. With this patch, I'm putting all type checking in
the same place for load/store type instructions, and verifying the same
thing every time.

I also added a check for load/store of a function type.

Applied extracted check to Load, Store, and Cmpxcg.

I don't have exhaustive tests for all of these, but all Error() calls in
TypeCheckLoadStoreInst are being tested (in invalid.test).

Reviewers: dblaikie, rafael

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9785

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237619 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/DerivedTypes.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/IR/Type.cpp
test/Bitcode/Inputs/invalid-load-ptr-type.bc [new file with mode: 0644]
test/Bitcode/invalid.test