aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-09-04 09:28:11 +0200
committerGitHub <noreply@github.com>2025-09-04 09:28:11 +0200
commit3f757a39f2855cd06c62a85b8e27fd56fa017e78 (patch)
treec93f2236c7b58accfe19042ac67d861c85b231cb /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent4d927a5faf42d025410586f0cdc3bf60ef198a86 (diff)
downloadllvm-3f757a39f2855cd06c62a85b8e27fd56fa017e78.zip
llvm-3f757a39f2855cd06c62a85b8e27fd56fa017e78.tar.gz
llvm-3f757a39f2855cd06c62a85b8e27fd56fa017e78.tar.bz2
[CodeGen] Remove ExpandInlineAsm hook (#156617)
This hook replaces inline asm with LLVM intrinsics. It was intended to match inline assembly implementations of bswap in libc headers and replace them more optimizable implementations. At this point, it has outlived its usefulness (see https://github.com/llvm/llvm-project/issues/156571#issuecomment-3247638412), as libc implementations no longer use inline assembly for this purpose. Additionally, it breaks the "black box" property of inline assembly, which some languages like Rust would like to guarantee. Fixes https://github.com/llvm/llvm-project/issues/156571.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 0e40a92..9db4c9e 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2618,22 +2618,9 @@ static bool despeculateCountZeros(IntrinsicInst *CountZeros, LoopInfo &LI,
bool CodeGenPrepare::optimizeCallInst(CallInst *CI, ModifyDT &ModifiedDT) {
BasicBlock *BB = CI->getParent();
- // Lower inline assembly if we can.
- // If we found an inline asm expession, and if the target knows how to
- // lower it to normal LLVM code, do so now.
- if (CI->isInlineAsm()) {
- if (TLI->ExpandInlineAsm(CI)) {
- // Avoid invalidating the iterator.
- CurInstIterator = BB->begin();
- // Avoid processing instructions out of order, which could cause
- // reuse before a value is defined.
- SunkAddrs.clear();
- return true;
- }
- // Sink address computing for memory operands into the block.
- if (optimizeInlineAsmInst(CI))
- return true;
- }
+ // Sink address computing for memory operands into the block.
+ if (CI->isInlineAsm() && optimizeInlineAsmInst(CI))
+ return true;
// Align the pointer arguments to this call if the target thinks it's a good
// idea