Skip to content

[LICM] Fix dropped metadata #95221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2024
Merged

Conversation

tgymnich
Copy link
Member

Fixes #91919

LICM drops metadata for call instructions when cloning instructions.
This patch just adds the missing copyMetadata.

@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Tim Gymnich (tgymnich)

Changes

Fixes #91919

LICM drops metadata for call instructions when cloning instructions.
This patch just adds the missing copyMetadata.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/LICM.cpp (+1)
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 5eccf7b4adb65..75883e0da214d 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1453,6 +1453,7 @@ static Instruction *cloneInstructionInExitBlock(
     }
 
     New = CallInst::Create(CI, OpBundles);
+    New->copyMetadata(*CI);
   } else {
     New = I.clone();
   }

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.

Please add a test case in llvm/test/Transforms/LICM.

@tgymnich tgymnich force-pushed the licm-fix-dropped-metadata branch from 7ed902e to 771f1c1 Compare June 12, 2024 12:57
@tgymnich tgymnich requested a review from nikic June 13, 2024 14:31
@tgymnich tgymnich force-pushed the licm-fix-dropped-metadata branch 3 times, most recently from 38edf12 to e4dfffb Compare June 13, 2024 15:48
@tgymnich tgymnich requested a review from nikic June 13, 2024 15:49
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

@tgymnich tgymnich closed this Jun 15, 2024
@tgymnich tgymnich deleted the licm-fix-dropped-metadata branch June 15, 2024 16:44
@tgymnich tgymnich restored the licm-fix-dropped-metadata branch June 18, 2024 16:33
@tgymnich tgymnich reopened this Jun 18, 2024
@tgymnich
Copy link
Member Author

deleted the branch too early. Only saw the approval

@tgymnich tgymnich force-pushed the licm-fix-dropped-metadata branch from e4dfffb to eb108f0 Compare June 18, 2024 16:50
@tgymnich tgymnich force-pushed the licm-fix-dropped-metadata branch from eb108f0 to ebe76dd Compare June 18, 2024 17:47
@nikic nikic merged commit 0dd4377 into llvm:main Jun 19, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 19, 2024

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

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

Here is the relevant piece of the build log for the reference:

Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py (99 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py (100 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/import-std-module/vector/TestVectorFromStdModule.py (101 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py (102 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py (103 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/import_builtin_fileid/TestImportBuiltinFileID.py (104 of 1976)
PASS: lldb-api :: commands/expression/invalid-args/TestInvalidArgsExpression.py (105 of 1976)
PASS: lldb-api :: commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py (106 of 1976)
PASS: lldb-api :: commands/expression/inline-namespace/TestInlineNamespace.py (107 of 1976)
PASS: lldb-api :: commands/expression/ir-interpreter-phi-nodes/TestIRInterpreterPHINodes.py (108 of 1976)
XFAIL: lldb-api :: commands/expression/macros/TestMacros.py (109 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/multiline-completion/TestMultilineCompletion.py (110 of 1976)
PASS: lldb-api :: commands/expression/memory-allocation/TestMemoryAllocSettings.py (111 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/multiline-navigation/TestMultilineNavigation.py (112 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/namespace_local_var_same_name_cpp_and_c/TestNamespaceLocalVarSameNameCppAndC.py (113 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/namespace_local_var_same_name_obj_c/TestNamespaceLocalVarSameNameObjC.py (114 of 1976)
PASS: lldb-api :: commands/expression/issue_11588/Test11588.py (115 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/persist_objc_pointeetype/TestPersistObjCPointeeType.py (116 of 1976)
PASS: lldb-api :: commands/expression/namespace-alias/TestInlineNamespaceAlias.py (117 of 1976)
PASS: lldb-api :: commands/expression/ir-interpreter/TestIRInterpreter.py (118 of 1976)
PASS: lldb-api :: commands/expression/persistent_ptr_update/TestPersistentPtrUpdate.py (119 of 1976)
PASS: lldb-api :: commands/expression/options/TestExprOptions.py (120 of 1976)
PASS: lldb-api :: commands/expression/nested/TestNestedExpressions.py (121 of 1976)
PASS: lldb-api :: commands/expression/persistent_types/TestNestedPersistentTypes.py (122 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/po_persistent_result/TestPoPersistentResult.py (123 of 1976)
PASS: lldb-api :: commands/expression/persistent_types/TestPersistentTypes.py (124 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/po_verbosity/TestPoVerbosity.py (125 of 1976)
PASS: lldb-api :: commands/expression/no-deadlock/TestExprDoesntBlock.py (126 of 1976)
PASS: lldb-api :: commands/expression/persistent_variables/TestPersistentVariables.py (127 of 1976)
PASS: lldb-api :: commands/expression/pr52257/TestExprCrash.py (128 of 1976)
PASS: lldb-api :: commands/expression/persistent_result/TestPersistentResult.py (129 of 1976)
PASS: lldb-api :: commands/expression/pr35310/TestExprsBug35310.py (130 of 1976)
PASS: lldb-api :: commands/expression/radar_8638051/Test8638051.py (131 of 1976)
PASS: lldb-api :: commands/expression/radar_9531204/TestPrintfAfterUp.py (132 of 1976)
PASS: lldb-api :: commands/expression/radar_9673664/TestExprHelpExamples.py (133 of 1976)
PASS: lldb-api :: commands/expression/rdar42038760/TestScalarURem.py (134 of 1976)
PASS: lldb-api :: commands/expression/result_numbering/TestResultNumbering.py (135 of 1976)
PASS: lldb-api :: commands/expression/rdar44436068/Test128BitsInteger.py (136 of 1976)
PASS: lldb-api :: commands/expression/regression-access-function-template-in-record/TestRegressionAccessFunctionTemplateInRecord.py (137 of 1976)
PASS: lldb-api :: commands/expression/save_jit_objects/TestSaveJITObjects.py (138 of 1976)
PASS: lldb-api :: commands/expression/scoped_enums/TestScopedEnumType.py (139 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/two-files/TestObjCTypeQueryFromOtherCompileUnit.py (140 of 1976)
PASS: lldb-api :: commands/expression/test/TestExprs2.py (141 of 1976)
PASS: lldb-api :: commands/expression/static-initializers/TestStaticInitializers.py (142 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/vector_of_enums/TestVectorOfEnums.py (143 of 1976)
PASS: lldb-api :: commands/expression/unicode-in-variable/TestUnicodeInVariable.py (144 of 1976)
PASS: lldb-api :: commands/expression/top-level/TestTopLevelExprs.py (145 of 1976)
UNSUPPORTED: lldb-api :: commands/expression/weak_symbols/TestWeakSymbols.py (146 of 1976)
PASS: lldb-api :: commands/expression/expr-in-syscall/TestExpressionInSyscall.py (147 of 1976)

@tgymnich tgymnich deleted the licm-fix-dropped-metadata branch July 1, 2024 10:40
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
LICM drops metadata for call instructions when cloning instructions.
This patch just adds the missing `copyMetadata`.

Fixes llvm#91919.
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.

LICM drop call instruction metadata
4 participants