Skip to content

Commit 75b5bd9

Browse files
committed
add compiler macro
1 parent 6fe0f68 commit 75b5bd9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ class GIMatchTableExecutor {
721721
// - Unchecked execution, assumes no error.
722722
// - Fast common case handling (1 byte values).
723723
LLVM_ATTRIBUTE_ALWAYS_INLINE static uint64_t
724-
fastDecodeULEB128(const uint8_t *MatchTable, uint64_t &CurrentIdx) {
724+
fastDecodeULEB128(const uint8_t *LLVM_ATTRIBUTE_RESTRICT MatchTable,
725+
uint64_t &CurrentIdx) {
725726
uint64_t Value = MatchTable[CurrentIdx++];
726727
if (LLVM_UNLIKELY(Value >= 128)) {
727728
Value &= 0x7f;

llvm/include/llvm/Support/Compiler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,14 @@
278278
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
279279
#endif
280280

281+
/// LLVM_ATTRIBUTE_RESTRICT- Annotates a pointer to tell the compiler that
282+
/// it is not aliased in the current scope.
283+
#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
284+
#define LLVM_ATTRIBUTE_RESTRICT __restrict
285+
#else
286+
#define LLVM_ATTRIBUTE_RESTRICT
287+
#endif
288+
281289
/// \macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a
282290
/// pointer that does not alias any other valid pointer.
283291
#ifdef __GNUC__

0 commit comments

Comments
 (0)