[APInt] Give the value union a name so we can remove assumptions on VAL being the...
authorCraig Topper <craig.topper@gmail.com>
Wed, 3 May 2017 15:46:24 +0000 (15:46 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 3 May 2017 15:46:24 +0000 (15:46 +0000)
commitb339c6dcc07bbd3c60bb42f05566323b973107d9
tree2713a5a4b5d2db206e8cb74276913c549d5e41ff
parent8df55b43e1a5f7acc9815b689940c6ac0de251ca
[APInt] Give the value union a name so we can remove assumptions on VAL being the larger member

Currently several places assume the VAL member is always at least the same size as pVal. In particular for a memcpy in the move assignment operator. While this is a true assumption, it isn't good practice to assume this.

This patch gives the union a name so we can write the memcpy in terms of the union itself. This also adds a similar memcpy to the move constructor where we previously just copied using VAL directly.

This patch is mostly just a mechanical addition of the U in front of VAL and pVAL everywhere. But several constructors had to be modified since we can't directly initializer a field of named union from the initializer list.

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

llvm-svn: 302040
llvm/include/llvm/ADT/APInt.h
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/Support/APInt.cpp