[PATCH] D121971: [AutoUpgrade] Don't lose attributes when upgrading mem intrinsics
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 17 16:32:58 PDT 2022
arichardson created this revision.
arichardson added reviewers: dneilson, reames.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: All.
arichardson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The original AutoUpgrade code from 1e68724d24ba38de7c7cdb2e1939d78c8b37cc0d
did not retain existing attributes. I noticed this in some downstream test
cases but it turns out there is also one affected testcase upstream.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121971
Files:
llvm/lib/IR/AutoUpgrade.cpp
llvm/test/Transforms/IROutliner/illegal-memset.ll
Index: llvm/test/Transforms/IROutliner/illegal-memset.ll
===================================================================
--- llvm/test/Transforms/IROutliner/illegal-memset.ll
+++ llvm/test/Transforms/IROutliner/illegal-memset.ll
@@ -11,7 +11,7 @@
; CHECK-NEXT: entry:
; CHECK-NEXT: [[POOL:%.*]] = alloca [59 x i64], align 4
; CHECK-NEXT: [[TMP:%.*]] = bitcast [59 x i64]* [[POOL]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP]], i8 0, i64 236, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull align 4 [[TMP]], i8 0, i64 236, i1 false)
; CHECK-NEXT: call void @outlined_ir_func_0(i64 [[N:%.*]], i64 [[X:%.*]], i64 [[Z:%.*]])
; CHECK-NEXT: ret i64 0
;
@@ -30,7 +30,7 @@
; CHECK-NEXT: entry:
; CHECK-NEXT: [[POOL:%.*]] = alloca [59 x i64], align 4
; CHECK-NEXT: [[TMP:%.*]] = bitcast [59 x i64]* [[POOL]] to i8*
-; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[TMP]], i8 0, i64 236, i1 false)
+; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull align 4 [[TMP]], i8 0, i64 236, i1 false)
; CHECK-NEXT: call void @outlined_ir_func_0(i64 [[N:%.*]], i64 [[X:%.*]], i64 [[Z:%.*]])
; CHECK-NEXT: ret i64 0
;
Index: llvm/lib/IR/AutoUpgrade.cpp
===================================================================
--- llvm/lib/IR/AutoUpgrade.cpp
+++ llvm/lib/IR/AutoUpgrade.cpp
@@ -4051,6 +4051,7 @@
Value *Args[4] = {CI->getArgOperand(0), CI->getArgOperand(1),
CI->getArgOperand(2), CI->getArgOperand(4)};
NewCall = Builder.CreateCall(NewFn, Args);
+ NewCall->setAttributes(CI->getAttributes());
auto *MemCI = cast<MemIntrinsic>(NewCall);
// All mem intrinsics support dest alignment.
const ConstantInt *Align = cast<ConstantInt>(CI->getArgOperand(3));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121971.416355.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/c7ec2560/attachment.bin>
More information about the llvm-commits
mailing list