[PATCH] [InstCombine] Canonicalize addrspacecast between different element types
Jingyue Wu
jingyue at google.com
Tue Jun 3 17:52:50 PDT 2014
Hi arsenm, eliben, meheff,
addrspacecast X addrspace(M)* to Y addrspace(N)*
-->
bitcast X addrspace(M)* to Y addrspace(M)*
addrspacecast Y addrspace(M)* to Y addrspace(N)*
This canonicalization makes NVPTXFavorNonGenericAddrSpaces more effective, and can potentially benefit many other cases.
This patch is based on D2186 with fixes and more tests:
* Fix an issue in D2186 that causes InstCombine to run into infinite loops
* Add the failed test as @canonicalize_addrspacecast in test/Transforms/InstCombine/addrspacecast.ll
* Do bitcast before addrspacecast because addrspacecasts from non-generic to generic can be folded into load/store
* Updated all affected tests. One affected test (@test2_addrspacecast) in memcpy-from-global.ll is actually better optimized because of this canonicalization. See how alloca %T being transformed to alloca [128 x i8]
http://reviews.llvm.org/D4013
Files:
lib/IR/Instructions.cpp
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/addrspacecast.ll
test/Transforms/InstCombine/getelementptr.ll
test/Transforms/InstCombine/memcpy-from-global.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4013.10073.patch
Type: text/x-patch
Size: 10198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140604/a50df5cc/attachment.bin>
More information about the llvm-commits
mailing list