This is the LLVM counterpart to:
http://reviews.llvm.org/D19299
Please see that patch for the motivation and more steps in this plan.
Details
Diff Detail
Event Timeline
test/Assembler/auto_upgrade_intrinsics.ll | ||
---|---|---|
92 | Extraneous newlines. |
lib/IR/AutoUpgrade.cpp | ||
---|---|---|
664 | Is there a reason not to upgrade it properly with meta data? Another question for deprecation, can you just remove the documentation and leave the support for the intrinsic support for now? |
lib/IR/AutoUpgrade.cpp | ||
---|---|---|
664 | AFAIK, we don't make any guarantees to support legacy IR, except that we don't die processing it or miscompile it, so this is the minimal patch. Given that we're still losing metadata and/or not using it in a lot of cases (PR27344), I figured we should just focus on improving that instead of spending time on backwards support. If others disagree, I can add it. If we just remove the docs, we'd still be doing unnecessary work for every compile, right? I don't see any reason to take that path. |
lib/IR/AutoUpgrade.cpp | ||
---|---|---|
664 | Personally, I don't have issues with completely removing it -- but I can not speak for others in this aspect. IMO, removing documentation can be a safe first step -- the compile time impact should be minimal. |
lib/IR/AutoUpgrade.cpp | ||
---|---|---|
664 | Let me send a note to the dev list about this patch. If anyone objects or would like us to implement this in stages, we should hear about it. :) |
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.
Is there a reason not to upgrade it properly with meta data?
Another question for deprecation, can you just remove the documentation and leave the support for the intrinsic support for now?