[llvm] [DebugInfo] Get rid of redundant conditional checks in `/DebugInfo` (PR #92111)
Youngsuk Kim via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 07:59:48 PDT 2024
================
@@ -246,20 +246,17 @@ class LVObject {
virtual void setName(StringRef ObjectName) {}
LVElement *getParent() const {
- assert((!Parent.Element ||
- (Parent.Element && static_cast<LVElement *>(Parent.Element))) &&
+ assert((!Parent.Element || static_cast<LVElement *>(Parent.Element)) &&
----------------
JOE1994 wrote:
Upon another look, the original assert (before this mod) looks flawed.
`(! Parent.Element)` always evaluates to `true` except for when `Parent.Element` is an all-1 bitvector..
Could you update this and the other 2 assert conditions like below?
```suggestion
assert(((Parent.Element == nullptr) || static_cast<LVElement *>(Parent.Element)) &&
```
https://github.com/llvm/llvm-project/pull/92111
More information about the llvm-commits
mailing list