Skip to content

Commit 8ad9e1e

Browse files
committed
[Clang] Fix use of deprecated method and missing triple
Fixes two buildbot errors caused by 4424c44 (#110102): The first error, seen on some sanitizer bots: https://lab.llvm.org/buildbot/#/builders/51/builds/9901 The initial commit used the deprecated getDeclaration intrinsic instead of the non-deprecated getOrInsert- equivalent. This patch trivially updates the code in question to use the new intrinsic. The second error, seen on the clang-armv8-quick bot: https://lab.llvm.org/buildbot/#/builders/154/builds/10983 One of the tests depends on a particular triple to get the exact output expected by the test, but did not specify this triple; this patch adds the triple in question.
1 parent 62c16d8 commit 8ad9e1e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,9 +2587,10 @@ llvm::Function *CodeGenModule::getLLVMLifetimeEndFn() {
25872587

25882588
/// Lazily declare the @llvm.fake.use intrinsic.
25892589
llvm::Function *CodeGenModule::getLLVMFakeUseFn() {
2590-
if (!FakeUseFn)
2591-
FakeUseFn = llvm::Intrinsic::getDeclaration(&getModule(),
2592-
llvm::Intrinsic::fake_use);
2590+
if (FakeUseFn)
2591+
return FakeUseFn;
2592+
FakeUseFn = llvm::Intrinsic::getOrInsertDeclaration(
2593+
&getModule(), llvm::Intrinsic::fake_use);
25932594
return FakeUseFn;
25942595
}
25952596

clang/test/CodeGen/fake-use-sanitizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefixes=CHECK,NULL --implicit-check-not=ubsantrap %s
2-
// RUN: %clang_cc1 %s -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
1+
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -fsanitize=null -fsanitize-trap=null -o - | FileCheck --check-prefixes=CHECK,NULL --implicit-check-not=ubsantrap %s
2+
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
33

44
// With -fextend-lifetimes, the compiler previously generated a fake.use of any
55
// reference variable at the end of the scope in which its alloca exists. This

0 commit comments

Comments
 (0)