[InstSimplify] Support constant folding to vector of pointers
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 22 Oct 2014 12:18:48 +0000 (12:18 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 22 Oct 2014 12:18:48 +0000 (12:18 +0000)
commitc29520c5b3a1548653f567157552572cda55f190
tree48bba184714bea5dd2dc552f8da2a46d9ec139b9
parent3b68607eacfb099d3e06f8781dc66fb65a5ad3a8
[InstSimplify] Support constant folding to vector of pointers

ConstantFolding crashes when trying to InstSimplify the following load:

@a = private unnamed_addr constant %mst {
     i8* inttoptr (i64 -1 to i8*),
     i8* inttoptr (i64 -1 to i8*)
}, align 8

%x = load <2 x i8*>* bitcast (%mst* @a to <2 x i8*>*), align 8

This patch fix this by adding support to this type of folding:

%x = load <2 x i8*>* bitcast (%mst* @a to <2 x i8*>*), align 8
==> gets folded to:
  %x = <2 x i8*> <i8* inttoptr (i64 -1 to i8*), i8* inttoptr (i64 -1 to i8*)>

llvm-svn: 220380
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Transforms/InstSimplify/vector_ptr_bitcast.ll [new file with mode: 0644]