[Lldb-commits] [lldb] r318664 - [Expression parser] Remove logging of field that is no longer in clang's TargetOptions struct.

2018-07-06 Thread Craig Topper via lldb-commits
Author: ctopper
Date: Mon Nov 20 09:24:47 2017
New Revision: 318664

URL: http://llvm.org/viewvc/llvm-project?rev=318664&view=rev
Log:
[Expression parser] Remove logging of field that is no longer in clang's 
TargetOptions struct.

The Reciprocals field was moved to CodeGenOptions. I don't think lldb was 
really using this field so I'm just removing the mention.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=318664&r1=318663&r2=318664&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Mon Nov 20 09:24:47 2017
@@ -350,7 +350,6 @@ ClangExpressionParser::ClangExpressionPa
   LLDB_LOGV(log, "LinkerVersion: '{0}'", opts.LinkerVersion);
   StringList::LogDump(log, opts.FeaturesAsWritten, "FeaturesAsWritten");
   StringList::LogDump(log, opts.Features, "Features");
-  StringList::LogDump(log, opts.Reciprocals, "Reciprocals");
 }
 
   // 4. Create and install the target on the compiler.


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r256407 - Include IR/DerivedTypes.h instead of IR/Type.h so to match llvm change r256406.

2015-12-25 Thread Craig Topper via lldb-commits
Author: ctopper
Date: Thu Dec 24 23:18:31 2015
New Revision: 256407

URL: http://llvm.org/viewvc/llvm-project?rev=256407&view=rev
Log:
Include IR/DerivedTypes.h instead of IR/Type.h so to match llvm change r256406.

Modified:
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp?rev=256407&r1=256406&r2=256407&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp Thu Dec 24 
23:18:31 2015
@@ -29,7 +29,7 @@
 
 #include "llvm/ADT/Triple.h"
 
