[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-27 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth abandoned this revision. paulkirth added a comment. This is being abandoned in favor of D66324 , which reimplements this logic completely in the LLVM backend. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-27 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D65300#1647775 , @paulkirth wrote: > In D65300#1647746 , @lebedev.ri > wrote: > > > Please can you clarify hat's the current layout of these patches? > > Is this patch required, or

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-27 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added a comment. In D65300#1647746 , @lebedev.ri wrote: > Please can you clarify hat's the current layout of these patches? > Is this patch required, or is it superseded by D66324 > (and thus should be

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-27 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Please can you clarify hat's the current layout of these patches? Is this patch required, or is it superseded by D66324 (and thus should be abandoned)? I'd like to begin reviewing, but i don't understand where to start. Repository:

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-06 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 213725. paulkirth added a comment. Use existing LLVM code for mapping case literals to their case arms. This update refactors a great deal of the implementation and test code. 1. Removes the CaseMap data structure completely. LLVM already maintains a

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-05 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. In D65300#1608147 , @lebedev.ri wrote: > Thank you for working on this! > > I'm guessing this doesn't have a `-Werror=` mode? > > I still believe this should output a remark. > It will still be visible in the compiler console

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-05 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 213379. paulkirth edited the summary of this revision. paulkirth added a comment. Update threshold values to match those assigned when lowering __builtin_expect intrinsic. I've modified the branch probability to match the probability assigned in

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-02 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 213167. paulkirth added a comment. Update documentation and fix typos Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65300/new/ https://reviews.llvm.org/D65300 Files:

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-02 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 213164. paulkirth added a comment. Address feedback from review 1. Fixed comments in License headers 2. removed excess {} 3. Changed conditional assignment to ternary operation 4. Moved local functions into anonymous namespace 5. Added reference to the

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-02 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added inline comments. Comment at: clang/lib/CodeGen/MisExpect.cpp:140-146 +void EmitMisExpectWarning(const CallExpr *Call, CodeGenModule ) { + SourceLocation ExprLoc = Call->getBeginLoc(); + unsigned DiagID = CGM.getDiags().getCustomDiagID( +

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-02 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth marked 2 inline comments as done. paulkirth added inline comments. Comment at: clang/lib/CodeGen/MisExpect.cpp:82 + if (ExpectedTrueBranch) { +const llvm::BranchProbability HotFunctionThreshold(1, 100); +Scaled = HotFunctionThreshold.scale(CurrProfCount);

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-08-02 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 213059. paulkirth marked 2 inline comments as done. paulkirth added a comment. Fix typo in comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65300/new/ https://reviews.llvm.org/D65300 Files:

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-31 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri requested changes to this revision. lebedev.ri added a comment. This revision now requires changes to proceed. Thank you for working on this! I'm guessing this doesn't have a `-Werror=` mode? I still believe this should output a remark. It will still be visible in the compiler

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-30 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan accepted this revision. leonardchan added a comment. This revision is now accepted and ready to land. LGTM but I'd wait a day to see if anyone else has comments they'd like to add before landing. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments. Comment at: clang/lib/CodeGen/MisExpect.cpp:29 + +void DebugPrintMisExpectSwitchInfo(SmallVector *SwitchWeights, + llvm::DenseMap *CaseMap); It seems like `DebugPrintMisExpectSwitchInfo` and

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-30 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 212492. paulkirth added a comment. Update diff to have proper context on Phabricator Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65300/new/ https://reviews.llvm.org/D65300 Files:

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-25 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 211853. paulkirth added a comment. Add missing test for switch statements when the expected value is not a compile time constant. Make sure that when the expected value cannot be evaluated, we do not issue any warnings or errors Repository: rG LLVM

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-25 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added a comment. In D65300#1601733 , @xbolva00 wrote: > Nice work! Glad to hear you like it. > It would be nice if we also have “-fsuggest-expect” so we could fix perf > issues thanks to PGO counters even for non-PGO builds. What do you

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-25 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. Nice work! It would be nice if we also have “-fsuggest-expect” so we could fix perf issues thanks to PGO counters even for non-PGO builds. What do you think? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65300/new/ https://reviews.llvm.org/D65300

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-25 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 211831. paulkirth added a comment. Refactors some debug code to be more centralized and cleans up some comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65300/new/ https://reviews.llvm.org/D65300 Files:

[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

2019-07-25 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth created this revision. paulkirth added reviewers: phosek, leonardchan, jakehehrlich, mcgrathr. Herald added subscribers: cfe-commits, kristof.beyls, javed.absar, mgorny. Herald added a project: clang. **Overview**: This patch contains a prototype of the basic functionality of