Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/113023.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/GVNSink.cpp (+3-3)
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 3dfa2dd9df27f5..42b44725240f29 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -535,12 +535,12 @@ class ValueTable {
     uint32_t e = ExpressionNumbering[exp];
     if (!e) {
       hash_code H = exp->getHashValue([=](Value *V) { return lookupOrAdd(V); });
-      auto I = HashNumbering.find(H);
-      if (I != HashNumbering.end()) {
+      auto [I, Inserted] = HashNumbering.try_emplace(H);
+      if (!Inserted) {
         e = I->second;
       } else {
         e = nextValueNumber++;
-        HashNumbering[H] = e;
+        I->second = e;
         ExpressionNumbering[exp] = e;
       }
     }

@kazutakahirata kazutakahirata force-pushed the cleanup_001_repeated_hash_GVNSink branch from 2a5b09c to 01377c7 Compare October 19, 2024 21:54
@kazutakahirata
Copy link
Contributor Author

Please take a look. Thanks!

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata force-pushed the cleanup_001_repeated_hash_GVNSink branch from 7bdb90e to a8181bc Compare October 20, 2024 16:09
@kazutakahirata kazutakahirata merged commit b9cb9b3 into llvm:main Oct 20, 2024
8 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_GVNSink branch October 20, 2024 17:41
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 20, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/12373

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
PASS: Clang :: OpenMP/master_taskloop_lastprivate_messages.cpp (11801 of 95252)
PASS: LLVM :: CodeGen/X86/combine-sub-usat.ll (11802 of 95252)
PASS: LLVM :: CodeGen/AMDGPU/GlobalISel/legalize-ushlsat.mir (11803 of 95252)
PASS: Clang :: Sema/attr-guard_nocf.c (11804 of 95252)
PASS: LLVM :: CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.udot4.ll (11805 of 95252)
PASS: LLVM :: CodeGen/Thumb2/mve-vcmpfz.ll (11806 of 95252)
PASS: Clang :: CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/bfloat16/vlsseg8e16.c (11807 of 95252)
PASS: Clang :: CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vlseg6e8ff.c (11808 of 95252)
PASS: LLVM :: CodeGen/AArch64/ptrauth-indirectbr.ll (11809 of 95252)
TIMEOUT: Clangd Unit Tests :: ./ClangdTests/13/79 (11810 of 95252)
******************** TEST 'Clangd Unit Tests :: ./ClangdTests/13/79' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/build/buildbot/premerge-monolithic-linux/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests-Clangd Unit Tests-3986539-13-79.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=79 GTEST_SHARD_INDEX=13 /build/buildbot/premerge-monolithic-linux/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests
--

Note: This is test shard 14 of 79.
[==========] Running 16 tests from 15 test suites.
[----------] Global test environment set-up.
[----------] 1 test from BackgroundIndexTest
[ RUN      ] BackgroundIndexTest.MainFileRefs
Enqueueing 1 commands for indexing
Failed to load shard: /clangd-test/root/A.cc
Indexing /clangd-test/root/A.cc (digest:=2BC243980BABC53C)
Indexed /clangd-test/root/A.cc (2 symbols, 3 refs, 2 files)
BackgroundIndex: building version 1 when background indexer is idle
BackgroundIndex: serving version 1 (25872 bytes)
Dex query tree: true
[       OK ] BackgroundIndexTest.MainFileRefs (17 ms)
[----------] 1 test from BackgroundIndexTest (17 ms total)

[----------] 2 tests from CompletionTest
[ RUN      ] CompletionTest.ScopedWithFilter
Built preamble of size 214412 for file /clangd-test/foo.cpp version null in 0.02 seconds
Ignored diagnostic. /clangd-test/foo.cpp:2:22:use of undeclared identifier 'ns'
Code complete: fuzzyFind({
  "AnyScope": false,
  "Limit": null,
  "PreferredTypes": [],
  "ProximityPaths": [
    "/clangd-test/foo.cpp"
  ],
  "Query": "x",
  "RestrictForCodeCompletion": true,
  "Scopes": [
    "ns::"
  ]
})
Code complete: sema context Symbol, query scopes [ns::] (AnyScope=false), expected type <none>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants