Skip to content

Commit 2a7eced

Browse files
nikicgithub-actions[bot]
authored andcommitted
Automerge: [FastISel] Don't force SDAG fallback for libcalls (#171782)
The fast instruction selector should should not force an SDAG fallback to potentially make use of optimized libcall implementations. Looking at llvm/llvm-project@3e6fa46, part of the motivation was to avoid libcalls in unoptimized builds for targets that don't have them, but I believe this should be handled by Clang directly emitting intrinsics instead of libcalls (which it already does). FastISel should not second guess this. Followup to llvm/llvm-project#171288.
2 parents 908b99a + d33d80f commit 2a7eced

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,14 +1565,6 @@ bool FastISel::selectInstruction(const Instruction *I) {
15651565

15661566
if (const auto *Call = dyn_cast<CallInst>(I)) {
15671567
const Function *F = Call->getCalledFunction();
1568-
LibFunc Func;
1569-
1570-
// As a special case, don't handle calls to builtin library functions that
1571-
// may be translated directly to target instructions.
1572-
if (F && !F->hasLocalLinkage() && F->hasName() &&
1573-
LibInfo->getLibFunc(F->getName(), Func) &&
1574-
LibInfo->hasOptimizedCodeGen(Func))
1575-
return false;
15761568

15771569
// Don't handle Intrinsic::trap if a trap function is specified.
15781570
if (F && F->getIntrinsicID() == Intrinsic::trap &&

llvm/test/CodeGen/X86/stack-protector-msvc-oz.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ define void @test(ptr %a) nounwind ssp minsize {
6363
; MSVC-X86-O0-NEXT: movl ___security_cookie, %eax
6464
; MSVC-X86-O0-NEXT: xorl %esp, %eax
6565
; MSVC-X86-O0-NEXT: movl %eax, {{[0-9]+}}(%esp)
66-
; MSVC-X86-O0-NEXT: movl {{[0-9]+}}(%esp), %ecx
67-
; MSVC-X86-O0-NEXT: movl %esp, %eax
68-
; MSVC-X86-O0-NEXT: movl %ecx, 4(%eax)
66+
; MSVC-X86-O0-NEXT: movl {{[0-9]+}}(%esp), %eax
6967
; MSVC-X86-O0-NEXT: leal {{[0-9]+}}(%esp), %ecx
70-
; MSVC-X86-O0-NEXT: movl %ecx, (%eax)
68+
; MSVC-X86-O0-NEXT: movl %ecx, (%esp)
69+
; MSVC-X86-O0-NEXT: movl %eax, {{[0-9]+}}(%esp)
7170
; MSVC-X86-O0-NEXT: calll _strcpy
7271
; MSVC-X86-O0-NEXT: leal LC, %ecx
7372
; MSVC-X86-O0-NEXT: leal {{[0-9]+}}(%esp), %eax

llvm/test/CodeGen/X86/stack-protector-msvc.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ define void @test(ptr %a) nounwind ssp {
7575
; MSVC-X86-O0-NEXT: movl ___security_cookie, %eax
7676
; MSVC-X86-O0-NEXT: xorl %esp, %eax
7777
; MSVC-X86-O0-NEXT: movl %eax, {{[0-9]+}}(%esp)
78-
; MSVC-X86-O0-NEXT: movl {{[0-9]+}}(%esp), %ecx
79-
; MSVC-X86-O0-NEXT: movl %esp, %eax
80-
; MSVC-X86-O0-NEXT: movl %ecx, 4(%eax)
78+
; MSVC-X86-O0-NEXT: movl {{[0-9]+}}(%esp), %eax
8179
; MSVC-X86-O0-NEXT: leal {{[0-9]+}}(%esp), %ecx
82-
; MSVC-X86-O0-NEXT: movl %ecx, (%eax)
80+
; MSVC-X86-O0-NEXT: movl %ecx, (%esp)
81+
; MSVC-X86-O0-NEXT: movl %eax, {{[0-9]+}}(%esp)
8382
; MSVC-X86-O0-NEXT: calll _strcpy
8483
; MSVC-X86-O0-NEXT: leal LC, %ecx
8584
; MSVC-X86-O0-NEXT: leal {{[0-9]+}}(%esp), %eax

0 commit comments

Comments
 (0)