Skip to content

Commit 31dcee4

Browse files
committed
Only call __builtin_assume, if it is available in the current compiler
1 parent c4a21d1 commit 31dcee4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

include/phasar/Utils/StableVector.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class StableVector {
5252

5353
Iterator &operator++() noexcept {
5454
if (LLVM_LIKELY(++It != ItEnd)) {
55-
/// Let the compiler optimize away the operator== call entirely
55+
/// Let the compiler optimize away the operator== call entirely
56+
#if __has_builtin(__builtin_assume)
5657
__builtin_assume(It != nullptr);
58+
#endif
5759
return *this;
5860
}
5961

@@ -66,7 +68,9 @@ class StableVector {
6668
// We are at the end of the main loop => enter the tail loop now
6769
It = *Outer;
6870
ItEnd = Pos;
71+
#if __has_builtin(__builtin_assume)
6972
__builtin_assume(It != nullptr);
73+
#endif
7074
return *this;
7175
}
7276
// We are still in the main loop
@@ -75,7 +79,9 @@ class StableVector {
7579
ItEnd = It + Total;
7680

7781
Total <<= 1;
82+
#if __has_builtin(__builtin_assume)
7883
__builtin_assume(It != nullptr);
84+
#endif
7985
return *this;
8086
}
8187

0 commit comments

Comments
 (0)