[PATCH] [msan] Poison the entire stack frame with one memset

Evgeniy Stepanov eugenis at google.com
Tue Feb 17 02:41:05 PST 2015


Benchmarks show marginal perf and code size improvement  (~2% on a few benchmarks, nothing on most).
And a significant increase in stack frame size. Must have something to do with stack reuse (did not know llvm does that).

Ex., current instrumentation poisons the same stack location several times in a row. I guess it is being reused for multiple local variable.

  28e3f8:       49 bd f8 ff ff ff ff    movabs $0xffffbffffffffff8,%r13
  28e445:       4c 21 eb                and    %r13,%rbx
  28e490:       48 c7 43 18 ff ff ff    movq   $0xffffffffffffffff,0x18(%rbx)
  28e497:       ff
  28e498:       48 c7 43 10 ff ff ff    movq   $0xffffffffffffffff,0x10(%rbx)
  28e49f:       ff
  28e4a0:       48 c7 43 08 ff ff ff    movq   $0xffffffffffffffff,0x8(%rbx)
  28e4a7:       ff
  28e4a8:       48 c7 03 ff ff ff ff    movq   $0xffffffffffffffff,(%rbx)
  28e4af:       48 c7 43 18 ff ff ff    movq   $0xffffffffffffffff,0x18(%rbx)
  28e4b6:       ff
  28e4b7:       48 c7 43 10 ff ff ff    movq   $0xffffffffffffffff,0x10(%rbx)
  28e4be:       ff
  28e4bf:       48 c7 43 08 ff ff ff    movq   $0xffffffffffffffff,0x8(%rbx)
  28e4c6:       ff
  28e4c7:       48 c7 03 ff ff ff ff    movq   $0xffffffffffffffff,(%rbx)
  28e4ce:       48 c7 43 18 ff ff ff    movq   $0xffffffffffffffff,0x18(%rbx)
  28e4d5:       ff
  28e4d6:       48 c7 43 10 ff ff ff    movq   $0xffffffffffffffff,0x10(%rbx)
  28e4dd:       ff
  28e4de:       48 c7 43 08 ff ff ff    movq   $0xffffffffffffffff,0x8(%rbx)
  28e4e5:       ff
  28e4e6:       48 c7 03 ff ff ff ff    movq   $0xffffffffffffffff,(%rbx)

This function has stack frame of 0x198 with the current instrumentation and 0x388 with new one, which suppresses stack reuse (0x300 out of 0x388 is poisoned, the rest must be spill slots).


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7670

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list