[PATCH] Teach BaseIndexOffset::match to identify base pointers in loops

Juergen Ributzka juergen at apple.com
Wed Aug 21 14:44:38 PDT 2013


Hi @ll,

the small utility function that pattern matches Base + Index + Offset patterns for loads and stores fails to recognize the base pointer for loads/stores from/into an array at offset 0 inside a loop. As a result DAGCombiner::MergeConsecutiveStores was not able to merge all stores.

Example:
for(int i=0; i <N; i+=4) {
	a[i+0] = 1;
	a[i+1] = 1;
	a[i+2] = 1;
	a[i+3] = 1;
}

In this example BaseIndexOffset::match would identify a different base pointer for a[i+0] then for all the others.

This small patch adds an additional pattern match to recognize this special case and a test case.

Cheers,
Juergen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mergestore.diff
Type: application/octet-stream
Size: 2849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130821/46f53743/attachment.obj>


More information about the llvm-commits mailing list