MCPcopy Create free account
hub / github.com/apache/impala / CpuInfoIsSupportedHoistHelper

Function CpuInfoIsSupportedHoistHelper

be/src/util/bit-util-test.cc:356–367  ·  view source on GitHub ↗

Prevent inlining so that the compiler can't optimize out the check.

Source from the content-addressed store, hash-verified

354#ifndef __aarch64__
355// Prevent inlining so that the compiler can't optimize out the check.
356__attribute__((noinline))
357int CpuInfoIsSupportedHoistHelper(int64_t cpu_info_flag, int arg) {
358 if (CpuInfo::IsSupported(cpu_info_flag)) {
359 // Assembly follows similar pattern to popcnt instruction but executes
360 // illegal instruction.
361 int64_t result;
362 __asm__ __volatile__("ud2" : "=a"(result): "mr"(arg): "cc");
363 return result;
364 } else {
365 return 12345;
366 }
367}
368
369// Regression test for IMPALA-6882 - make sure illegal instruction isn't hoisted out of
370// CpuInfo::IsSupported() checks. This doesn't test the bug precisely but is a canary for

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected