Author: Igor Kudrin
Date: 2026-01-30T12:01:45-08:00
New Revision: 21a74f527839b5b8dd882e62a25093d980c79078

URL: 
https://github.com/llvm/llvm-project/commit/21a74f527839b5b8dd882e62a25093d980c79078
DIFF: 
https://github.com/llvm/llvm-project/commit/21a74f527839b5b8dd882e62a25093d980c79078.diff

LOG: Revert "[lldb] Add FP conversion instructions to IR interpreter (#175292)"

This reverts commit c2082a65b7fc8e7587ed07170e250820d6bbda1d.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/make/Makefile.rules
    lldb/source/Expression/IRInterpreter.cpp
    lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
    lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index a0d40ab868874..59d6c790d4fb6 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -156,7 +156,7 @@ ifeq "$(HOST_OS)" "Darwin"
                LDFLAGS += -fuse-ld=lld
        endif
 endif
-
+LDFLAGS += -fuse-ld=lld
 
 #----------------------------------------------------------------------
 # ARCHFLAG is the flag used to tell the compiler which architecture

diff  --git a/lldb/source/Expression/IRInterpreter.cpp 
b/lldb/source/Expression/IRInterpreter.cpp
index 5ca64843d5900..48b4dd67d2d89 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -611,8 +611,6 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, 
llvm::Function &function,
       } break;
       case Instruction::And:
       case Instruction::AShr:
-      case Instruction::FPToUI:
-      case Instruction::FPToSI:
       case Instruction::IntToPtr:
       case Instruction::PtrToInt:
       case Instruction::Load:
@@ -637,18 +635,6 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, 
llvm::Function &function,
       case Instruction::FMul:
       case Instruction::FDiv:
         break;
-      case Instruction::UIToFP:
-      case Instruction::SIToFP:
-      case Instruction::FPTrunc:
-      case Instruction::FPExt:
-        if (!ii.getType()->isFloatTy() && !ii.getType()->isDoubleTy()) {
-          LLDB_LOGF(log, "Unsupported instruction: %s",
-                    PrintValue(&ii).c_str());
-          error =
-              lldb_private::Status::FromErrorString(unsupported_opcode_error);
-          return false;
-        }
-        break;
       }
 
       for (unsigned oi = 0, oe = ii.getNumOperands(); oi != oe; ++oi) {
@@ -1271,78 +1257,6 @@ bool IRInterpreter::Interpret(llvm::Module &module, 
llvm::Function &function,
         LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
       }
     } break;
