mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
ee2a5b569a
This is another step towards having FMF apply only to FP values rather than those + fcmp. See PR38086 for one of the original discussions/motivations: https://bugs.llvm.org/show_bug.cgi?id=38086 And the test here is derived from PR39535: https://bugs.llvm.org/show_bug.cgi?id=39535 Currently, we lose FMF when converting any phi to select in SimplifyCFG. There are a small number of similar changes needed to correct within SimplifyCFG, so it should be quick to patch this pass up. FMF was extended to select and phi with: D61917 D67564 Differential Revision: https://reviews.llvm.org/D70208
39 lines
959 B
LLVM
39 lines
959 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -simplifycfg -S | FileCheck %s
|
|
|
|
define void @foo(i1 %C, i32* %P) {
|
|
; CHECK-LABEL: @foo(
|
|
; CHECK-NEXT: store i32 7, i32* [[P:%.*]]
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
br i1 %C, label %T, label %F
|
|
T: ; preds = %0
|
|
store i32 7, i32* %P
|
|
ret void
|
|
F: ; preds = %0
|
|
store i32 7, i32* %P
|
|
ret void
|
|
}
|
|
|
|
define float @PR39535min(float %x) {
|
|
; CHECK-LABEL: @PR39535min(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une float [[X:%.*]], 0.000000e+00
|
|
; CHECK-NEXT: [[DOTX:%.*]] = select fast i1 [[TOBOOL]], float 0.000000e+00, float [[X]]
|
|
; CHECK-NEXT: ret float [[DOTX]]
|
|
;
|
|
entry:
|
|
%tobool = fcmp une float %x, 0.0
|
|
br i1 %tobool, label %cond.true, label %cond.false
|
|
|
|
cond.true:
|
|
br label %cond.end
|
|
|
|
cond.false:
|
|
br label %cond.end
|
|
|
|
cond.end:
|
|
%cond = phi fast float [ 0.0, %cond.true ], [ %x, %cond.false ]
|
|
ret float %cond
|
|
}
|