[PATCH] D73791: Fix broken invariant
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 09:40:24 PST 2020
gchatelet updated this revision to Diff 241756.
gchatelet added a comment.
- Added asserts
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73791/new/
https://reviews.llvm.org/D73791
Files:
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/AArch64/memcpy-f128.ll
Index: llvm/test/CodeGen/AArch64/memcpy-f128.ll
===================================================================
--- llvm/test/CodeGen/AArch64/memcpy-f128.ll
+++ llvm/test/CodeGen/AArch64/memcpy-f128.ll
@@ -7,9 +7,6 @@
define void @test1() {
; CHECK-LABEL: @test1
-; CHECK: adrp
-; CHECK: ldr q0
-; CHECK: str q0
; CHECK: ret
entry:
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 undef, i8* align 8 bitcast (%structA* @stubA to i8*), i64 48, i1 false)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5908,12 +5908,14 @@
bool CopyFromConstant = isMemSrcFromConstant(Src, Slice);
bool isZeroConstant = CopyFromConstant && Slice.Array == nullptr;
unsigned Limit = AlwaysInline ? ~0U : TLI.getMaxStoresPerMemcpy(OptSize);
+ const MemOp Op = isZeroConstant
+ ? MemOp::Set(Size, DstAlignCanChange, Alignment,
+ /*IsZeroMemset*/ true, isVol)
+ : MemOp::Copy(Size, DstAlignCanChange, Alignment,
+ SrcAlign, isVol, CopyFromConstant);
if (!TLI.findOptimalMemOpLowering(
- MemOps, Limit,
- MemOp::Copy(Size, DstAlignCanChange, Alignment,
- isZeroConstant ? 0 : SrcAlign, isVol, CopyFromConstant),
- DstPtrInfo.getAddrSpace(), SrcPtrInfo.getAddrSpace(),
- MF.getFunction().getAttributes()))
+ MemOps, Limit, Op, DstPtrInfo.getAddrSpace(),
+ SrcPtrInfo.getAddrSpace(), MF.getFunction().getAttributes()))
return SDValue();
if (DstAlignCanChange) {
Index: llvm/include/llvm/CodeGen/TargetLowering.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetLowering.h
+++ llvm/include/llvm/CodeGen/TargetLowering.h
@@ -125,6 +125,8 @@
static MemOp Copy(uint64_t Size, bool DstAlignCanChange, unsigned DstAlign,
unsigned SrcAlign, bool IsVolatile,
bool MemcpyStrSrc = false) {
+ assert(DstAlign && "Alignment should be set");
+ assert(SrcAlign && "Alignment should be set");
return {
/*.Size =*/Size,
/*.DstAlign =*/DstAlignCanChange ? 0 : DstAlign,
@@ -137,6 +139,7 @@
}
static MemOp Set(uint64_t Size, bool DstAlignCanChange, unsigned DstAlign,
bool IsZeroMemset, bool IsVolatile) {
+ assert(DstAlign && "Alignment should be set");
return {
/*.Size =*/Size,
/*.DstAlign =*/DstAlignCanChange ? 0 : DstAlign,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73791.241756.patch
Type: text/x-patch
Size: 2677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200131/803680d2/attachment.bin>
More information about the llvm-commits
mailing list