add __builtin_unpredictable and convert to metadata

Description

add __builtin_unpredictable and convert to metadata

This patch depends on r246688 (D12341).

The goal is to make LLVM generate different code for these functions for a target that
has cheap branches (see PR23827 for more details):

int foo();

int normal(int x, int y, int z) {

if (x != 0 && y != 0) return foo();
return 1;

}

int crazy(int x, int y) {

if (__builtin_unpredictable(x != 0 && y != 0)) return foo();
return 1;

}

Differential Revision: http://reviews.llvm.org/D12458

Details

Committed
spatelSep 2 2015, 1:01 PM
Differential Revision
D12458: [clang] add __builtin_unpredictable and convert to metadata
Parents
rL246698: Updating the code owners list.
Branches
Unknown
Tags
Unknown