[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-17 Thread Youngsuk Kim via lldb-commits

https://github.com/JOE1994 requested changes to this pull request.

* The PR contains irrelevant changes to `X86` codegen.
* Author of the commit shows up as another contributor.

It seems like the author of this PR did a `git commit --amend`
on top of e586556e375fc5c4f7e76b5c299cb981f2016108 to add new changes.

Please update the branch to address these issues.

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-17 Thread Youngsuk Kim via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-14 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

That's just not how the LLVM project operates.
I'd rather deal with two conflicting PRs than deal with an assigned orphaned 
issue that the assignee lost interest in.
This is in the end a communication problem, and I don't mind if someone 
responds to the bug to say that they're working on it, so another person 
doesn't waste time duplicating the effort. But we're not going to enforce 
exclusivity on the project level.

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-13 Thread Youngsuk Kim via lldb-commits

JOE1994 wrote:

> We usually don't grant exclusive rights to work on an issue in the project, 
> since individual priorities may always change and people might loose interest 
> in an issue. Typically this kind of conflict doesn't happen very often 
> either. 

I understand that, but just for "good first issue"s,
I think it's desirable to allow 1 week to the person (likely a newcomer to the 
project) who first requested to be assigned to it
(the 1st step in the "good first issue" instructions also suggests this).

The user who initially asked to be assigned to the linked issue doesn't have 
"assign" access, and was likely waiting to get assigned. Assigning the issue to 
another user without any explanation or ping can be emotionally frustrating to 
the new user.

I've seen a similar conflict around a "good first issue" get heated in 
(`#84207`).

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-13 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

> A new user already asked to be assigned to work on #91209 2 days ago in the 
> comments. **I think that user deserves an opportunity to work on the issue**.
> 
> Next time when you see a **"good first issue"** which a new user had already 
> asked to get assigned to, please assign it to the new user.

We usually don't grant exclusive rights to work on an issue in the project, 
since individual priorities may always change and people might loose interest 
in an issue. Typically this kind of conflict doesn't happen very often either. 
For an issue as trivial as this one, it might be better to just open a PR 
straight ahead instead of waiting for the issue to be assigned to someone 
(which is also something we typically don't do in the project for the 
aforementioned reasons).

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-12 Thread Youngsuk Kim via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-12 Thread Youngsuk Kim via lldb-commits

JOE1994 wrote:

A new user already asked to be assigned to work on #91209 2 days ago in the 
comments.
**I think that user deserves an opportunity to work on the issue**.

Next time when you see a **"good first issue"** which a new user had already 
asked to get assigned to,
please assign it to the new user.

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


