[llvm] Fix APInt::concat for zero-width operands (PR #207475)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 4 10:01:10 PDT 2026


================
@@ -952,6 +952,10 @@ class [[nodiscard]] APInt {
   /// equivalent to:
   ///   (this->zext(NewWidth) << NewLSB.getBitWidth()) | NewLSB.zext(NewWidth)
   APInt concat(const APInt &NewLSB) const {
+    if (getBitWidth() == 0)
----------------
nikic wrote:

Only this check would be sufficient to avoid UB, right?

https://github.com/llvm/llvm-project/pull/207475


More information about the llvm-commits mailing list