[PATCH] D98600: [X86][FastISel] Fix with.overflow eflags clobber (PR49587)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 14:09:13 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7669455df49e: [X86][FastISel] Fix with.overflow eflags clobber (PR49587) (authored by nikic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98600/new/
https://reviews.llvm.org/D98600
Files:
llvm/lib/Target/X86/X86FastISel.cpp
llvm/test/CodeGen/X86/pr49587.ll
Index: llvm/test/CodeGen/X86/pr49587.ll
===================================================================
--- llvm/test/CodeGen/X86/pr49587.ll
+++ llvm/test/CodeGen/X86/pr49587.ll
@@ -5,10 +5,11 @@
; CHECK-LABEL: test:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: subq $1, %rdi
-; CHECK-NEXT: setb %al
+; CHECK-NEXT: setb %cl
; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: testb $1, %cl
; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
-; CHECK-NEXT: jb .LBB0_2
+; CHECK-NEXT: jne .LBB0_2
; CHECK-NEXT: # %bb.1: # %no_overflow
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
Index: llvm/lib/Target/X86/X86FastISel.cpp
===================================================================
--- llvm/lib/Target/X86/X86FastISel.cpp
+++ llvm/lib/Target/X86/X86FastISel.cpp
@@ -284,6 +284,14 @@
return false;
}
+ // Make sure no potentially eflags clobbering phi moves can be inserted in
+ // between.
+ auto HasPhis = [](const BasicBlock *Succ) {
+ return !llvm::empty(Succ->phis());
+ };
+ if (I->isTerminator() && llvm::any_of(successors(I), HasPhis))
+ return false;
+
CC = TmpCC;
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98600.333979.patch
Type: text/x-patch
Size: 1224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210329/067e1a6d/attachment.bin>
More information about the llvm-commits
mailing list