[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-12 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-x86

Author: None (aabhinavg)


Changes

Author: aabhinavg tiwariabhinavak@gmail.com
Date: Sun May 12 12:46:54 2024 +0800
Reviewers: @JOE1994, @chelcassanova, @dcb314

Fixes: #91209

Summary of Changes:
- Replaced the ineffective call to 'substr' with a more efficient use of 
'resize' to truncate the string.
- Adjusted the code to use 'resize' instead of 'substr' for better performance 
and readability.

---
Full diff: https://github.com/llvm/llvm-project/pull/91880.diff


3 Files Affected:

- (modified) lldb/source/Core/Debugger.cpp (+1-1) 
- (modified) llvm/lib/Target/X86/X86ISelDAGToDAG.cpp (+18-6) 
- (modified) llvm/test/CodeGen/X86/cmp.ll (+15-32) 


``diff
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9951fbcd3e7c3..70303173925e3 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -2067,7 +2067,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP 
_sp) {
   const uint32_t term_width = GetTerminalWidth();
   const uint32_t ellipsis = 3;
   if (message.size() + ellipsis >= term_width)
-message = message.substr(0, term_width - ellipsis);
+message.resize(message.size() - ellipsis);
 
   const bool use_color = GetUseColor();
   llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp 
b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 14c62893766ad..ea3b84d0ca9eb 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1560,7 +1560,9 @@ void X86DAGToDAGISel::PostprocessISelDAG() {
   SDValue And = N->getOperand(0);
   unsigned N0Opc = And.getMachineOpcode();
   if ((N0Opc == X86::AND8rr || N0Opc == X86::AND16rr ||
-   N0Opc == X86::AND32rr || N0Opc == X86::AND64rr) &&
+   N0Opc == X86::AND32rr || N0Opc == X86::AND64rr ||
+   N0Opc == X86::AND8rr_ND || N0Opc == X86::AND16rr_ND ||
+   N0Opc == X86::AND32rr_ND || N0Opc == X86::AND64rr_ND) &&
   !And->hasAnyUseOfValue(1)) {
 MachineSDNode *Test = CurDAG->getMachineNode(Opc, SDLoc(N),
  MVT::i32,
@@ -1571,15 +1573,25 @@ void X86DAGToDAGISel::PostprocessISelDAG() {
 continue;
   }
   if ((N0Opc == X86::AND8rm || N0Opc == X86::AND16rm ||
-   N0Opc == X86::AND32rm || N0Opc == X86::AND64rm) &&
+   N0Opc == X86::AND32rm || N0Opc == X86::AND64rm ||
+   N0Opc == X86::AND8rm_ND || N0Opc == X86::AND16rm_ND ||
+   N0Opc == X86::AND32rm_ND || N0Opc == X86::AND64rm_ND) &&
   !And->hasAnyUseOfValue(1)) {
 unsigned NewOpc;
+#define CASE_ND(OP)
\
+  case X86::OP:
\
+  case X86::OP##_ND:
+#define FROM_TO(A, B)  
\
+  CASE_ND(A) NewOpc = X86::B;  
\
+  break;
 switch (N0Opc) {
-case X86::AND8rm:  NewOpc = X86::TEST8mr; break;
-case X86::AND16rm: NewOpc = X86::TEST16mr; break;
-case X86::AND32rm: NewOpc = X86::TEST32mr; break;
-case X86::AND64rm: NewOpc = X86::TEST64mr; break;
+  FROM_TO(AND8rm, TEST8mr);
+  FROM_TO(AND16rm, TEST16mr);
+  FROM_TO(AND32rm, TEST32mr);
+  FROM_TO(AND64rm, TEST64mr);
 }
+#undef FROM_TO
+#undef CASE_ND
 
 // Need to swap the memory and register operand.
 SDValue Ops[] = { And.getOperand(1),
diff --git a/llvm/test/CodeGen/X86/cmp.ll b/llvm/test/CodeGen/X86/cmp.ll
index 402da547613c5..5a63d36a6be4e 100644
--- a/llvm/test/CodeGen/X86/cmp.ll
+++ b/llvm/test/CodeGen/X86/cmp.ll
@@ -787,25 +787,15 @@ define i1 @shifted_mask64_testl(i64 %a) {
 }
 
 define i1 @shifted_mask64_extra_use_const(i64 %a) {
-; NO-NDD-LABEL: shifted_mask64_extra_use_const:
-; NO-NDD:   # %bb.0:
-; NO-NDD-NEXT:movabsq $287104476244869120, %rcx # encoding: 
[0x48,0xb9,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x03]
-; NO-NDD-NEXT:# imm = 0x3FC
-; NO-NDD-NEXT:testq %rcx, %rdi # encoding: [0x48,0x85,0xcf]
-; NO-NDD-NEXT:setne %al # encoding: [0x0f,0x95,0xc0]
-; NO-NDD-NEXT:movq %rcx, d64(%rip) # encoding: [0x48,0x89,0x0d,A,A,A,A]
-; NO-NDD-NEXT:# fixup A - offset: 3, value: d64-4, kind: reloc_riprel_4byte
-; NO-NDD-NEXT:retq # encoding: [0xc3]
-;
-; NDD-LABEL: shifted_mask64_extra_use_const:
-; NDD:   # %bb.0:
-; NDD-NEXT:movabsq $287104476244869120, %rcx # encoding: 
[0x48,0xb9,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x03]
-; NDD-NEXT:# imm = 0x3FC
-; NDD-NEXT:andq %rcx, %rdi, %rax # encoding: 
[0x62,0xf4,0xfc,0x18,0x21,0xcf]
-; NDD-NEXT:setne %al # encoding: [0x0f,0x95,0xc0]
-; NDD-NEXT:movq %rcx, d64(%rip) # encoding: [0x48,0x89,0x0d,A,A,A,A]
-; NDD-NEXT:# fixup A - offset: 3, value: d64-4, 

[Lldb-commits] [lldb] [llvm] [lldb] Refactor string manipulation in Debugger.cpp (#91209) (PR #91880)

2024-05-12 Thread via lldb-commits

https://github.com/aabhinavg created 
https://github.com/llvm/llvm-project/pull/91880

Author: aabhinavg 
Date: Sun May 12 12:46:54 2024 +0800
Reviewers: @JOE1994, @chelcassanova, @dcb314

Fixes: #91209

Summary of Changes:
- Replaced the ineffective call to 'substr' with a more efficient use of 
'resize' to truncate the string.
- Adjusted the code to use 'resize' instead of 'substr' for better performance 
and readability.

>From 48ebf2cf7c6ed2c477b825e531848fd3f64c5cf2 Mon Sep 17 00:00:00 2001
From: Shengchen Kan 
Date: Sun, 12 May 2024 12:46:54 +0800
Subject: [PATCH] [lldb] Refactor string manipulation in Debugger.cpp (#91209)

Author: aabhinavg 
Date: Sun May 12 12:46:54 2024 +0800
Reviewers: @JOE1994, @chelcassanova, @dcb314

Fixes: #91209

Summary of Changes:
- Replaced the ineffective call to 'substr' with a more efficient use of 
'resize' to truncate the string.
- Adjusted the code to use 'resize' instead of 'substr' for better performance 
and readability.
---
 lldb/source/Core/Debugger.cpp   |  2 +-
 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 24 +
 llvm/test/CodeGen/X86/cmp.ll| 47 -
 3 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9951fbcd3e7c3..70303173925e3 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -2067,7 +2067,7 @@ void Debugger::HandleProgressEvent(const lldb::EventSP 
_sp) {
   const uint32_t term_width = GetTerminalWidth();
   const uint32_t ellipsis = 3;
   if (message.size() + ellipsis >= term_width)
-message = message.substr(0, term_width - ellipsis);
+message.resize(message.size() - ellipsis);
 
   const bool use_color = GetUseColor();
   llvm::StringRef ansi_prefix = GetShowProgressAnsiPrefix();
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp 
b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 14c62893766ad..ea3b84d0ca9eb 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1560,7 +1560,9 @@ void X86DAGToDAGISel::PostprocessISelDAG() {
   SDValue And = N->getOperand(0);
   unsigned N0Opc = And.getMachineOpcode();
   if ((N0Opc == X86::AND8rr || N0Opc == X86::AND16rr ||
-   N0Opc == X86::AND32rr || N0Opc == X86::AND64rr) &&
+   N0Opc == X86::AND32rr || N0Opc == X86::AND64rr ||
+   N0Opc == X86::AND8rr_ND || N0Opc == X86::AND16rr_ND ||
+   N0Opc == X86::AND32rr_ND || N0Opc == X86::AND64rr_ND) &&
   !And->hasAnyUseOfValue(1)) {
 MachineSDNode *Test = CurDAG->getMachineNode(Opc, SDLoc(N),
  MVT::i32,
@@ -1571,15 +1573,25 @@ void X86DAGToDAGISel::PostprocessISelDAG() {
 continue;
   }
   if ((N0Opc == X86::AND8rm || N0Opc == X86::AND16rm ||
-   N0Opc == X86::AND32rm || N0Opc == X86::AND64rm) &&
+   N0Opc == X86::AND32rm || N0Opc == X86::AND64rm ||
+   N0Opc == X86::AND8rm_ND || N0Opc == X86::AND16rm_ND ||
+   N0Opc == X86::AND32rm_ND || N0Opc == X86::AND64rm_ND) &&
   !And->hasAnyUseOfValue(1)) {
 unsigned NewOpc;
+#define CASE_ND(OP)
\
+  case X86::OP:
\
+  case X86::OP##_ND:
+#define FROM_TO(A, B)  
\
+  CASE_ND(A) NewOpc = X86::B;  
\
+  break;
 switch (N0Opc) {
-case X86::AND8rm:  NewOpc = X86::TEST8mr; break;
-case X86::AND16rm: NewOpc = X86::TEST16mr; break;
-case X86::AND32rm: NewOpc = X86::TEST32mr; break;
-case X86::AND64rm: NewOpc = X86::TEST64mr; break;
+  FROM_TO(AND8rm, TEST8mr);
+  FROM_TO(AND16rm, TEST16mr);
+  FROM_TO(AND32rm, TEST32mr);
+  FROM_TO(AND64rm, TEST64mr);
 }
+#undef FROM_TO
+#undef CASE_ND
 
 // Need to swap the memory and register operand.
 SDValue Ops[] = { And.getOperand(1),
diff --git a/llvm/test/CodeGen/X86/cmp.ll b/llvm/test/CodeGen/X86/cmp.ll
index 402da547613c5..5a63d36a6be4e 100644
--- a/llvm/test/CodeGen/X86/cmp.ll
+++ b/llvm/test/CodeGen/X86/cmp.ll
@@ -787,25 +787,15 @@ define i1 @shifted_mask64_testl(i64 %a) {
 }
 
 define i1 @shifted_mask64_extra_use_const(i64 %a) {
-; NO-NDD-LABEL: shifted_mask64_extra_use_const:
-; NO-NDD:   # %bb.0:
-; NO-NDD-NEXT:movabsq $287104476244869120, %rcx # encoding: 
[0x48,0xb9,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x03]
-; NO-NDD-NEXT:# imm = 0x3FC
-; NO-NDD-NEXT:testq %rcx, %rdi # encoding: [0x48,0x85,0xcf]
-; NO-NDD-NEXT:setne %al # encoding: [0x0f,0x95,0xc0]
-; NO-NDD-NEXT:movq %rcx, d64(%rip) # encoding: [0x48,0x89,0x0d,A,A,A,A]
-; NO-NDD-NEXT:# fixup A - offset: 3, value: d64-4, kind: reloc_riprel_4byte
-; NO-NDD-NEXT:retq # encoding: [0xc3]
-;