This is an archive of the discontinued LLVM Phabricator instance.

DAGCombiner: Relax alignment restriction when changing load type
ClosedPublic

Authored by arsenm on Feb 16 2016, 3:14 PM.

Details

Summary

If the target allows the alignment, this should still be OK.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 48114.Feb 16 2016, 3:14 PM
arsenm retitled this revision from to DAGCombiner: Relax alignment restriction when changing load type.
arsenm updated this object.
arsenm added a subscriber: llvm-commits.
hfinkel added a subscriber: hfinkel.

I think this looks reasonable.

Elena, does the AVX-512 v*i1 promotion make sense?

delena added inline comments.Mar 30 2016, 6:47 AM
lib/Target/X86/X86ISelLowering.cpp
1356 ↗(On Diff #48114)

I checked now. There is a bug in AVX-512, but let me fix it. I'll do this, probably, in a different way and add tests. It should not take more than one day..
Thank you for pointing on this.

delena added inline comments.Apr 3 2016, 1:49 AM
lib/Target/X86/X86ISelLowering.cpp
1356 ↗(On Diff #48114)

AVX-512 failures are fixed in revision 265259.

I see 3 more x86 failures on trunk with this.

The first looks like this:
IR (from avx512-mask-op.ll):

define void @mask8_mem(i8* %ptr) {
  %x = load i8, i8* %ptr, align 4
  %m0 = bitcast i8 %x to <8 x i1>
  %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
  %ret = bitcast <8 x i1> %m1 to i8
  store i8 %ret, i8* %ptr, align 4
  ret void
}

Before:

_mask8_mem:                             ## @mask8_mem
	.cfi_startproc
## BB#0:
	movb	(%rdi), %al
	kmovw	%eax, %k0
	knotw	%k0, %k0
	kmovw	%k0, %eax
	movb	%al, (%rdi)
	retq

After:

_mask8_mem:                             ## @mask8_mem
	.cfi_startproc
## BB#0:
	movzbw	(%rdi), %ax
	kmovw	%eax, %k0
	knotw	%k0, %k0
	kmovw	%k0, %eax
	movb	%al, (%rdi)
	retq

A second looks similar, and another in merge-consecutive-loads-512.ll has one difference of
vmovdqu32 8(%eax), %zmm0
vs.
vmovdqu64 8(%eax), %zmm0

delena edited edge metadata.Apr 12 2016, 11:25 PM

The both diffs in AVX-512 are ok. You can proceed with them.
I suggest you to upload a new diff. We should not see changes in lib/Target/X86/X86ISelLowering.cpp any more, right?

arsenm updated this revision to Diff 53518.Apr 13 2016, 12:10 AM
arsenm edited edge metadata.

Add test updates

tstellarAMD accepted this revision.Apr 21 2016, 10:20 AM
tstellarAMD edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Apr 21 2016, 10:20 AM
arsenm closed this revision.Apr 22 2016, 1:27 PM

r267209