Skip to content

Commit e6fa09f

Browse files
[SCCP] Add context to SimplifyQuery (#100831)
1 parent 77655f4 commit e6fa09f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

llvm/lib/Transforms/Utils/SCCPSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ void SCCPInstVisitor::visitBinaryOperator(Instruction &I) {
15031503
Value *V2 = SCCPSolver::isConstant(V2State)
15041504
? getConstant(V2State, I.getOperand(1)->getType())
15051505
: I.getOperand(1);
1506-
Value *R = simplifyBinOp(I.getOpcode(), V1, V2, SimplifyQuery(DL));
1506+
Value *R = simplifyBinOp(I.getOpcode(), V1, V2, SimplifyQuery(DL, &I));
15071507
auto *C = dyn_cast_or_null<Constant>(R);
15081508
if (C) {
15091509
// Conservatively assume that the result may be based on operands that may
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -passes=sccp -S %s | FileCheck %s
3+
4+
define float @test_ieee() #0 {
5+
; CHECK-LABEL: @test_ieee(
6+
; CHECK-NEXT: ret float 0x36F4000000000000
7+
;
8+
%1 = fmul float 2.802596928649634e-44, 2.000000e+00
9+
ret float %1
10+
}
11+
12+
define float @test_preserve_sign() #1 {
13+
; CHECK-LABEL: @test_preserve_sign(
14+
; CHECK-NEXT: ret float 0.000000e+00
15+
;
16+
%1 = fmul float 2.802596928649634e-44, 2.000000e+00
17+
ret float %1
18+
}
19+
20+
attributes #0 = {"denormal-fp-math"="ieee,ieee"}
21+
attributes #1 = {"denormal-fp-math"="preserve-sign,preserve-sign"}

0 commit comments

Comments
 (0)