Canonicalize addrspacecast ConstExpr between different pointer types
authorJingyue Wu <jingyue@google.com>
Sun, 15 Jun 2014 21:40:57 +0000 (21:40 +0000)
committerJingyue Wu <jingyue@google.com>
Sun, 15 Jun 2014 21:40:57 +0000 (21:40 +0000)
commitbaabe5091c63748d99bf59a1807c2879881b4af2
tree9c0e06e35d1cd712ff02bde70a2d8a689c52bd2f
parent2a60de548aa83df8a33b8fdee02be2a6ab077337
Canonicalize addrspacecast ConstExpr between different pointer types

As a follow-up to r210375 which canonicalizes addrspacecast
instructions, this patch canonicalizes addrspacecast constant
expressions.

Given clang uses ConstantExpr::getAddrSpaceCast to emit addrspacecast
cosntant expressions, this patch is also a step towards having the
frontend emit canonicalized addrspacecasts.

Piggyback a minor refactor in InstCombineCasts.cpp

Update three affected tests in addrspacecast-alias.ll,
access-non-generic.ll and constant-fold-gep.ll and added one new test in
constant-fold-address-space-pointer.ll

llvm-svn: 211004
llvm/lib/IR/ConstantFold.cpp
llvm/lib/IR/Constants.cpp
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Assembler/addrspacecast-alias.ll
llvm/test/CodeGen/NVPTX/access-non-generic.ll
llvm/test/Other/constant-fold-gep.ll
llvm/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll