Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,8 +1169,8 @@ int ARMTTIImpl::getNumMemOps(const IntrinsicInst *I) const {
return -1;

const unsigned Size = C->getValue().getZExtValue();
const Align DstAlign = *MC->getDestAlign();
const Align SrcAlign = *MC->getSourceAlign();
const Align DstAlign = MC->getDestAlign().valueOrOne();
const Align SrcAlign = MC->getSourceAlign().valueOrOne();

MOp = MemOp::Copy(Size, /*DstAlignCanChange*/ false, DstAlign, SrcAlign,
/*IsVolatile*/ false);
Expand All @@ -1184,7 +1184,7 @@ int ARMTTIImpl::getNumMemOps(const IntrinsicInst *I) const {
return -1;

const unsigned Size = C->getValue().getZExtValue();
const Align DstAlign = *MS->getDestAlign();
const Align DstAlign = MS->getDestAlign().valueOrOne();

MOp = MemOp::Set(Size, /*DstAlignCanChange*/ false, DstAlign,
/*IsZeroMemset*/ false, /*IsVolatile*/ false);
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/Analysis/CostModel/ARM/memcpy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ target triple = "thumbv7m-arm-unknown-eabi"
; Align 1, 1
;;;;;;;;;;;;

define void @memcpy_0(ptr %d, ptr %s) {
;
; with/without strict-align:
;
; ldrb r1, [r1]
; strb r1, [r0]
;
; COMMON-LABEL: 'memcpy_0'
; COMMON-NEXT: Cost Model: Found an estimated cost of 2 for instruction: call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false)
; COMMON-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
;
entry:
call void @llvm.memcpy.p0.p0.i32(ptr %d, ptr %s, i32 1, i1 false)
ret void
}

define void @memcpy_1(ptr %d, ptr %s) {
;
; with/without strict-align:
Expand Down