[llvm] 7f76837 - Fix build error: [FPEnv][EarlyCSE] Support for CSE when exception behavior is "ignore" or "maytrap" and the rounding mode is known.

Kevin P. Neal via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 05:48:01 PDT 2022


Author: Kevin P. Neal
Date: 2022-08-16T08:47:36-04:00
New Revision: 7f768371a12d121731832b80bc9bef6c2e47e43f

URL: https://github.com/llvm/llvm-project/commit/7f768371a12d121731832b80bc9bef6c2e47e43f
DIFF: https://github.com/llvm/llvm-project/commit/7f768371a12d121731832b80bc9bef6c2e47e43f.diff

LOG: Fix build error: [FPEnv][EarlyCSE] Support for CSE when exception behavior is "ignore" or "maytrap" and the rounding mode is known.

This should fix these build bot errors:

Step 6 (build-check-mlir-build-only) failure: build (failure)
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Transforms\Scalar\EarlyCSE.cpp(124): error C2220: the following warning is treated as an error
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Transforms\Scalar\EarlyCSE.cpp(124): warning C4996: 'llvm::Optional<llvm::fp::ExceptionBehavior>::getValue': Use value instead.
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Transforms\Scalar\EarlyCSE.cpp(129): warning C4996: 'llvm::Optional<llvm::RoundingMode>::getValue': Use value instead.
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Transforms\Scalar\EarlyCSE.cpp(1386): warning C4996: 'llvm::Optional<llvm::fp::ExceptionBehavior>::getValue': Use value instead.
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Transforms\Scalar\EarlyCSE.cpp(1388): warning C4996: 'llvm::Optional<llvm::RoundingMode>::getValue': Use value instead.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
index 709ff7287b37..abc1ded4025b 100644
--- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -121,12 +121,12 @@ struct SimpleValue {
         case Intrinsic::experimental_constrained_fcmps: {
           auto *CFP = cast<ConstrainedFPIntrinsic>(CI);
           if (CFP->getExceptionBehavior() &&
-              CFP->getExceptionBehavior().getValue() == fp::ebStrict)
+              CFP->getExceptionBehavior() == fp::ebStrict)
             return false;
           // Since we CSE across function calls we must not allow
           // the rounding mode to change.
           if (CFP->getRoundingMode() &&
-              CFP->getRoundingMode().getValue() == RoundingMode::Dynamic)
+              CFP->getRoundingMode() == RoundingMode::Dynamic)
             return false;
           return true;
         }
@@ -1383,10 +1383,10 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
     // If this is a simple instruction that we can value number, process it.
     if (SimpleValue::canHandle(&Inst)) {
       if (auto *CI = dyn_cast<ConstrainedFPIntrinsic>(&Inst)) {
-        assert(CI->getExceptionBehavior().getValue() != fp::ebStrict &&
+        assert(CI->getExceptionBehavior() != fp::ebStrict &&
                "Unexpected ebStrict from SimpleValue::canHandle()");
         assert((!CI->getRoundingMode() ||
-                CI->getRoundingMode().getValue() != RoundingMode::Dynamic) &&
+                CI->getRoundingMode() != RoundingMode::Dynamic) &&
                "Unexpected dynamic rounding from SimpleValue::canHandle()");
       }
       // See if the instruction has an available value.  If so, use it.


        


More information about the llvm-commits mailing list