Optimization record is not generated when the input file is in bytecode format.
Details
Diff Detail
Event Timeline
clang/lib/CodeGen/CodeGenAction.cpp | ||
---|---|---|
85 | retruns -> returns | |
303 | You already returned if isSet is false so this check is uneeded. | |
1126 | I don't work in the frontend. Can setASTConsumer fail somehow or would hasASTConsumer always return true. | |
1129 | This looks strangely formatted. The opening parenthese should be on the previous line. Please run clang-format on this | |
llvm/include/llvm/IR/LLVMContext.h | ||
151 ↗ | (On Diff #230941) | Bite->Bit |
llvm/lib/IR/LLVMContext.cpp | ||
---|---|---|
118 ↗ | (On Diff #230941) | Why do we need a separate entry point that does the same thing as setDiagnosticHandler? |
clang/lib/CodeGen/CodeGenAction.cpp | ||
---|---|---|
1126 | setASTConsumer can return a nullptr. | |
llvm/lib/IR/LLVMContext.cpp | ||
118 ↗ | (On Diff #230941) | setDiagnosticHandler calls builds an object of class ClangDiagnosticHandler that is a base class for diagnostic handling in LLVM. |
After an (offline) review from @erichkeane (added now as a reviewer) , stripped the unnecessary code. Thanks.
unique_ptr already has a 'bool' builtin to its state (one that this code checks later anyway), so there isn't a good reason to return a bool here. Otherwise I think I'm OK with this.
I'd like @thegameg to have a chance to take a look to make sure everything this is doing is necessary, so you should perhaps hold off until ~Weds/Thurs before committing.
clang/lib/CodeGen/CodeGenAction.cpp | ||
---|---|---|
87 | This should just make/return OptRecordFile rather than a bool. |
Thanks for fixing this!
clang/lib/CodeGen/CodeGenAction.cpp | ||
---|---|---|
97 | I think what would be nicer here is to extract all the error handling in a separate function and keep using setupOptimizationRemarks for all the callers. | |
296 | This would become something like: Expected<std::unique_ptr<llvm::ToolOutputFile>> OptRecordFileOrErr = llvm::setupOptimizationRemarks(...); if (Error E = OptRecordFileOrErr.takeError()) { reportError(std::move(E)); return; } | |
clang/test/CodeGen/opt-record-1.c | ||
4 | Why are the two -check-prefixes needed? | |
5 | Extra blank line here. | |
19 | Extra blank line here too. |
Thanks for the review. Please let me know if I have addressed everything.
clang/test/CodeGen/opt-record-1.c | ||
---|---|---|
4 | Removed one. |
LGTM with one last nit, thanks!
clang/lib/CodeGen/CodeGenAction.cpp | ||
---|---|---|
1074–1075 | Indentation looks a bit off here. |
Hi! I believe the commit for this (a3b2552575d3c333e928446fac10cc5b0b4092a9) is causing a test failure on our bots (https://ci.chromium.org/p/fuchsia/builders/ci/clang-linux-x64/b8894791990609720880) and some buildbots (can't find the link since it scrolled past the end of the console). Could you look into it when you get a chance?
FAIL: Clang :: CodeGen/opt-record-1.c (2905 of 16336) ******************** TEST 'Clang :: CodeGen/opt-record-1.c' FAILED ******************** Script: -- : 'RUN: at line 1'; /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/bin/clang -cc1 -internal-isystem /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/lib/clang/10.0.0/include -nostdsysteminc /b/s/w/ir/k/llvm-project/clang/test/CodeGen/opt-record-1.c -opt-record-file=t1.opt -fopenmp -emit-llvm-bc -o /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/tools/clang/test/CodeGen/Output/opt-record-1.c.tmp.bc : 'RUN: at line 2'; /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/bin/clang -cc1 -internal-isystem /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/lib/clang/10.0.0/include -nostdsysteminc -x ir /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/tools/clang/test/CodeGen/Output/opt-record-1.c.tmp.bc -opt-record-file /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/tools/clang/test/CodeGen/Output/opt-record-1.c.tmp.opt -fopenmp -emit-obj : 'RUN: at line 3'; cat /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/tools/clang/test/CodeGen/Output/opt-record-1.c.tmp.opt | /b/s/w/ir/k/recipe_cleanup/clang6Bs5au/llvm_build_dir/bin/FileCheck -check-prefix=CHECK /b/s/w/ir/k/llvm-project/clang/test/CodeGen/opt-record-1.c -- Exit Code: 1 Command Output (stderr): -- /b/s/w/ir/k/llvm-project/clang/test/CodeGen/opt-record-1.c:12:11: error: CHECK: expected string not found in input // CHECK: --- !Missed ^ <stdin>:1:1: note: scanning from here --- !Analysis ^ -- ******************** Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. Testing Time: 74.62s ******************** Failing Tests (1): Clang :: CodeGen/opt-record-1.c
Please see the edit in the list test. Fixed the build issue that occurred in the buildbot:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-new-pass-manager-fast/builds/232/steps/test-check-all/logs/stdio
This might be easier to read the edit that I have made:
ksh-3.2$ git diff
diff --git a/clang/test/CodeGen/opt-record-1.c b/clang/test/CodeGen/opt-record-1.c
index 3f37e32..00a753d 100644
- a/clang/test/CodeGen/opt-record-1.c
+++ b/clang/test/CodeGen/opt-record-1.c
@@ -1,12 +1,12 @@
- RUN: %clang_cc1 %s -opt-record-file=t1.opt -fopenmp -emit-llvm-bc -o %t.bc
- RUN: %clang_cc1 -x ir %t.bc -opt-record-file %t.opt -fopenmp -emit-obj
+ RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -O3 -opt-record-file=t1.opt -fopenmp -emit-llvm-bc -o %t.bc
+ RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -O3 -x ir %t.bc -opt-record-file %t.opt -fopenmp -emit-obj
// RUN: cat %t.opt | FileCheck -check-prefix=CHECK %s
void foo(int *a, int *b, int *c) {
#pragma omp parallel for
- for (int i = 0; i < 100; i++) {
- a[i] = b[i] + c[i];
- }
+ for (int i = 0; i < 100; i++) {
+ a[i] = b[i] + c[i];
+ }
}
// CHECK: --- !Missed
ksh-3.2$
And I checked that it passes.
Got other build fails.
Doesn't the LIT test require a:
// REQUIRES: x86-registered-target
command?
Thanks.
I looked at the test failure, the REQUIRES line is necessary because the test calls emit-obj. I've asked Zahira to commit it to fix the bots.
retruns -> returns