about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2019-01-21 19:36:27 +0100
committerBjörn Steinbrink <bsteinbr@gmail.com>2019-01-21 19:36:27 +0100
commit5a7cd848f740291f94f2400b50f41136fc8657bb (patch)
tree06b38e2a5c0aba5bde5ee02ab3e71c297fa3539d /src/rustllvm/RustWrapper.cpp
parent4db2394156b408e7af5c595bf3c9cbff8ba21157 (diff)
downloadrust-5a7cd848f740291f94f2400b50f41136fc8657bb.tar.gz
rust-5a7cd848f740291f94f2400b50f41136fc8657bb.zip
Speed up the fast path for assert_eq! and assert_ne!
Currently, the panic!() calls directly borrow the value bindings. This
causes those bindings to always be initialized, i.e. they're initialized
even before the values are even compared. This causes noticeable
overhead in what should be a really cheap operation.

By performing a reborrow of the value in the call to panic!(), we allow
LLVM to optimize that code, so that the extra borrow only happens in the
error case.

We could achieve the same result by dereferencing the values passed to
panic!(), as the format machinery borrows them anyway, but this causes
assertions to fail to compile if one of the values is unsized, i.e. it
would be a breaking change.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions