auto *TC = dyn_cast<Constant>(True);
auto *FC = dyn_cast<Constant>(False);
if (CC && TC && FC)
- return Fold(ConstantExpr::getSelect(CC, TC, FC));
+ return ConstantFoldSelectInstruction(CC, TC, FC);
return nullptr;
}
auto *TC = dyn_cast<Constant>(True);
auto *FC = dyn_cast<Constant>(False);
if (CC && TC && FC)
- return ConstantExpr::getSelect(CC, TC, FC);
+ return ConstantFoldSelectInstruction(CC, TC, FC);
return nullptr;
}
}
return nullptr;
case Instruction::Select:
- return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]);
+ return ConstantFoldSelectInstruction(Ops[0], Ops[1], Ops[2]);
case Instruction::ExtractElement:
return ConstantExpr::getExtractElement(Ops[0], Ops[1]);
case Instruction::ExtractValue:
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[WHICH:%.*]], label [[FINAL:%.*]], label [[DELAY:%.*]]
; CHECK: delay:
+; CHECK-NEXT: [[TMP0:%.*]] = select i1 icmp eq (ptr @A, ptr @B), i32 2, i32 1
; CHECK-NEXT: br label [[FINAL]]
; CHECK: final:
-; CHECK-NEXT: [[USE2:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ select (i1 icmp eq (ptr @A, ptr @B), i32 2, i32 1), [[DELAY]] ]
+; CHECK-NEXT: [[USE2:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ [[TMP0]], [[DELAY]] ]
; CHECK-NEXT: ret i32 [[USE2]]
;
entry:
; CHECK: else:
; CHECK-NEXT: [[V3:%.*]] = mul i32 [[V]], 3
; CHECK-NEXT: [[V5:%.*]] = lshr i32 [[V]], 1
-; CHECK-NEXT: [[PHI_SEL:%.*]] = select i1 [[C2:%.*]], i32 [[V3]], i32 [[V5]]
+; CHECK-NEXT: [[TMP0:%.*]] = select i1 [[C2:%.*]], i32 [[V3]], i32 [[V5]]
; CHECK-NEXT: br label [[JOIN]]
; CHECK: join:
-; CHECK-NEXT: [[PHI1:%.*]] = phi i32 [ [[V2]], [[IF]] ], [ [[PHI_SEL]], [[ELSE]] ]
+; CHECK-NEXT: [[PHI1:%.*]] = phi i32 [ [[V2]], [[IF]] ], [ [[TMP0]], [[ELSE]] ]
; CHECK-NEXT: ret i32 [[PHI1]]
;
entry: