[llvm] be08af8 - [SimplifyCFG] add test for select with FMF; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 13:45:53 PST 2019


Author: Sanjay Patel
Date: 2019-11-13T16:45:42-05:00
New Revision: be08af881693f9182a06451a353365d1d59e97dc

URL: https://github.com/llvm/llvm-project/commit/be08af881693f9182a06451a353365d1d59e97dc
DIFF: https://github.com/llvm/llvm-project/commit/be08af881693f9182a06451a353365d1d59e97dc.diff

LOG: [SimplifyCFG] add test for select with FMF; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/SimplifyCFG/HoistCode.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SimplifyCFG/HoistCode.ll b/llvm/test/Transforms/SimplifyCFG/HoistCode.ll
index 9697e56a719f..1fb9c46e8823 100644
--- a/llvm/test/Transforms/SimplifyCFG/HoistCode.ll
+++ b/llvm/test/Transforms/SimplifyCFG/HoistCode.ll
@@ -1,11 +1,38 @@
-; RUN: opt < %s -simplifycfg -S | not grep br
+; 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) {
-        br i1 %C, label %T, label %F
+; 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
+  store i32 7, i32* %P
+  ret void
 F:              ; preds = %0
-        store i32 7, i32* %P
-        ret void
+  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 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
 }


        


More information about the llvm-commits mailing list