This is an archive of the discontinued LLVM Phabricator instance.

[MSan][MIPS] VarArgHelper for MIPS64
ClosedPublic

Authored by mohit.bhakkad on Jan 26 2015, 10:58 AM.

Diff Detail

Event Timeline

mohit.bhakkad retitled this revision from to [MSan][MIPS] VarArgHelper for MIPS64.
mohit.bhakkad updated this object.
mohit.bhakkad edited the test plan for this revision. (Show Details)
mohit.bhakkad added reviewers: eugenis, kcc, samsonov, petarj.
mohit.bhakkad set the repository for this revision to rL LLVM.
mohit.bhakkad added subscribers: dsanders, slthakur.
mohit.bhakkad added a subscriber: Unknown Object (MLST).
eugenis accepted this revision.Jan 30 2015, 2:42 PM
eugenis edited edge metadata.

LGTM w/ inline comments

lib/Transforms/Instrumentation/MemorySanitizer.cpp
434

Please reuse VAArgSizeTLS instead of creating a new member variable, with a comment somewhere in VarArgHelper that it is used to pass the full argument size (effectively, all arguments on MIPS64 go to the overflow area in terms of X86_64).

It's confusing, unless you want to rename __msan_va_arg_overflow_size_tls as well.

2983

Above, we use the following to check for MIPS64:

case Triple::mips64:
case Triple::mips64el:

Do you need to check for Triple::mips64 here as well?

This revision is now accepted and ready to land.Jan 30 2015, 2:42 PM
mohit.bhakkad edited edge metadata.

Changes in this revision:

  • removed VAArgSizeTLS
  • adding support for mips64 EB (big endian)

@eugenis any comment/suggestion on this? This will provide provide msan for VarArgs on mips64/mips64el.

Sorry for the delay, I've been travelling for the last 2 weeks.

lib/Transforms/Instrumentation/MemorySanitizer.cpp
2888

Should it be += (8 - ArgSize) ?
I assume each argument is extended to 8 bytes.

mohit.bhakkad added inline comments.Feb 12 2015, 4:23 AM
lib/Transforms/Instrumentation/MemorySanitizer.cpp
2888

For variable args, types char and short int are automatically promoted to int, so anything less than size 8 is of size 4.
So += (8 - ArgSize) and += ArgSize should work same.

eugenis added inline comments.Feb 16 2015, 12:11 AM
lib/Transforms/Instrumentation/MemorySanitizer.cpp
2888

If you want to rely on that, then please add a CHECK that ArgSize == 4.

Changes in this revision:

  • as per @eugenis suggestion changed += ArgSize to += (8 - ArgSize)
mohit.bhakkad added inline comments.Feb 17 2015, 12:32 AM
lib/Transforms/Instrumentation/MemorySanitizer.cpp
2888

Going ahead with += (8 - ArgSize) in next revision, as it matches the context, and I don't want another CHECK.

Looks good.

lib/Transforms/Instrumentation/MemorySanitizer.cpp
2888

Yes, I think it's less confusing.

This revision was automatically updated to reflect the committed changes.