Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mips] Fix missing masking in fast-isel of br (PR40325)
Fixes https://bugs.llvm.org/show_bug.cgi?id=40325 by zero extending (and x, 1) the condition before branching on it. To avoid regressing trivial cases, I'm combining emission of cmp+br sequences for the single-use + same block case (similar to what we do in x86). icmpbr1.ll still regresses due to the cross-bb usage of the condition. Differential Revision: https://reviews.llvm.org/D58576 llvm-svn: 354808
- Loading branch information
Showing
3 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=mipsel -relocation-model=pic -O0 -mcpu=mips32 < %s | FileCheck %s | ||
|
||
define void @test(i32 %x, i1* %p) nounwind { | ||
; CHECK-LABEL: test: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: move $1, $4 | ||
; CHECK-NEXT: andi $4, $4, 1 | ||
; CHECK-NEXT: sb $4, 0($5) | ||
; CHECK-NEXT: andi $1, $1, 1 | ||
; CHECK-NEXT: bgtz $1, $BB0_1 | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: # %bb.1: # %foo | ||
; CHECK-NEXT: jr $ra | ||
; CHECK-NEXT: nop | ||
%y = and i32 %x, 1 | ||
%c = icmp eq i32 %y, 1 | ||
store i1 %c, i1* %p | ||
br i1 %c, label %foo, label %foo | ||
|
||
foo: | ||
ret void | ||
} |