-    case Instruction::FPToUI:
-    case Instruction::FPToSI: {
-      Value *src_operand = inst->getOperand(0);
-
-      lldb_private::Scalar S;
-      if (!frame.EvaluateValue(S, src_operand, module)) {
-        LLDB_LOGF(log, "Couldn't evaluate %s", 
PrintValue(src_operand).c_str());
-        error = lldb_private::Status::FromErrorString(bad_value_error);
-        return false;
-      }
-
-      assert(inst->getType()->isIntegerTy() && "Unexpected target type");
-      llvm::APSInt result(inst->getType()->getIntegerBitWidth(),
-                          /*isUnsigned=*/inst->getOpcode() ==
-                              Instruction::FPToUI);
-      assert(S.GetType() == lldb_private::Scalar::e_float &&
-             "Unexpected source type");
-      bool isExact;
-      llvm::APFloatBase::opStatus status = S.GetAPFloat().convertToInteger(
-          result, llvm::APFloat::rmTowardZero, &isExact);
-      // Casting floating point values that are out of bounds of the target 
type
-      // is undefined behaviour.
-      if (status & llvm::APFloatBase::opInvalidOp) {
-        std::string s;
-        raw_string_ostream rso(s);
-        rso << "Conversion error: " << S << " cannot be converted to ";
-        if (inst->getOpcode() == Instruction::FPToUI)
-          rso << "unsigned ";
-        rso << *inst->getType();
-        LLDB_LOGF(log, "%s", s.c_str());
-        error = lldb_private::Status::FromErrorString(s.c_str());
-        return false;
-      }
-      lldb_private::Scalar R(result);
-
-      frame.AssignValue(inst, R, module);
-      if (log) {
-        LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
-        LLDB_LOGF(log, "  Src : %s", 
frame.SummarizeValue(src_operand).c_str());
-        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
-      }
-    } break;
-    case Instruction::UIToFP:
-    case Instruction::SIToFP:
-    case Instruction::FPTrunc:
-    case Instruction::FPExt: {
-      Value *src_operand = inst->getOperand(0);
-
-      lldb_private::Scalar S;
-      if (!frame.EvaluateValue(S, src_operand, module)) {
-        LLDB_LOGF(log, "Couldn't evaluate %s", 
PrintValue(src_operand).c_str());
-        error = lldb_private::Status::FromErrorString(bad_value_error);
-        return false;
-      }
-      lldb_private::Scalar R;
-
-      Type *result_type = inst->getType();
-      assert(
-          (result_type->isFloatTy() || result_type->isDoubleTy()) &&
-          "Unsupported result type; CanInterpret() should have checked that");
-      if (result_type->isFloatTy())
-        R = S.Float();
-      else
-        R = S.Double();
-
-      frame.AssignValue(inst, R, module);
-      if (log) {
-        LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
-        LLDB_LOGF(log, "  Src : %s", 
frame.SummarizeValue(src_operand).c_str());
-        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
-      }
-    } break;
     case Instruction::Load: {
       const LoadInst *load_inst = cast<LoadInst>(inst);
 

diff  --git 
a/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py 
b/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
index 88bc29c8f7de8..23188ef898d56 100644
--- a/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
+++ b/lldb/test/API/commands/expression/ir-interpreter/TestIRInterpreter.py
@@ -172,105 +172,3 @@ def test_type_conversions(self):
         self.assertEqual(short_val.GetValueAsSigned(), -1)
         long_val = target.EvaluateExpression("(long) " + short_val.GetName())
         self.assertEqual(long_val.GetValueAsSigned(), -1)
-
-    def test_fpconv(self):
-        self.build_and_run()
-
-        interp_options = lldb.SBExpressionOptions()
-        interp_options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
-        interp_options.SetAllowJIT(False)
-
-        jit_options = lldb.SBExpressionOptions()
-        jit_options.SetLanguage(lldb.eLanguageTypeC_plus_plus)
-        jit_options.SetAllowJIT(True)
-
-        set_up_expressions = [
-            "int $i = 3",
-            "int $n = -3",
-            "unsigned $u = 5",
-            "long $l = -7",
-            "float $f = 9.0625",
-            "double $d = 13.75",
-            "float $nf = -11.25",
-        ]
-
-        expressions = [
-            "$i + $f",  # sitofp i32 to float
-            "$d - $n",  # sitofp i32 to double
-            "$u + $f",  # uitofp i32 to float
-            "$u + $d",  # uitofp i32 to double
-            "(int)$d",  # fptosi double to i32
-            "(int)$f",  # fptosi float to i32
-            "(long)$d",  # fptosi double to i64
-            "(short)$f",  # fptosi float to i16
-            "(long)$nf",  # fptosi float to i64
-            "(unsigned short)$f",  # fptoui float to i16
-            "(unsigned)$d",  # fptoui double to i32
-            "(unsigned long)$d",  # fptoui double to i64
-            "(float)$d",  # fptrunc double to float
-            "(double)$f",  # fpext float to double
-            "(double)$nf",  # fpext float to double
-        ]
-
-        for expression in set_up_expressions:
-            self.frame().EvaluateExpression(expression, interp_options)
-
-        func_call = "(int)getpid()"
-        if lldbplatformutil.getPlatform() == "windows":
-            func_call = "(int)GetCurrentProcessId()"
-
-        for expression in expressions:
-            interp_expression = expression
-            # Calling a function forces the expression to be executed with JIT.
-            jit_expression = func_call + "; " + expression
-
-            interp_result = self.frame().EvaluateExpression(
-                interp_expression, interp_options
-            )
-            jit_result = self.frame().EvaluateExpression(jit_expression, 
jit_options)
-
-            self.assertEqual(
-                interp_result.GetValue(),
-                jit_result.GetValue(),
-                "Values match for " + expression,
-            )
-            self.assertEqual(
-                interp_result.GetTypeName(),
-                jit_result.GetTypeName(),
-                "Types match for " + expression,
-            )
-
-    def test_fpconv_ub(self):
-        target = self.dbg.GetDummyTarget()
-
-        set_up_expressions = [
-            "float $f = 3e9",
-            "double $d = 1e20",
-            "float $nf = -1.5",
-        ]
-
-        expressions = [
-            ("(int)$f", "Conversion error: (float) 3.0E+9 cannot be converted 
to i32"),
-            (
-                "(long)$d",
-                "Conversion error: (float) 1.0E+20 cannot be converted to i64",
-            ),
-            (
-                "(unsigned)$nf",
-                "Conversion error: (float) -1.5 cannot be converted to 
unsigned i32",
-            ),
-        ]
-
-        for expression in set_up_expressions:
-            target.EvaluateExpression(expression)
-
-        # The IR Interpreter returns an error if a value cannot be converted.
-        for expression in expressions:
-            result = target.EvaluateExpression(expression[0])
-            self.assertIn(expression[1], str(result.GetError()))
-
-        # The conversion should succeed if the destination type can represent 
the result.
-        self.expect_expr(
-            "(unsigned)$f", result_type="unsigned int", 
result_value="3000000000"
-        )
-        self.expect_expr("(int)$nf", result_type="int", result_value="-1")

diff  --git a/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py 
b/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
index 0b63e15e876d6..ff63141b41633 100644
--- a/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
+++ b/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
@@ -8,7 +8,7 @@
 
 
 class PlatformProcessCrashInfoTestCase(TestBase):
-    @expectedFailureAll(oslist=["windows", "linux", "freebsd", "netbsd"])
+    #@expectedFailureAll(oslist=["windows", "linux", "freebsd", "netbsd"])
     @skipIfDarwin  # rdar://120795095
     def test_thread_local(self):
         # Set a breakpoint on the first instruction of the main function,


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to