Files
llvm-project/clang/test/CodeGen/pr45476.cpp
Tomer Shafir 5fedb7c588 [Clang][ARM] Fix tests using thumb instead arm arch on cc1 (#166416)
Currently, the ARM backend incorrectly parses every `arm` prefixed arch
to be non-thumb, but `armv6m` is THUMB and doesnt have ARM ops causing
the test to fail when compiling to assembly and not LLVM IR: `error:
Function 'foo' uses ARM instructions, but the target does not support
ARM mode execution.` This only happens when invoking cc1 directly and
not the Clang driver.

As a quick triage, this patch changes the tests to use `thumb`.

Uncovered by https://github.com/llvm/llvm-project/pull/151404
2025-11-05 16:29:05 +02:00

22 lines
553 B
C++

// RUN: %clang_cc1 -triple thumbv6m-eabi -emit-llvm %s -o - | FileCheck -check-prefix=LIBCALL %s
// RUN: %clang_cc1 -triple armv8-eabi -emit-llvm %s -o - | FileCheck -check-prefix=NATIVE %s
// PR45476
// This test used to get into an infinite loop,
// which, in turn, caused clang to never finish execution.
struct s3 {
char a, b, c;
};
_Atomic struct s3 a;
extern "C" void foo() {
// LIBCALL-LABEL: @foo
// LIBCALL: call void @__atomic_store
// NATIVE-LABEL: @foo
// NATIVE: store atomic i32 {{.*}} seq_cst, align 4
a = s3{1, 2, 3};
}