Skip to content

Commit 6f0e74c

Browse files
committed
Avoid unnecessary AArch64 DSB in __clear_cache in some situations.
The dsb after instruction cache invalidation only needs to be executed if any instruction cache invalidation did happen. Without this change, if the CTR_EL0.DIC bit indicates that instruction cache invalidation is not needed, __clear_cache would execute two dsb instructions in a row; with the second one being unnecessary. Differential Revision: https://reviews.llvm.org/D104371
1 parent 3ed3e43 commit 6f0e74c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/builtins/clear_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ void __clear_cache(void *start, void *end) {
127127
for (addr = xstart & ~(icache_line_size - 1); addr < xend;
128128
addr += icache_line_size)
129129
__asm __volatile("ic ivau, %0" ::"r"(addr));
130+
__asm __volatile("dsb ish");
130131
}
131-
__asm __volatile("dsb ish");
132132
__asm __volatile("isb sy");
133133
#elif defined(__powerpc64__)
134134
const size_t line_size = 32;

0 commit comments

Comments
 (0)