[llvm] 67464df - [DebugInfo] Only perform TypeSize -> unsigned cast when necessary

Joe Ellis via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 05:54:30 PST 2021


Author: Joe Ellis
Date: 2021-02-11T13:54:09Z
New Revision: 67464dfe366b533045dc3c15a069d0768a20629f

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

LOG: [DebugInfo] Only perform TypeSize -> unsigned cast when necessary

This commit moves a line in SelectionDAGBuilder::handleDebugValue to
avoid implicitly casting a TypeSize object to an unsigned earlier than
necessary. It was possible that we bail out of the loop before the value
is ever used, which means we could create a superfluous TypeSize
warning.

Reviewed By: DavidTruby

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index c03869fe49ca..405842535219 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1321,10 +1321,11 @@ bool SelectionDAGBuilder::handleDebugValue(const Value *V, DILocalVariable *Var,
         if (auto Fragment = Expr->getFragmentInfo())
           BitsToDescribe = Fragment->SizeInBits;
         for (auto RegAndSize : RFV.getRegsAndSizes()) {
-          unsigned RegisterSize = RegAndSize.second;
           // Bail out if all bits are described already.
           if (Offset >= BitsToDescribe)
             break;
+          // TODO: handle scalable vectors.
+          unsigned RegisterSize = RegAndSize.second;
           unsigned FragmentSize = (Offset + RegisterSize > BitsToDescribe)
               ? BitsToDescribe - Offset
               : RegisterSize;


        


More information about the llvm-commits mailing list