FailedChanges

Summary

  1. [ubsan] Skip overflow checks on safe arithmetic (fixes PR32874) Currently, ubsan emits overflow checks for arithmetic that is known to be safe at compile-time, e.g: 1 + 1 => CheckedAdd(1, 1) This leads to breakage when using the __builtin_prefetch intrinsic. LLVM expects the arguments to @llvm.prefetch to be constant integers, and when ubsan inserts unnecessary checks on the operands to the intrinsic, this contract is broken, leading to verifier failures (see PR32874). Instead of special-casing __builtin_prefetch for ubsan, this patch fixes the underlying problem, i.e that clang currently emits unnecessary overflow checks. Testing: I ran the check-clang and check-ubsan targets with a stage2, ubsan-enabled build of clang. I added a regression test for PR32874, and some extra checking to make sure we don't regress runtime checking for unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also provides coverage for this change.
  2. Fix type conversion error.
  3. Make codeview::StringTable. Previously we had knowledge of how to serialize and deserialize a string table inside of DebugInfo/PDB, but the string table that it serializes contains a piece that is actually considered CodeView and can appear outside of a PDB. We already have logic in llvm-readobj and MCCodeView to read and write this format, so it doesn't make sense to duplicate the logic in DebugInfoPDB as well. This patch makes codeview::StringTable (for writing) and codeview::StringTableRef (for reading), updates DebugInfoPDB to use these classes for its own writing, and updates llvm-readobj to additionally use StringTableRef for reading. It's a bit more difficult to get MCCodeView to use this for writing, but it's a logical next step.
  4. Typo in LangRef.rst. NFC
Revision 301988 by Vedant Kumar:
[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)

Currently, ubsan emits overflow checks for arithmetic that is known to
be safe at compile-time, e.g:

  1 + 1 => CheckedAdd(1, 1)

This leads to breakage when using the __builtin_prefetch intrinsic. LLVM
expects the arguments to @llvm.prefetch to be constant integers, and
when ubsan inserts unnecessary checks on the operands to the intrinsic,
this contract is broken, leading to verifier failures (see PR32874).

Instead of special-casing __builtin_prefetch for ubsan, this patch fixes
the underlying problem, i.e that clang currently emits unnecessary
overflow checks.

Testing: I ran the check-clang and check-ubsan targets with a stage2,
ubsan-enabled build of clang. I added a regression test for PR32874, and
some extra checking to make sure we don't regress runtime checking for
unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also
provides coverage for this change.
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/lib/CodeGen/CGExprScalar.cpp (diff)llvm-revision.src/cfe/trunk/lib/CodeGen/CGExprScalar.cpp
The file was added/cfe/trunk/test/CodeGen/PR32874.cllvm-revision.src/cfe/trunk/test/CodeGen/PR32874.c
Revision 301987 by zturner:
Fix type conversion error.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp
Revision 301986 by zturner:
Make codeview::StringTable.

Previously we had knowledge of how to serialize and deserialize
a string table inside of DebugInfo/PDB, but the string table
that it serializes contains a piece that is actually considered
CodeView and can appear outside of a PDB.  We already have logic
in llvm-readobj and MCCodeView to read and write this format,
so it doesn't make sense to duplicate the logic in DebugInfoPDB
as well.

This patch makes codeview::StringTable (for writing) and
codeview::StringTableRef (for reading), updates DebugInfoPDB
to use these classes for its own writing, and updates llvm-readobj
to additionally use StringTableRef for reading.

It's a bit more difficult to get MCCodeView to use this for
writing, but it's a logical next step.
Change TypePath in RepositoryPath in Workspace
The file was added/llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.hllvm-revision.src/llvm/trunk/include/llvm/DebugInfo/CodeView/StringTable.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBFile.h (diff)llvm-revision.src/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBFile.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h (diff)llvm-revision.src/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h (diff)llvm-revision.src/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h (diff)llvm-revision.src/llvm/trunk/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/PDB/Native/RawTypes.h (diff)llvm-revision.src/llvm/trunk/include/llvm/DebugInfo/PDB/Native/RawTypes.h
The file was modified/llvm/trunk/include/llvm/Support/BinaryStreamReader.h (diff)llvm-revision.src/llvm/trunk/include/llvm/Support/BinaryStreamReader.h
The file was modified/llvm/trunk/include/llvm/Support/BinaryStreamWriter.h (diff)llvm-revision.src/llvm/trunk/include/llvm/Support/BinaryStreamWriter.h
The file was modified/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt
The file was added/llvm/trunk/lib/DebugInfo/CodeView/StringTable.cppllvm-revision.src/llvm/trunk/lib/DebugInfo/CodeView/StringTable.cpp
The file was modified/llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp
The file was modified/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFile.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFile.cpp
The file was modified/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
The file was modified/llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTable.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTable.cpp
The file was modified/llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp (diff)llvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
The file was added/llvm/trunk/lib/DebugInfo/PDB/Native/StringTableStreamBuilder.cppllvm-revision.src/llvm/trunk/lib/DebugInfo/PDB/Native/StringTableStreamBuilder.cpp
The file was modified/llvm/trunk/lib/Support/BinaryStreamReader.cpp (diff)llvm-revision.src/llvm/trunk/lib/Support/BinaryStreamReader.cpp
The file was modified/llvm/trunk/lib/Support/BinaryStreamWriter.cpp (diff)llvm-revision.src/llvm/trunk/lib/Support/BinaryStreamWriter.cpp
The file was modified/llvm/trunk/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp (diff)llvm-revision.src/llvm/trunk/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp
Revision 301985 by trentxintong:
Typo in LangRef.rst. NFC
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/docs/LangRef.rst (diff)llvm-revision.src/llvm/trunk/docs/LangRef.rst