[PATCH] D21449: Target independent codesize heuristics for Loop Idiom Recognition
Sunita_Marathe via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 17:27:10 PDT 2016
Sunita_Marathe added inline comments.
================
Comment at: test/Transforms/LoopIdiom/lir-heurs-multi-block-loop.ll:14
@@ +13,3 @@
+; CHECK-LABEL: LoopMemset
+; CHECK: memset
+;
----------------
mcrosier wrote:
> I don't understand what this (or the next test) is testing. I believe you need two memsets that can be merged together in both cases to test this properly.
LoopMemset test:
============
void LoopMemset(char (*__restrict D) [2048], unsigned int N)
{
unsigned int i, j;
for (i=0; i<N; ++i) {
memset(D[i], -1, 2048);
if (i>15) GF();
}
}
processLoopMemSet() optimizes the above loop memset to a non-loop memset which acts on the contiguous memory formed by concatenating the memory segments handled by the memset of each iteration.
NestedMemset_LoopMemset test:
=======================
void NestedMemset_LoopMemset(char (*__restrict D) [2046], unsigned int N)
{
unsigned int i, j;
for (i=0; i<N; ++i) {
for (j=0; j<2046; ++j) {
D[i][j] = 0; // NestedMemset becomes LoopMemset
if (j>15) GF();
}
}
}
The LIR optimization for this test case happens in two steps:
- loop memset created when processLoopStridedStore() recognizes the D[I][j] store as a memset idiom.
- non-loop memset created when processLoopMemSet() recognizes the loop memset.
https://reviews.llvm.org/D21449
More information about the llvm-commits
mailing list