Skip to content

[SCCP] Add context to SimplifyQuery #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/SCCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ void SCCPInstVisitor::visitBinaryOperator(Instruction &I) {
Value *V2 = SCCPSolver::isConstant(V2State)
? getConstant(V2State, I.getOperand(1)->getType())
: I.getOperand(1);
Value *R = simplifyBinOp(I.getOpcode(), V1, V2, SimplifyQuery(DL));
Value *R = simplifyBinOp(I.getOpcode(), V1, V2, SimplifyQuery(DL, &I));
auto *C = dyn_cast_or_null<Constant>(R);
if (C) {
// Conservatively assume that the result may be based on operands that may
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/Transforms/SCCP/float-denormal-simplification.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=sccp -S %s | FileCheck %s

define float @test_ieee() #0 {
; CHECK-LABEL: @test_ieee(
; CHECK-NEXT: ret float 0x36F4000000000000
;
%1 = fmul float 2.802596928649634e-44, 2.000000e+00
ret float %1
}

define float @test_preserve_sign() #1 {
; CHECK-LABEL: @test_preserve_sign(
; CHECK-NEXT: ret float 0.000000e+00
;
%1 = fmul float 2.802596928649634e-44, 2.000000e+00
ret float %1
}

attributes #0 = {"denormal-fp-math"="ieee,ieee"}
attributes #1 = {"denormal-fp-math"="preserve-sign,preserve-sign"}