[PATCH] D19989: [MSan] [MIPS64] Fix vararg helper for >1 fixed argument.
Marcin KoĆcielnicki via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 13:19:21 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268673: [MSan] [MIPS64] Fix vararg helper for >1 fixed argument. (authored by koriakin).
Changed prior to commit:
http://reviews.llvm.org/D19989?vs=56321&id=56335#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19989
Files:
llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
Index: llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
===================================================================
--- llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
+++ llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
@@ -40,3 +40,15 @@
; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 8) to i64*), align 8
; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 16) to i64*), align 8
; CHECK: store {{.*}} 24, {{.*}} @__msan_va_arg_overflow_size_tls
+
+; Check multiple fixed arguments.
+declare i32 @foo2(i32 %g1, i32 %g2, ...)
+define i32 @bar2() {
+ %1 = call i32 (i32, i32, ...) @foo2(i32 0, i32 1, i64 2, double 3.000000e+00)
+ ret i32 %1
+}
+
+; CHECK-LABEL: @bar2
+; CHECK: store i64 0, i64* getelementptr inbounds ([100 x i64], [100 x i64]* @__msan_va_arg_tls, i32 0, i32 0), align 8
+; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 8) to i64*), align 8
+; CHECK: store {{.*}} 16, {{.*}} @__msan_va_arg_overflow_size_tls
Index: llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
===================================================================
--- llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
+++ llvm/trunk/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
@@ -41,3 +41,15 @@
; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 8) to i64*), align 8
; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 16) to i64*), align 8
; CHECK: store {{.*}} 24, {{.*}} @__msan_va_arg_overflow_size_tls
+
+; Check multiple fixed arguments.
+declare i32 @foo2(i32 %g1, i32 %g2, ...)
+define i32 @bar2() {
+ %1 = call i32 (i32, i32, ...) @foo2(i32 0, i32 1, i64 2, double 3.000000e+00)
+ ret i32 %1
+}
+
+; CHECK-LABEL: @bar2
+; CHECK: store i64 0, i64* getelementptr inbounds ([100 x i64], [100 x i64]* @__msan_va_arg_tls, i32 0, i32 0), align 8
+; CHECK: store i64 0, i64* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__msan_va_arg_tls to i64), i64 8) to i64*), align 8
+; CHECK: store {{.*}} 16, {{.*}} @__msan_va_arg_overflow_size_tls
Index: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -3032,7 +3032,8 @@
void visitCallSite(CallSite &CS, IRBuilder<> &IRB) override {
unsigned VAArgOffset = 0;
const DataLayout &DL = F.getParent()->getDataLayout();
- for (CallSite::arg_iterator ArgIt = CS.arg_begin() + 1, End = CS.arg_end();
+ for (CallSite::arg_iterator ArgIt = CS.arg_begin() +
+ CS.getFunctionType()->getNumParams(), End = CS.arg_end();
ArgIt != End; ++ArgIt) {
llvm::Triple TargetTriple(F.getParent()->getTargetTriple());
Value *A = *ArgIt;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19989.56335.patch
Type: text/x-patch
Size: 3133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160505/26a0f91f/attachment.bin>
More information about the llvm-commits
mailing list