[PATCH] D116952: [ConstantFolding] Respect denormal handling mode attributes when folding instructions

David Candler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 01:56:34 PDT 2022


dcandler marked 3 inline comments as done.
dcandler added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:612
+      case Instruction::FRem:
+        if (Q.CxtI != nullptr)
+          return ConstantFoldFPInstOperands(Opcode, CLHS, CRHS, Q.DL, Q.CxtI);
----------------
efriedma wrote:
> Maybe we should just return early if CxtI is null, instead of falling back to ConstantFoldBinaryOpOperands?
Returning early here would change the result for existing cases where there is no instruction pointer, so constant expressions won't get folded where they would before.


================
Comment at: llvm/test/Transforms/InstCombine/AArch64/constant-fold-fp-denormal.ll:4
+target triple = "aarch64--linux-gnu"
+
+define float @test_float() #0 {
----------------
arsenm wrote:
> Would it be helpful to have some constantexpr cases in a global initializer?
I don't think it's necessary to test those if they aren't going to be affected by setting the function attribute.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116952/new/

https://reviews.llvm.org/D116952



More information about the llvm-commits mailing list