llvm-project/llvm/test
Pavel Labath aaff1a631a MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH
Summary:
The functions different in two ways:
- getLLVMRegNum could return both "eh" and "other" dwarf register
  numbers, while getLLVMRegNumFromEH only returned the "eh" number.
- getLLVMRegNum asserted if the register was not found, while the second
  function returned -1.

The second distinction was pretty important, but it was very hard to
infer that from the function name. Aditionally, for the use case of
dumping dwarf expressions, we needed a function which can work with both
kinds of number, but does not assert.

This patch solves both of these issues by merging the two functions into
one, returning an Optional<unsigned> value. While the same thing could
be achieved by adding an "IsEH" argument to the (renamed)
getLLVMRegNumFromEH function, it seemed better to avoid the confusion of
two functions and put the choice of asserting into the hands of the
caller -- if he checks the Optional value, he can safely process
"untrusted" input, and if he blindly dereferences the Optional, he gets
the assertion.

I've updated all call sites to the new API, choosing between the two
options according to the function they were calling originally, except
that I've updated the usage in DWARFExpression.cpp to use the "safe"
method instead, and added a test case which would have previously
triggered an assertion failure when processing (incorrect?) dwarf
expressions.

Reviewers: dsanders, arsenm, JDevlieghere

Subscribers: wdng, aprantl, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 372710
2019-09-24 09:31:02 +00:00
..
Analysis [MemorySSA] Update Phi insertion. 2019-09-23 23:50:16 +00:00
Assembler
Bindings
Bitcode Add AutoUpgrade function to add new address space datalayout string to existing datalayouts. 2019-09-18 22:15:58 +00:00
BugPoint
CodeGen [GlobalISel][IRTranslator] Fix switch table lowering to use signed LE not unsigned. 2019-09-24 00:09:23 +00:00
DebugInfo MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH 2019-09-24 09:31:02 +00:00
Demangle llvm-undname: Add support for demangling typeinfo names 2019-09-23 13:13:37 +00:00
Examples
ExecutionEngine [JITLink] Don't under-align zero-fill sections. 2019-08-27 15:22:23 +00:00
Feature [FPEnv] Add fptosi and fptoui constrained intrinsics. 2019-08-28 16:33:36 +00:00
FileCheck [FileCheck] Forbid using var defined on same line 2019-09-02 14:04:00 +00:00
Instrumentation [PGO] Don't use comdat groups for counters & data on COFF 2019-09-17 21:10:49 +00:00
Integer
JitListener
LTO [IRMover] Don't map globals if their types are the same 2019-09-11 18:35:49 +00:00
Linker Remove some unnecessary REQUIRES: shell lines 2019-09-10 00:06:52 +00:00
MC [WebAssembly] vNxM.load_splat instructions 2019-09-23 20:42:12 +00:00
MachineVerifier Remove unnecessary REQUIRES from a test. 2019-08-24 02:39:51 +00:00
Object Reapply [llvm-ar] Include a line number when failing to parse an MRI script 2019-09-20 08:10:14 +00:00
ObjectYAML [yaml2obj/ObjectYAML] - Cleanup the error reporting API, add custom errors handlers. 2019-09-13 16:00:16 +00:00
Other [Float2Int] avoid crashing on unreachable code (PR38502) 2019-09-19 16:31:17 +00:00
Reduce [Testing] Python 3 requires `print` to use parens 2019-09-20 13:52:47 +00:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen [TableGen] Emit OperandType enums for RegisterOperands/RegisterClasses 2019-09-23 18:51:00 +00:00
ThinLTO/X86 Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2019-09-11 16:19:50 +00:00
Transforms [Debuginfo] dbg.value points to undef value after Induction Variable Simplification. 2019-09-24 08:47:03 +00:00
Unit
Verifier [Mips] Remove immarg test for intrinsics that no longer have an immarg after r372409. 2019-09-20 18:52:49 +00:00
YAMLParser
tools [llvm-lipo] Add support for archives 2019-09-23 22:22:55 +00:00
.clang-format
CMakeLists.txt [llvm-ifs][IFS] llvm Interface Stubs merging + object file generation tool. 2019-08-30 18:26:05 +00:00
TestRunner.sh
lit.cfg.py Revert "Reland "[utils] Implement the llvm-locstats tool"" 2019-09-23 11:04:11 +00:00
lit.site.cfg.py.in Follow-up to r372209: Use single quotes for host_ldflags in the lit config 2019-09-18 14:12:59 +00:00