[PATCH] D14069: [FPEnv Core 04/14] Skip constant folding to preserve FPEnv

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 08:55:58 PDT 2015


majnemer added a subscriber: majnemer.

================
Comment at: include/llvm/IR/Constants.h:1073-1074
@@ -1073,1 +1072,4 @@
+                       unsigned Flags = 0, Type *OnlyIfReducedTy = nullptr,
+                       bool KeepExceptions = false,
+                       bool KeepRounding = false);
 
----------------
Why not accept an `FastMathFlags` instead?

================
Comment at: lib/Analysis/ValueTracking.cpp:3284-3285
@@ -3284,1 +3283,4 @@
+                                        const TargetLibraryInfo *TLI,
+                                        bool KeepExceptions,
+                                        bool KeepRounding) {
   const Operator *Inst = dyn_cast<Operator>(V);
----------------
Unless I am mistaken, could you figure out these flags from `V` itself?

================
Comment at: lib/Analysis/ValueTracking.cpp:3290
@@ -3287,1 +3289,3 @@
 
+  if (const FPMathOperator *MathOp = dyn_cast<FPMathOperator>(Inst)) {
+      KeepExceptions |= MathOp->hasKeepExceptions();
----------------
`const auto *`

================
Comment at: lib/IR/Constants.cpp:327-335
@@ -326,10 +326,11 @@
 
   // ConstantExpr traps if any operands can trap.
   for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) {
     if (ConstantExpr *Op = dyn_cast<ConstantExpr>(CE->getOperand(i))) {
-      if (NonTrappingOps.insert(Op).second && canTrapImpl(Op, NonTrappingOps))
+      if (NonTrappingOps.insert(Op).second && canTrapImpl(Op, NonTrappingOps)) {
         return true;
+      }
     }
   }
 
   // Otherwise, only specific operations can trap.
----------------
Why was this changed?


Repository:
  rL LLVM

http://reviews.llvm.org/D14069





More information about the llvm-commits mailing list