OSDN Git Service

Fix always creating GEP with i32 indices
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 14 Aug 2013 00:24:38 +0000 (00:24 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 14 Aug 2013 00:24:38 +0000 (00:24 +0000)
commitfdc2660214265e8c32b9536a18ff983f035aaf02
tree5f01fb3f987dbfa432d73a1ec25bb29a88f3284f
parent3ea117e1bca290c4043ca38d25f278275e5853cb
Fix always creating GEP with i32 indices

Use the pointer size if datalayout is available.
Use i64 if it's not, which is consistent with what other
places do when the pointer size is unknown.

The test doesn't really test this in a useful way
since it will be transformed to that later anyway,
but this now tests it for non-zero arrays and when
datalayout isn't available. The cases in
visitGetElementPtrInst should save an extra re-visit to
the newly created GEP since it won't need to cleanup after
itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188339 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/alloca.ll