1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/test/Transforms/EarlyCSE/flags.ll
David Majnemer 56b0cb8635 [EarlyCSE] Take the intersection of flags on instructions
EarlyCSE had inconsistent behavior with regards to flag'd instructions:
- In some cases, it would pessimize if the available instruction had
  different flags by not performing CSE.
- In other cases, it would miscompile if it replaced an instruction
  which had no flags with an instruction which has flags.

Fix this by being more consistent with our flag handling by utilizing
andIRFlags.

llvm-svn: 267111
2016-04-22 06:37:45 +00:00

19 lines
441 B
LLVM

; RUN: opt -early-cse -S < %s | FileCheck %s
declare void @use(i1)
define void @test1(float %x, float %y) {
entry:
%cmp1 = fcmp nnan oeq float %y, %x
%cmp2 = fcmp oeq float %x, %y
call void @use(i1 %cmp1)
call void @use(i1 %cmp2)
ret void
}
; CHECK-LABEL: define void @test1(
; CHECK: %[[cmp:.*]] = fcmp oeq float %y, %x
; CHECK-NEXT: call void @use(i1 %[[cmp]])
; CHECK-NEXT: call void @use(i1 %[[cmp]])
; CHECK-NEXT: ret void