Fix assert when inlining a constantexpr addrspacecast
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 27 Jul 2015 18:31:03 +0000 (18:31 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 27 Jul 2015 18:31:03 +0000 (18:31 +0000)
commitfd8928ded9fa74d7127d4277440d5928145ebc7e
tree223c8d7fb6ed815bd267f92f51a4f86e130226e7
parent55557ce3f8379ffcd8100015ada0a84334fbb196
Fix assert when inlining a constantexpr addrspacecast

The pointer size of the addrspacecasted pointer might not have matched,
so this would have hit an assert in accumulateConstantOffset.

I think this was here to allow constant folding of a load of an
addrspacecasted constant. Accumulating the offset through the
addrspacecast doesn't make much sense, so something else is necessary
to allow folding the load through this cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243300 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
test/Transforms/ConstProp/loads.ll
test/Transforms/Inline/inline-constexpr-addrspacecast-argument.ll [new file with mode: 0644]