-#include "llvm/IR/Type.h"
+#include "llvm/IR/DerivedTypes.h"
 
 using namespace lldb;
 using namespace lldb_private;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [llvm] [llvm][TargetParser] Return StringMap from getHostCPUFeatures (PR #97824)

2024-07-10 Thread Craig Topper via lldb-commits


@@ -20,16 +20,15 @@ using namespace llvm;
 int main(int argc, char **argv) {
 #if defined(__i386__) || defined(_M_IX86) || \
 defined(__x86_64__) || defined(_M_X64)
-  StringMap features;
-
-  if (!sys::getHostCPUFeatures(features))
+  const StringMap features = sys::getHostCPUFeatures(features);
+  if (features.empty())
 return 1;
 
-  if (features["sse"])
+  if (features->lookup("sse"))

topperc wrote:

Why does this need `->` instead of `.`?

https://github.com/llvm/llvm-project/pull/97824
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 142f270 - Recommit "[AST] Use APIntStorage to fix memory leak in EnumConstantDecl. (#78311)"

2024-01-16 Thread Craig Topper via lldb-commits

Author: Craig Topper
Date: 2024-01-16T13:52:17-08:00
New Revision: 142f270c279f2576e4618fc0d1121181c7531fdf

URL: 
https://github.com/llvm/llvm-project/commit/142f270c279f2576e4618fc0d1121181c7531fdf
DIFF: 
https://github.com/llvm/llvm-project/commit/142f270c279f2576e4618fc0d1121181c7531fdf.diff

LOG: Recommit "[AST] Use APIntStorage to fix memory leak in EnumConstantDecl. 
(#78311)"

With lldb build fix.

Original message:

EnumConstantDecl is allocated by the ASTContext allocator so the
destructor is never called.

This patch takes a similar approach to IntegerLiteral by using
APIntStorage to allocate large APSInts using the ASTContext allocator as
well.

The downside is that an additional heap allocation and copy of the data
needs to be made when calling getInitValue if the APSInt is large.

Fixes #78160.

Added: 
clang/include/clang/AST/APNumericStorage.h

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/Decl.h
clang/include/clang/AST/Expr.h
clang/lib/AST/Decl.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6e31849ce16dd4..6c968c628dc14a 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -675,6 +675,8 @@ Bug Fixes in This Version
   Fixes (`#67317 `_)
 - Clang now properly diagnoses use of stand-alone OpenMP directives after a
   label (including ``case`` or ``default`` labels).
+- Fix compiler memory leak for enums with underlying type larger than 64 bits.
+  Fixes (`#78311 `_)
 
   Before:
 

diff  --git a/clang/include/clang/AST/APNumericStorage.h 
b/clang/include/clang/AST/APNumericStorage.h
new file mode 100644
index 00..95eddbcd86e839
--- /dev/null
+++ b/clang/include/clang/AST/APNumericStorage.h
@@ -0,0 +1,71 @@
+//===--- APNumericStorage.h - Store APInt/APFloat in ASTContext -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_CLANG_AST_APNUMERICSTORAGE_H
+#define LLVM_CLANG_AST_APNUMERICSTORAGE_H
+
+#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/APInt.h"
+
+namespace clang {
+class ASTContext;
+
+/// Used by IntegerLiteral/FloatingLiteral/EnumConstantDecl to store the
+/// numeric without leaking memory.
+///
+/// For large floats/integers, APFloat/APInt will allocate memory from the heap
+/// to represent these numbers.  Unfortunately, when we use a BumpPtrAllocator
+/// to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with
+/// the APFloat/APInt values will never get freed. APNumericStorage uses
+/// ASTContext's allocator for memory allocation.
+class APNumericStorage {
+  union {
+uint64_t VAL;   ///< Used to store the <= 64 bits integer value.
+uint64_t *pVal; ///< Used to store the >64 bits integer value.
+  };
+  unsigned BitWidth;
+
+  bool hasAllocation() const { return llvm::APInt::getNumWords(BitWidth) > 1; }
+
+  APNumericStorage(const APNumericStorage &) = delete;
+  void operator=(const APNumericStorage &) = delete;
+
+protected:
+  APNumericStorage() : VAL(0), BitWidth(0) {}
+
+  llvm::APInt getIntValue() const {
+unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
+if (NumWords > 1)
+  return llvm::APInt(BitWidth, NumWords, pVal);
+else
+  return llvm::APInt(BitWidth, VAL);
+  }
+  void setIntValue(const ASTContext &C, const llvm::APInt &Val);
+};
+
+class APIntStorage : private APNumericStorage {
+public:
+  llvm::APInt getValue() const { return getIntValue(); }
+  void setValue(const ASTContext &C, const llvm::APInt &Val) {
+setIntValue(C, Val);
+  }
+};
+
+class APFloatStorage : private APNumericStorage {
+public:
+  llvm::APFloat getValue(const llvm::fltSemantics &Semantics) const {
+return llvm::APFloat(Semantics, getIntValue());
+  }
+  void setValue(const ASTContext &C, const llvm::APFloat &Val) {
+setIntValue(C, Val.bitcastToAPInt());
+  }
+};
+
+} // end namespace clang
+
+#endif // LLVM_CLANG_AST_APNUMERICSTORAGE_H

diff  --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index a807bcdd76b30d..98af552d400f3a 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_CLANG_AST_DECL_H
 #define LLVM_CLANG_AST_DECL_H
 
+#include "clang/AST/APNumericStorage.h"
 #include "clang/AST/APValue.h"
 #include "clang/AST/ASTContextAllocate.h"
 #include "clang/AST/DeclAccessPair.h"
@@ -3251,15 +325

[Lldb-commits] [lldb] 6006d43 - LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2023-05-24 Thread Craig Topper via lldb-commits

Author: Craig Topper
Date: 2023-05-24T12:40:10-07:00
New Revision: 6006d43e2d7dda56844f1c3867baa981cfefb8ea

URL: 
https://github.com/llvm/llvm-project/commit/6006d43e2d7dda56844f1c3867baa981cfefb8ea
DIFF: 
https://github.com/llvm/llvm-project/commit/6006d43e2d7dda56844f1c3867baa981cfefb8ea.diff

LOG: LLVM_FALLTHROUGH => [[fallthrough]]. NFC

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D150996

Added: 


Modified: 
clang/lib/AST/TemplateBase.cpp
clang/lib/Basic/SourceManager.cpp
clang/lib/Sema/SemaChecking.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
llvm/lib/Analysis/MemoryLocation.cpp
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.h
llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 




diff  --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index c21e9c861875..c46b3e3d0c50 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -327,7 +327,7 @@ void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
 
   case TemplateExpansion:
 ID.AddInteger(TemplateArg.NumExpansions);
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case Template:
 ID.AddPointer(TemplateArg.Name);
 break;

diff  --git a/clang/lib/Basic/SourceManager.cpp 
b/clang/lib/Basic/SourceManager.cpp
index f4ddae17f578..6fa802a33a50 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -1312,7 +1312,7 @@ LineOffsetMapping 
LineOffsetMapping::get(llvm::MemoryBufferRef Buffer,
 if (*Buf == '\n') {
   ++Buf;
 }
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case '\n':
 LineOffsets.push_back(Buf - Start);
   };

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6c2cbc60a81d..c02f4f5a5269 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3792,7 +3792,7 @@ bool Sema::CheckLoongArchBuiltinFunctionCall(const 
TargetInfo &TI,
   return Diag(TheCall->getBeginLoc(),
   diag::err_loongarch_builtin_requires_la64)
  << TheCall->getSourceRange();
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case LoongArch::BI__builtin_loongarch_cacop_w: {
 if (BuiltinID == LoongArch::BI__builtin_loongarch_cacop_w &&
 !TI.hasFeature("32bit"))

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 8d8af21e1994..7b74129f848e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -511,14 +511,14 @@ ClangExpressionParser::ClangExpressionParser(
 break;
   case lldb::eLanguageTypeC_plus_plus_20:
 lang_opts.CPlusPlus20 = true;
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case lldb::eLanguageTypeC_plus_plus_17:
 // FIXME: add a separate case for CPlusPlus14. Currently folded into C++17
 // because C++14 is the default standard for Clang but enabling CPlusPlus14
 // expression evaluatino doesn't pass the test-suite cleanly.
 lang_opts.CPlusPlus14 = true;
 lang_opts.CPlusPlus17 = true;
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case lldb::eLanguageTypeC_plus_plus:
   case lldb::eLanguageTypeC_plus_plus_11:
   case lldb::eLanguageTypeC_plus_plus_14:

diff  --git a/llvm/lib/Analysis/MemoryLocation.cpp 
b/llvm/lib/Analysis/MemoryLocation.cpp
index e839f9e0dfb2..0404b32be848 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -257,7 +257,7 @@ MemoryLocation MemoryLocation::getForArgument(const 
CallBase *Call,
 
 case LibFunc_memset_chk:
   assert(ArgIdx == 0 && "Invalid argument index for memset_chk");
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case LibFunc_memcpy_chk: {
   assert((ArgIdx == 0 || ArgIdx == 1) &&
  "Invalid argument index for memcpy_chk");

diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp 
b/llvm/lib/Analysis/ScalarEvolution.cpp
index 2ad787053f83..a700eaedd6c7 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -15325,7 +15325,7 @@ const SCEV *ScalarEvolution::applyLoopGuards(const SCEV 
*Expr, const Loop *L) {
 if (RHS->getType()->isPointerTy())
   return;
 RHS = getUMaxExpr(RHS, One);
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case CmpInst::ICM

[Lldb-commits] [lldb] [RISCV][GISel][WIP] Support passing arguments through the stack. (PR #69289)

2023-10-18 Thread Craig Topper via lldb-commits

https://github.com/topperc updated 
https://github.com/llvm/llvm-project/pull/69289

>From ceadfba61ebd4d208d1b0b07b9344841d6fd3ac4 Mon Sep 17 00:00:00 2001
From: Craig Topper 
Date: Mon, 16 Oct 2023 22:34:53 -0700
Subject: [PATCH] [RISCV][GISel][WIP] Support passing arguments through the
 stack.

This is needed when we run out of registers.

Still need to add tests.
---
 .../Target/RISCV/GISel/RISCVCallLowering.cpp  | 58 ---
 1 file changed, 49 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp 
b/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
index a362a709329d5df..215aa938e5dc484 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp
@@ -17,6 +17,7 @@
 #include "RISCVSubtarget.h"
 #include "llvm/CodeGen/Analysis.h"
 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
 
 using namespace llvm;
 
@@ -56,19 +57,38 @@ struct RISCVOutgoingValueAssigner : public 
CallLowering::OutgoingValueAssigner {
 struct RISCVOutgoingValueHandler : public CallLowering::OutgoingValueHandler {
   RISCVOutgoingValueHandler(MachineIRBuilder &B, MachineRegisterInfo &MRI,
 MachineInstrBuilder MIB)
-  : OutgoingValueHandler(B, MRI), MIB(MIB) {}
-
-  MachineInstrBuilder MIB;
-
+  : OutgoingValueHandler(B, MRI), MIB(MIB),
+Subtarget(MIRBuilder.getMF().getSubtarget()) {}
   Register getStackAddress(uint64_t MemSize, int64_t Offset,
MachinePointerInfo &MPO,
ISD::ArgFlagsTy Flags) override {
-llvm_unreachable("not implemented");
+MachineFunction &MF = MIRBuilder.getMF();
+LLT p0 = LLT::pointer(0, Subtarget.getXLen());
+LLT sXLen = LLT::scalar(Subtarget.getXLen());
+
+if (!SPReg)
+  SPReg = MIRBuilder.buildCopy(p0, Register(RISCV::X2)).getReg(0);
+
+auto OffsetReg = MIRBuilder.buildConstant(sXLen, Offset);
+
+auto AddrReg = MIRBuilder.buildPtrAdd(p0, SPReg, OffsetReg);
+
+MPO = MachinePointerInfo::getStack(MF, Offset);
+return AddrReg.getReg(0);
   }
 
   void assignValueToAddress(Register ValVReg, Register Addr, LLT MemTy,
 MachinePointerInfo &MPO, CCValAssign &VA) override 
{
-llvm_unreachable("not implemented");
+MachineFunction &MF = MIRBuilder.getMF();
+uint64_t LocMemOffset = VA.getLocMemOffset();
+
+// TODO: Move StackAlignment to subtarget and share with FrameLowering.
+auto MMO =
+MF.getMachineMemOperand(MPO, MachineMemOperand::MOStore, MemTy,
+commonAlignment(Align(16), LocMemOffset));
+
+Register ExtReg = extendRegister(ValVReg, VA);
+MIRBuilder.buildStore(ExtReg, Addr, *MMO);
   }
 
   void assignValueToReg(Register ValVReg, Register PhysReg,
@@ -77,6 +97,14 @@ struct RISCVOutgoingValueHandler : public 
CallLowering::OutgoingValueHandler {
 MIRBuilder.buildCopy(PhysReg, ExtReg);
 MIB.addUse(PhysReg, RegState::Implicit);
   }
+
+private:
+  MachineInstrBuilder MIB;
+
+  // Cache the SP register vreg if we need it more than once in this call site.
+  Register SPReg;
+
+  const RISCVSubtarget &Subtarget;
 };
 
 struct RISCVIncomingValueAssigner : public CallLowering::IncomingValueAssigner 
{
@@ -112,17 +140,26 @@ struct RISCVIncomingValueAssigner : public 
CallLowering::IncomingValueAssigner {
 
 struct RISCVIncomingValueHandler : public CallLowering::IncomingValueHandler {
   RISCVIncomingValueHandler(MachineIRBuilder &B, MachineRegisterInfo &MRI)
-  : IncomingValueHandler(B, MRI) {}
+  : IncomingValueHandler(B, MRI),
+Subtarget(MIRBuilder.getMF().getSubtarget()) {}
 
   Register getStackAddress(uint64_t MemSize, int64_t Offset,
MachinePointerInfo &MPO,
ISD::ArgFlagsTy Flags) override {
-llvm_unreachable("not implemented");
+MachineFrameInfo &MFI = MIRBuilder.getMF().getFrameInfo();
+
+int FI = MFI.CreateFixedObject(MemSize, Offset, /*Immutable=*/true);
+MPO = MachinePointerInfo::getFixedStack(MIRBuilder.getMF(), FI);
+return MIRBuilder.buildFrameIndex(LLT::pointer(0, Subtarget.getXLen()), FI)
+.getReg(0);
   }
 
   void assignValueToAddress(Register ValVReg, Register Addr, LLT MemTy,
 MachinePointerInfo &MPO, CCValAssign &VA) override 
{
-llvm_unreachable("not implemented");
+MachineFunction &MF = MIRBuilder.getMF();
+auto MMO = MF.getMachineMemOperand(MPO, MachineMemOperand::MOLoad, MemTy,
+   inferAlignFromPtrInfo(MF, MPO));
+MIRBuilder.buildLoad(ValVReg, Addr, *MMO);
   }
 
   void assignValueToReg(Register ValVReg, Register PhysReg,
@@ -131,6 +168,9 @@ struct RISCVIncomingValueHandler : public 
CallLowering::IncomingValueHandler {
 MIRBuilder.getMBB().addLiveIn(PhysReg);
 MIRBuilder.buildCopy(ValVReg, PhysReg);
   }
+
+private:

[Lldb-commits] [lldb] a58b62b - [IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().

2020-04-27 Thread Craig Topper via lldb-commits

Author: Craig Topper
Date: 2020-04-27T22:17:03-07:00
New Revision: a58b62b4a2b96c31b49338b262b609db746449e8

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

LOG: [IR] Replace all uses of CallBase::getCalledValue() with 
getCalledOperand().

This method has been commented as deprecated for a while. Remove
it and replace all uses with the equivalent getCalledOperand().

I also made a few cleanups in here. For example, to removes use
of getElementType on a pointer when we could just use getFunctionType
from the call.

Differential Revision: https://reviews.llvm.org/D78882

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
lldb/source/Expression/IRInterpreter.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
llvm/include/llvm-c/Core.h
llvm/include/llvm/CodeGen/FastISel.h
llvm/include/llvm/IR/AbstractCallSite.h
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Analysis/Lint.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/lib/Analysis/StackSafetyAnalysis.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/CodeGen/WasmEHPrepare.cpp
llvm/lib/CodeGen/WinEHPrepare.cpp
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64PromoteConstant.cpp
llvm/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp
llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/ARM/ARMFastISel.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86WinEHState.cpp
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/lib/Transforms/IPO/CalledValuePropagation.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/IPO/PruneEH.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
llvm/lib/Transforms/Utils/Evaluator.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/LowerInvoke.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/LTO/X86/type-mapping-bug3.ll
llvm/tools/llvm-diff/DiffConsumer.cpp
llvm/tools/llvm-diff/DifferenceEngine.cpp
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index b3fda6bd4ea3..e0e895f202c2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2701,10 +2701,10 @@ static llvm::Value 
*tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF,
 
   bool doRetainAutorelease;
 
-  if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints().objc_retain) {
+  if (call->getCalledOperand() == CGF.CGM.getObjCEntrypoints().objc_retain) {
 doRetainAutorelease = true;
-  } else if (call->getCalledValue() == CGF.CGM.getObjCEntrypoints()
-  .objc_retainAutoreleasedReturnValue) 
{
+  } else if (call->getCalledOperand() ==
+ CGF.CGM.getObjCEntrypoints().objc_re

[Lldb-commits] [lldb] [llvm] [lldb][RISCV] function calls support in lldb expressions (PR #99336)

2024-09-17 Thread Craig Topper via lldb-commits

topperc wrote:

> I read through the patch again cleanly, and I don't have any problems with 
> the PR at this point. The only thing I would note is that in 
> `GetClangTargetABI` we're constructing a string which indicates which ISA 
> extensions are enabled (that are relevant here) to return a string like 
> `lp64f`, which is then used in `SetupTargetOpts` to add the feature flags 
> that should be enabled for clang. We are doing the exact same thing in 
> `DisassemblerLLVMC::DisassemblerLLVMC`,
> 
> ```
>   if (triple.isRISCV()) {
> uint32_t arch_flags = arch.GetFlags();
> if (arch_flags & ArchSpec::eRISCV_rvc)
>   features_str += "+c,";
> if (arch_flags & ArchSpec::eRISCV_rve)
>   features_str += "+e,";
> if ((arch_flags & ArchSpec::eRISCV_float_abi_single) ==
> ArchSpec::eRISCV_float_abi_single)
>   features_str += "+f,";
> if ((arch_flags & ArchSpec::eRISCV_float_abi_double) ==
> ArchSpec::eRISCV_float_abi_double)
>   features_str += "+f,+d,";
> ```
> 
> etc. It's a small bit of duplication, but I expect these will be at risk of 
> diverging if done separately. I wonder if our ArchSpec should have a method 
> to get the clang feature flags.

That code doesn't look right. Shouldn't it be using eRISCV_float_abi_mask. It's 
treat each single and double as bit positions, but they are really encodings in 
2-bit field.

```
 if ((arch_flags & ArchSpec::eRISCV_float_abi_mask) ==
 ArchSpec::eRISCV_float_abi_single)
   features_str += "+f,";
 if ((arch_flags & ArchSpec::eRISCV_float_abi_mask) ==
 ArchSpec::eRISCV_float_abi_double)
   features_str += "+f,+d,";
```

https://github.com/llvm/llvm-project/pull/99336
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Add RISC-V CPU type and CPU subtype to llvm & lldb (PR #136785)

2025-04-22 Thread Craig Topper via lldb-commits


@@ -353,6 +353,8 @@ static const ArchDefinitionEntry g_macho_arch_entries[] = {
 {ArchSpec::eCore_x86_64_x86_64,   llvm::MachO::CPU_TYPE_X86_64, 
llvm::MachO::CPU_SUBTYPE_X86_ARCH1, UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_x86_64_x86_64h,  llvm::MachO::CPU_TYPE_X86_64, 
llvm::MachO::CPU_SUBTYPE_X86_64_H,  UINT32_MAX, SUBTYPE_MASK},
 {ArchSpec::eCore_x86_64_x86_64,   llvm::MachO::CPU_TYPE_X86_64, 
CPU_ANY, UINT32_MAX, UINT32_MAX},
+{ArchSpec::eCore_riscv32, llvm::MachO::CPU_TYPE_RISCV,  
llvm::MachO::CPU_SUBTYPE_RISCV_ALL, UINT32_MAX, SUBTYPE_MASK},

topperc wrote:

I don't know this stuff works. Do we need riscv64 too or is it shared?

https://github.com/llvm/llvm-project/pull/136785
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits