]> granicus.if.org Git - llvm/commit
[ConstantFolding] Use FoldBitCast correctly
authorKeno Fischer <keno@alumni.harvard.edu>
Thu, 26 Sep 2019 02:07:51 +0000 (02:07 +0000)
committerKeno Fischer <keno@alumni.harvard.edu>
Thu, 26 Sep 2019 02:07:51 +0000 (02:07 +0000)
commitf005ce18dd6d3d2444fc366c2e57dede49de9bd7
treef079604c432c2bb7846f76bdccae8c5f33b7630f
parent206c4da0c1c03e2b26a8e398452cc4b1c67ffafe
[ConstantFolding] Use FoldBitCast correctly

Previously we might attempt to use a BitCast to turn bits into vectors of pointers,
but that requires an inttoptr cast to be legal. Add an assertion to detect the formation of illegal bitcast attempts
early (in the tests, we often constant-fold away the result before getting to this assertion check),
while being careful to still handle the early-return conditions without adding extra complexity in the result.

Patch by Jameson Nash <jameson@juliacomputing.com>.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372940 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp