Skip to content

Commit 3988a62

Browse files
committed
Pass through constantexprs
1 parent 55897eb commit 3988a62

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ Constant *llvm::FlushFPConstant(Constant *Operand, const Instruction *Inst,
13461346
if (ConstantFP *CFP = dyn_cast<ConstantFP>(Operand))
13471347
return flushDenormalConstantFP(CFP, Inst, IsOutput);
13481348

1349-
if (isa<ConstantAggregateZero, UndefValue>(Operand))
1349+
if (isa<ConstantAggregateZero, UndefValue, ConstantExpr>(Operand))
13501350
return Operand;
13511351

13521352
Type *Ty = Operand->getType();

llvm/test/Transforms/InstSimplify/ConstProp/bitcast.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,15 @@ define i1 @fcmp_constexpr_une(float %conv) {
6666

6767
define i1 @fcmp_constexpr_ueq(float %conv) {
6868
; CHECK-LABEL: @fcmp_constexpr_ueq(
69-
; CHECK-NEXT: [[CMP:%.*]] = fcmp ueq float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
70-
; CHECK-NEXT: ret i1 [[CMP]]
69+
; CHECK-NEXT: ret i1 true
7170
;
7271
%cmp = fcmp ueq float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
7372
ret i1 %cmp
7473
}
7574

7675
define i1 @fcmp_constexpr_one(float %conv) {
7776
; CHECK-LABEL: @fcmp_constexpr_one(
78-
; CHECK-NEXT: [[CMP:%.*]] = fcmp one float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
79-
; CHECK-NEXT: ret i1 [[CMP]]
77+
; CHECK-NEXT: ret i1 false
8078
;
8179
%cmp = fcmp one float bitcast (i32 ptrtoint (ptr @a to i32) to float), bitcast (i32 ptrtoint (ptr @a to i32) to float)
8280
ret i1 %cmp

0 commit comments

Comments
 (0)