llvm.org GIT mirror llvm / c16ab2d
[MSan] [MIPS64] Fix vararg helper for >1 fixed argument. This fixes http://llvm.org/PR27646 on Mips64. Differential Revision: http://reviews.llvm.org/D19989 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268673 91177308-0d34-0410-b5e6-96231b3b80d8 Marcin Koscielnicki 3 years ago
3 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
30313031 void visitCallSite(CallSite &CS, IRBuilder<> &IRB) override {
30323032 unsigned VAArgOffset = 0;
30333033 const DataLayout &DL = F.getParent()->getDataLayout();
3034 for (CallSite::arg_iterator ArgIt = CS.arg_begin() + 1, End = CS.arg_end();
3034 for (CallSite::arg_iterator ArgIt = CS.arg_begin() +
3035 CS.getFunctionType()->getNumParams(), End = CS.arg_end();
30353036 ArgIt != End; ++ArgIt) {
30363037 llvm::Triple TargetTriple(F.getParent()->getTargetTriple());
30373038 Value *A = *ArgIt;
4040 ; 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
4141 ; 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
4242 ; CHECK: store {{.*}} 24, {{.*}} @__msan_va_arg_overflow_size_tls
43
44 ; Check multiple fixed arguments.
45 declare i32 @foo2(i32 %g1, i32 %g2, ...)
46 define i32 @bar2() {
47 %1 = call i32 (i32, i32, ...) @foo2(i32 0, i32 1, i64 2, double 3.000000e+00)
48 ret i32 %1
49 }
50
51 ; CHECK-LABEL: @bar2
52 ; CHECK: store i64 0, i64* getelementptr inbounds ([100 x i64], [100 x i64]* @__msan_va_arg_tls, i32 0, i32 0), align 8
53 ; 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
54 ; CHECK: store {{.*}} 16, {{.*}} @__msan_va_arg_overflow_size_tls
3939 ; 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
4040 ; 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
4141 ; CHECK: store {{.*}} 24, {{.*}} @__msan_va_arg_overflow_size_tls
42
43 ; Check multiple fixed arguments.
44 declare i32 @foo2(i32 %g1, i32 %g2, ...)
45 define i32 @bar2() {
46 %1 = call i32 (i32, i32, ...) @foo2(i32 0, i32 1, i64 2, double 3.000000e+00)
47 ret i32 %1
48 }
49
50 ; CHECK-LABEL: @bar2
51 ; CHECK: store i64 0, i64* getelementptr inbounds ([100 x i64], [100 x i64]* @__msan_va_arg_tls, i32 0, i32 0), align 8
52 ; 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
53 ; CHECK: store {{.*}} 16, {{.*}} @__msan_va_arg_overflow_size_tls