[PATCH] D42829: Emit label names according to -discard-value-names.
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 2 12:01:58 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC324127: Emit label names according to -discard-value-names. (authored by EricWF, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D42829
Files:
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/discard-name-values.cpp
Index: test/CodeGenCXX/discard-name-values.cpp
===================================================================
--- test/CodeGenCXX/discard-name-values.cpp
+++ test/CodeGenCXX/discard-name-values.cpp
@@ -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: ret i32 %bar
-// DISCARDVALUE: ret i32 %0
+ // 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;
+}
Index: lib/CodeGen/CodeGenFunction.h
===================================================================
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -1849,11 +1849,7 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42829.132649.patch
Type: text/x-patch
Size: 2095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180202/37943b09/attachment.bin>
More information about the cfe-commits
mailing list