forked from OSchip/llvm-project
Emit label names according to -discard-value-names.
Summary: Previously, Clang only emitted label names in assert builds. However there is a CC1 option -discard-value-names that should have been used to control emission instead. This patch removes the NDEBUG preprocessor block and instead allows LLVM to handle removing the names in accordance with the option. Reviewers: erichkeane, aaron.ballman, majnemer Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42829 llvm-svn: 324127
This commit is contained in:
parent
66ce45150f
commit
88df555d05
|
@ -1849,11 +1849,7 @@ public:
|
|||
llvm::BasicBlock *createBasicBlock(const Twine &name = "",
|
||||
llvm::Function *parent = nullptr,
|
||||
llvm::BasicBlock *before = nullptr) {
|
||||
#ifdef NDEBUG
|
||||
return llvm::BasicBlock::Create(getLLVMContext(), "", parent, before);
|
||||
#else
|
||||
return llvm::BasicBlock::Create(getLLVMContext(), name, parent, before);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// getBasicBlockForLabel - Return the LLVM basicblock that the specified
|
||||
|
|
|
@ -1,10 +1,29 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -triple=armv7-apple-darwin -emit-llvm -std=c++11 %s -o - -O1 | FileCheck %s
|
||||
// RUN: %clang_cc1 -emit-llvm -triple=armv7-apple-darwin -emit-llvm -std=c++11 %s -o - -O1 -discard-value-names | FileCheck %s --check-prefix=DISCARDVALUE
|
||||
// RUN: %clang_cc1 -emit-llvm -triple=armv7-apple-darwin -std=c++11 %s -o - -O1 \
|
||||
// RUN: | FileCheck %s
|
||||
// RUN: %clang_cc1 -emit-llvm -triple=armv7-apple-darwin -std=c++11 %s -o - -O1 \
|
||||
// RUN: -discard-value-names | FileCheck %s --check-prefix=DISCARDVALUE
|
||||
|
||||
int foo(int bar) {
|
||||
return bar;
|
||||
extern "C" void branch();
|
||||
|
||||
bool test(bool pred) {
|
||||
// DISCARDVALUE: br i1 %0, label %2, label %3
|
||||
// CHECK: br i1 %pred, label %if.then, label %if.end
|
||||
|
||||
if (pred) {
|
||||
// DISCARDVALUE: ; <label>:2:
|
||||
// DISCARDVALUE-NEXT: tail call void @branch()
|
||||
// DISCARDVALUE-NEXT: br label %3
|
||||
|
||||
// CHECK: if.then:
|
||||
// CHECK-NEXT: tail call void @branch()
|
||||
// CHECK-NEXT: br label %if.end
|
||||
branch();
|
||||
}
|
||||
|
||||
// DISCARDVALUE: ; <label>:3:
|
||||
// DISCARDVALUE-NEXT: ret i1 %0
|
||||
|
||||
// CHECK: if.end:
|
||||
// CHECK-NEXT: ret i1 %pred
|
||||
return pred;
|
||||
}
|
||||
|
||||
// CHECK: ret i32 %bar
|
||||
// DISCARDVALUE: ret i32 %0
|
||||
|
||||
|
|
Loading…
Reference in New Issue