Three unrelated changes:
- Add a concat method as a convenience to help write bitvector use cases in a nicer way.
- Use LLVM_UNLIKELY as suggested by @xbolva00 in a previous patch.
- Fix casing of some "slow" methods to follow naming standards.
Paths
| Differential D109620
[APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer. ClosedPublic Authored by lattner on Sep 10 2021, 11:31 AM.
Details Summary Three unrelated changes:
Diff Detail
Unit TestsFailed Event Timeline
Comment Actions Incorporate Craig's feedback: Optimize isAllOnes and concatSlowCase Also change more variable names to appease clang-tidy. foad added inline comments.
lattner added inline comments.
Comment Actions I don't hear any concerns, I'll plan to land this later today unless anyone has an objection - thanks! This revision is now accepted and ready to land.Sep 13 2021, 9:23 AM Closed by commit rG8b4afc5aef14: [APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer. (authored by lattner). · Explain WhySep 13 2021, 10:02 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 371978 llvm/include/llvm/ADT/APInt.h
llvm/lib/Support/APInt.cpp
llvm/unittests/ADT/APIntTest.cpp
|
This is may be too subtle, but we can avoid a branch here if we use.
U.VAL == WORDTYPE_MAX >> ((APINT_BITS_PER_WORD - BitWidth) & 0x3f);
That will alias 64 and 0 to both use WORD_TYPE for the compare. Since U.VAL should always be 0 for BitWidth == 0. The compare would always fail.