[asan] Restore dead-code-elimination optimization for Fuchsia
authorVitaly Buka <vitalybuka@google.com>
Tue, 8 Aug 2017 01:01:59 +0000 (01:01 +0000)
committerVitaly Buka <vitalybuka@google.com>
Tue, 8 Aug 2017 01:01:59 +0000 (01:01 +0000)
commit4bc6c466b859c522d9294a303ae0c6bcf9443905
treeebe088a3e9e3598bbb05af829577cf199f9c69e8
parent1285013dbe3409016c05db9322f3baa55d83cc4f
[asan] Restore dead-code-elimination optimization for Fuchsia

Summary:
r310244 fixed a bug introduced by r309914 for non-Fuchsia builds.
In doing so it also reversed the intended effect of the change for
Fuchsia builds, which was to allow all the AllocateFromLocalPool
code and its variables to be optimized away entirely.

This change restores that optimization for Fuchsia builds, but
doesn't have the original change's bug because the comparison
arithmetic now takes into account the size of the elements.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36430

llvm-svn: 310330
compiler-rt/lib/asan/asan_malloc_linux.cc