Skip to content

Commit 9dfd82e

Browse files
committed
[X86] Fix typo: QWORD alignment is greater than 4, not 8
Align(8) is QWORD aligned, but this was checking to see f alignment was higher than that, which it is not. Another PR I am working on for optsize depends on this, but because it is an oversight or typo that affects the compiler, I figure I would make this into a separate PR.
1 parent 1b4d4c9 commit 9dfd82e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/X86/X86SelectionDAGInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ SDValue X86SelectionDAGInfo::EmitTargetCodeForMemset(
8888
ValReg = X86::EAX;
8989
Val = (Val << 8) | Val;
9090
Val = (Val << 16) | Val;
91-
if (Subtarget.is64Bit() && Alignment > Align(8)) { // QWORD aligned
91+
if (Subtarget.is64Bit() && Alignment > Align(4)) { // QWORD aligned
9292
AVT = MVT::i64;
9393
ValReg = X86::RAX;
9494
Val = (Val << 32) | Val;

llvm/test/CodeGen/X86/memset-vs-memset-inline.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ define void @inlined_set_doesnt_call_external_function(ptr %a, i8 %value) nounwi
4040
define void @pr87819(ptr align 8 %a) nounwind {
4141
; CHECK-LABEL: pr87819:
4242
; CHECK: # %bb.0:
43-
; CHECK-NEXT: movl $256, %ecx # imm = 0x100
44-
; CHECK-NEXT: movl $707406378, %eax # imm = 0x2A2A2A2A
45-
; CHECK-NEXT: rep;stosl %eax, %es:(%rdi)
43+
; CHECK-NEXT: movabsq $3038287259199220266, %rax # imm = 0x2A2A2A2A2A2A2A2A
44+
; CHECK-NEXT: movl $128, %ecx
45+
; CHECK-NEXT: rep;stosq %rax, %es:(%rdi)
4646
; CHECK-NEXT: retq
4747
tail call void @llvm.memset.inline.p0.i64(ptr align 8 %a, i8 42, i64 1024, i1 0)
4848
ret void

0 commit comments

Comments
 (0)