[PATCH] D19300: delete the llvm.expect intrinsic and its lowering pass
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 11:09:38 PDT 2016
spatel abandoned this revision.
spatel added a comment.
Abandoning.
The feedback on the dev list was that handling the builtin_expect() in clang is ugly, so it's better to pay a small cost in LLVM to do it.
Note that the current llvm.expect lowering pass doesn't actually work for anything but the simplest cases. The pass needs to be enhanced to handle patterns like:
int foo(int x, int y) {
if (__builtin_expect(x, 20) > 10) return 234; // expected value is not 1
return 2;
}
or:
int foo(int n) {
int b = __builtin_expect(n, 1); // expect is not directly used in comparison
if (b) return 24;
return 234;
}
Currently, the llvm.expect is discarded in these cases without generating any metadata.
http://reviews.llvm.org/D19300
More information about the llvm-commits
mailing list