Value *Op0 = MatchIsOpZero ? MatchOp : NewSI;
Value *Op1 = MatchIsOpZero ? NewSI : MatchOp;
if (auto *BO = dyn_cast<BinaryOperator>(TI)) {
- return BinaryOperator::Create(BO->getOpcode(), Op0, Op1);
+ BinaryOperator *NewBO = BinaryOperator::Create(BO->getOpcode(), Op0, Op1);
+ NewBO->copyIRFlags(BO);
+ return NewBO;
}
if (auto *TGEP = dyn_cast<GetElementPtrInst>(TI)) {
auto *FGEP = cast<GetElementPtrInst>(FI);
; CHECK-LABEL: @foo(
; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 %0, 2
; CHECK-NEXT: [[DOTV:%.*]] = select i1 [[TMP2]], i32 20, i32 -20, !prof ![[$MD1:[0-9]+]]
-; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[DOTV]], %0
+; CHECK-NEXT: [[TMP3:%.*]] = add nsw i32 [[DOTV]], %0
; CHECK-NEXT: ret i32 [[TMP3]]
;
%2 = icmp sgt i32 %0, 2
; We can vectorize conditional reductions with multi-input phis.
; CHECK: reduction_conditional
-; CHECK: fadd <4 x float>
+; CHECK: fadd fast <4 x float>
define float @reduction_conditional(float* %A, float* %B, float* %C, float %S) {
entry: