diff --git a/compiler-rt/lib/memprof/memprof_thread.h b/compiler-rt/lib/memprof/memprof_thread.h index 2e1a8bb43b82c6..8f2685784c5ecc 100644 --- a/compiler-rt/lib/memprof/memprof_thread.h +++ b/compiler-rt/lib/memprof/memprof_thread.h @@ -51,6 +51,9 @@ struct MemprofThreadContext final : public ThreadContextBase { MemprofThread *thread; StackTrace *stack; }; + +protected: + ~MemprofThreadContext() {} }; // MemprofThreadContext objects are never freed, so we need many of them. diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp index d651a376789bd7..7abb3b4b65dc86 100644 --- a/compiler-rt/lib/msan/msan.cpp +++ b/compiler-rt/lib/msan/msan.cpp @@ -109,7 +109,7 @@ void Flags::SetDefaults() { // keep_going is an old name for halt_on_error, // and it has inverse meaning. -class FlagHandlerKeepGoing : public FlagHandlerBase { +class FlagHandlerKeepGoing final : public FlagHandlerBase { bool *halt_on_error_; public: diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h index eda7c32045a6f9..2829d6487b743b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h @@ -66,6 +66,9 @@ struct DDCallback { virtual u32 Unwind() { return 0; } virtual int UniqueTid() { return 0; } + + protected: + ~DDCallback() {} }; struct DDetector { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h index fac5dff3463337..acc71ccd89eea7 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h @@ -42,7 +42,7 @@ class FlagHandlerBase { }; template -class FlagHandler : public FlagHandlerBase { +class FlagHandler final : public FlagHandlerBase { T *t_; public: diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cpp index d3290493fd6daa..cc898398eaf201 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cpp @@ -72,7 +72,7 @@ void SubstituteForFlagValue(const char *s, char *out, uptr out_size) { *out = '\0'; } -class FlagHandlerInclude : public FlagHandlerBase { +class FlagHandlerInclude final : public FlagHandlerBase { FlagParser *parser_; bool ignore_missing_; const char *original_path_; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h index 7eb7c7684af5e5..7891c1081fe714 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld.h @@ -40,10 +40,13 @@ class SuspendedThreadsList { virtual uptr ThreadCount() const { UNIMPLEMENTED(); } virtual tid_t GetThreadID(uptr index) const { UNIMPLEMENTED(); } + protected: + ~SuspendedThreadsList() {} + private: // Prohibit copy and assign. - SuspendedThreadsList(const SuspendedThreadsList&); - void operator=(const SuspendedThreadsList&); + SuspendedThreadsList(const SuspendedThreadsList &) = delete; + void operator=(const SuspendedThreadsList &) = delete; }; typedef void (*StopTheWorldCallback)( diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp index eb89f1fddc5be2..0f1cadfeae3959 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp @@ -85,7 +85,7 @@ namespace __sanitizer { -class SuspendedThreadsListLinux : public SuspendedThreadsList { +class SuspendedThreadsListLinux final : public SuspendedThreadsList { public: SuspendedThreadsListLinux() { thread_ids_.reserve(1024); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp index a605d5b9ff6bd2..5ec30803b7ade3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp @@ -27,7 +27,7 @@ typedef struct { thread_t thread; } SuspendedThreadInfo; -class SuspendedThreadsListMac : public SuspendedThreadsList { +class SuspendedThreadsListMac final : public SuspendedThreadsList { public: SuspendedThreadsListMac() : threads_(1024) {} diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp index 70df31e6351cb9..9c7cd64255e55e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp @@ -48,7 +48,7 @@ namespace __sanitizer { -class SuspendedThreadsListNetBSD : public SuspendedThreadsList { +class SuspendedThreadsListNetBSD final : public SuspendedThreadsList { public: SuspendedThreadsListNetBSD() { thread_ids_.reserve(1024); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h index e4c351e667b4d3..71de1758b3e9c6 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h @@ -74,6 +74,9 @@ class SymbolizerTool { // Usually this is a safe place to call code that might need to use user // memory allocators. virtual void LateInitialize() {} + + protected: + ~SymbolizerTool() {} }; // SymbolizerProcess encapsulates communication between the tool and @@ -85,6 +88,8 @@ class SymbolizerProcess { const char *SendCommand(const char *command); protected: + ~SymbolizerProcess() {} + /// The maximum number of arguments required to invoke a tool process. static const unsigned kArgVMax = 6; @@ -128,7 +133,7 @@ class LLVMSymbolizerProcess; // This tool invokes llvm-symbolizer in a subprocess. It should be as portable // as the llvm-symbolizer tool is. -class LLVMSymbolizer : public SymbolizerTool { +class LLVMSymbolizer final : public SymbolizerTool { public: explicit LLVMSymbolizer(const char *path, LowLevelAllocator *allocator); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h index e2a0f71420f0e5..7b039b894b3bef 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h @@ -28,7 +28,7 @@ namespace __sanitizer { -class LibbacktraceSymbolizer : public SymbolizerTool { +class LibbacktraceSymbolizer final : public SymbolizerTool { public: static LibbacktraceSymbolizer *get(LowLevelAllocator *alloc); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp index 311d676439c0b9..710da4c1cecd1a 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp @@ -237,7 +237,7 @@ const LoadedModule *Symbolizer::FindModuleForAddress(uptr address) { // :: // ... // -class LLVMSymbolizerProcess : public SymbolizerProcess { +class LLVMSymbolizerProcess final : public SymbolizerProcess { public: explicit LLVMSymbolizerProcess(const char *path) : SymbolizerProcess(path, /*use_posix_spawn=*/SANITIZER_MAC) {} diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp index f0f150871d3a73..5c25b28b5dc96c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp @@ -65,7 +65,7 @@ bool DlAddrSymbolizer::SymbolizeData(uptr addr, DataInfo *datainfo) { // kAsanInternalHeapMagic. static char kAtosMachPortEnvEntry[] = K_ATOS_ENV_VAR "=000000000000000"; -class AtosSymbolizerProcess : public SymbolizerProcess { +class AtosSymbolizerProcess final : public SymbolizerProcess { public: explicit AtosSymbolizerProcess(const char *path) : SymbolizerProcess(path, /*use_posix_spawn*/ true) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.h index 8996131fc13850..401d30fa503302 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.h @@ -21,7 +21,7 @@ namespace __sanitizer { -class DlAddrSymbolizer : public SymbolizerTool { +class DlAddrSymbolizer final : public SymbolizerTool { public: bool SymbolizePC(uptr addr, SymbolizedStack *stack) override; bool SymbolizeData(uptr addr, DataInfo *info) override; @@ -29,7 +29,7 @@ class DlAddrSymbolizer : public SymbolizerTool { class AtosSymbolizerProcess; -class AtosSymbolizer : public SymbolizerTool { +class AtosSymbolizer final : public SymbolizerTool { public: explicit AtosSymbolizer(const char *path, LowLevelAllocator *allocator); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp index 3c379a8480250f..4dd5cc3ad7cbed 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp @@ -201,7 +201,7 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() { return true; } -class Addr2LineProcess : public SymbolizerProcess { +class Addr2LineProcess final : public SymbolizerProcess { public: Addr2LineProcess(const char *path, const char *module_name) : SymbolizerProcess(path), module_name_(internal_strdup(module_name)) {} @@ -261,7 +261,7 @@ bool Addr2LineProcess::ReachedEndOfOutput(const char *buffer, output_terminator_, kTerminatorLen); } -class Addr2LinePool : public SymbolizerTool { +class Addr2LinePool final : public SymbolizerTool { public: explicit Addr2LinePool(const char *addr2line_path, LowLevelAllocator *allocator) @@ -328,7 +328,7 @@ int __sanitizer_symbolize_demangle(const char *Name, char *Buffer, int MaxLength); } // extern "C" -class InternalSymbolizer : public SymbolizerTool { +class InternalSymbolizer final : public SymbolizerTool { public: static InternalSymbolizer *get(LowLevelAllocator *alloc) { if (__sanitizer_symbolize_code != 0 && @@ -387,7 +387,7 @@ class InternalSymbolizer : public SymbolizerTool { }; #else // SANITIZER_SUPPORTS_WEAK_HOOKS -class InternalSymbolizer : public SymbolizerTool { +class InternalSymbolizer final : public SymbolizerTool { public: static InternalSymbolizer *get(LowLevelAllocator *alloc) { return 0; } }; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp index 373437e7ee2ad2..48fa2d1033ae3d 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp @@ -33,7 +33,7 @@ decltype(::UnDecorateSymbolName) *UnDecorateSymbolName; namespace { -class WinSymbolizerTool : public SymbolizerTool { +class WinSymbolizerTool final : public SymbolizerTool { public: // The constructor is provided to avoid synthesized memsets. WinSymbolizerTool() {} diff --git a/compiler-rt/lib/tsan/dd/dd_rtl.h b/compiler-rt/lib/tsan/dd/dd_rtl.h index ffe0684306dc10..b1e19be57d3f20 100644 --- a/compiler-rt/lib/tsan/dd/dd_rtl.h +++ b/compiler-rt/lib/tsan/dd/dd_rtl.h @@ -30,7 +30,7 @@ struct Thread { bool ignore_interceptors; }; -struct Callback : DDCallback { +struct Callback final : public DDCallback { Thread *thr; Callback(Thread *thr); diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp index ebd0d722181885..27897f0592b0e0 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp @@ -24,7 +24,7 @@ namespace __tsan { void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r); -struct Callback : DDCallback { +struct Callback final : public DDCallback { ThreadState *thr; uptr pc; diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index e1cde1131c553d..85387756ce1817 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -34,7 +34,6 @@ import os import platform import plistlib -import pprint # pp = pprint.PrettyPrinter(indent=4); pp.pprint(command_args) import re import shlex import string @@ -43,56 +42,42 @@ import time import uuid -def read_plist(s): - if sys.version_info.major == 3: - return plistlib.loads(s) - else: - return plistlib.readPlistFromString(s) - try: - # Just try for LLDB in case PYTHONPATH is already correctly setup + # First try for LLDB in case PYTHONPATH is already correctly setup. import lldb except ImportError: - lldb_python_dirs = list() - # lldb is not in the PYTHONPATH, try some defaults for the current platform - platform_system = platform.system() - if platform_system == 'Darwin': - # On Darwin, try the currently selected Xcode directory - xcode_dir = subprocess.check_output("xcode-select --print-path", shell=True).decode("utf-8") - if xcode_dir: - lldb_python_dirs.append( - os.path.realpath( - xcode_dir + - '/../SharedFrameworks/LLDB.framework/Resources/Python')) - lldb_python_dirs.append( - xcode_dir + '/Library/PrivateFrameworks/LLDB.framework/Resources/Python') - lldb_python_dirs.append( - '/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python') - success = False - for lldb_python_dir in lldb_python_dirs: - if os.path.exists(lldb_python_dir): - if not (sys.path.__contains__(lldb_python_dir)): - sys.path.append(lldb_python_dir) - try: - import lldb - except ImportError: - pass - else: - print('imported lldb from: "%s"' % (lldb_python_dir)) - success = True - break - if not success: + # Ask the command line driver for the path to the lldb module. Copy over + # the environment so that SDKROOT is propagated to xcrun. + env = os.environ.copy() + env['LLDB_DEFAULT_PYTHON_VERSION'] = str(sys.version_info.major) + command = ['xcrun', 'lldb', '-P'] if platform.system() == 'Darwin' else ['lldb', '-P'] + # Extend the PYTHONPATH if the path exists and isn't already there. + lldb_python_path = subprocess.check_output(command, env=env).decode("utf-8").strip() + if os.path.exists(lldb_python_path) and not sys.path.__contains__(lldb_python_path): + sys.path.append(lldb_python_path) + # Try importing LLDB again. + try: + import lldb + except ImportError: print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly") sys.exit(1) from lldb.utils import symbolication -PARSE_MODE_NORMAL = 0 -PARSE_MODE_THREAD = 1 -PARSE_MODE_IMAGES = 2 -PARSE_MODE_THREGS = 3 -PARSE_MODE_SYSTEM = 4 -PARSE_MODE_INSTRS = 5 + +def read_plist(s): + if sys.version_info.major == 3: + return plistlib.loads(s) + else: + return plistlib.readPlistFromString(s) + +class CrashLogParseMode: + NORMAL = 0 + THREAD = 1 + IMAGES = 2 + THREGS = 3 + SYSTEM = 4 + INSTRS = 5 class CrashLog(symbolication.Symbolicator): @@ -155,7 +140,6 @@ def dump_symbolicated(self, crash_log, options): return print("%s" % self) - #prev_frame_index = -1 display_frame_idx = -1 for frame_idx, frame in enumerate(self.frames): disassemble = ( @@ -383,7 +367,7 @@ def __init__(self, path, verbose): return self.file_lines = f.read().splitlines() - parse_mode = PARSE_MODE_NORMAL + parse_mode = CrashLogParseMode.NORMAL thread = None app_specific_backtrace = False for line in self.file_lines: @@ -391,7 +375,7 @@ def __init__(self, path, verbose): line_len = len(line) if line_len == 0: if thread: - if parse_mode == PARSE_MODE_THREAD: + if parse_mode == CrashLogParseMode.THREAD: if thread.index == self.crashed_thread_idx: thread.reason = '' if self.thread_exception: @@ -408,9 +392,8 @@ def __init__(self, path, verbose): # in the info_lines wasn't empty if len(self.info_lines) > 0 and len(self.info_lines[-1]): self.info_lines.append(line) - parse_mode = PARSE_MODE_NORMAL - # print 'PARSE_MODE_NORMAL' - elif parse_mode == PARSE_MODE_NORMAL: + parse_mode = CrashLogParseMode.NORMAL + elif parse_mode == CrashLogParseMode.NORMAL: if line.startswith('Process:'): (self.process_name, pid_with_brackets) = line[ 8:].strip().split(' [') @@ -442,18 +425,18 @@ def __init__(self, path, verbose): continue elif line.startswith('Exception Subtype:'): # iOS self.thread_exception_data = line[18:].strip() - continue + continue elif line.startswith('Crashed Thread:'): self.crashed_thread_idx = int(line[15:].strip().split()[0]) continue elif line.startswith('Triggered by Thread:'): # iOS self.crashed_thread_idx = int(line[20:].strip().split()[0]) - continue + continue elif line.startswith('Report Version:'): self.version = int(line[15:].strip()) continue elif line.startswith('System Profile:'): - parse_mode = PARSE_MODE_SYSTEM + parse_mode = CrashLogParseMode.SYSTEM continue elif (line.startswith('Interval Since Last Report:') or line.startswith('Crashes Since Last Report:') or @@ -469,38 +452,38 @@ def __init__(self, path, verbose): app_specific_backtrace = False thread_state_match = self.thread_regex.search(line) thread_idx = int(thread_state_match.group(1)) - parse_mode = PARSE_MODE_THREGS + parse_mode = CrashLogParseMode.THREGS thread = self.threads[thread_idx] continue thread_insts_match = self.thread_instrs_regex.search(line) if thread_insts_match: - parse_mode = PARSE_MODE_INSTRS + parse_mode = CrashLogParseMode.INSTRS continue thread_match = self.thread_regex.search(line) if thread_match: app_specific_backtrace = False - parse_mode = PARSE_MODE_THREAD + parse_mode = CrashLogParseMode.THREAD thread_idx = int(thread_match.group(1)) thread = CrashLog.Thread(thread_idx, False) continue continue elif line.startswith('Binary Images:'): - parse_mode = PARSE_MODE_IMAGES + parse_mode = CrashLogParseMode.IMAGES continue elif line.startswith('Application Specific Backtrace'): app_backtrace_match = self.app_backtrace_regex.search(line) if app_backtrace_match: - parse_mode = PARSE_MODE_THREAD + parse_mode = CrashLogParseMode.THREAD app_specific_backtrace = True idx = int(app_backtrace_match.group(1)) thread = CrashLog.Thread(idx, True) elif line.startswith('Last Exception Backtrace:'): # iOS - parse_mode = PARSE_MODE_THREAD + parse_mode = CrashLogParseMode.THREAD app_specific_backtrace = True idx = 1 thread = CrashLog.Thread(idx, True) self.info_lines.append(line.strip()) - elif parse_mode == PARSE_MODE_THREAD: + elif parse_mode == CrashLogParseMode.THREAD: if line.startswith('Thread'): continue if self.null_frame_regex.search(line): @@ -518,7 +501,7 @@ def __init__(self, path, verbose): frame_addr, 0), frame_ofs)) else: print('error: frame regex failed for line: "%s"' % line) - elif parse_mode == PARSE_MODE_IMAGES: + elif parse_mode == CrashLogParseMode.IMAGES: image_match = self.image_regex_uuid.search(line) if image_match: (img_lo, img_hi, img_name, _, img_version, _, @@ -533,20 +516,17 @@ def __init__(self, path, verbose): else: print("error: image regex failed for: %s" % line) - elif parse_mode == PARSE_MODE_THREGS: + elif parse_mode == CrashLogParseMode.THREGS: stripped_line = line.strip() # "r12: 0x00007fff6b5939c8 r13: 0x0000000007000006 r14: 0x0000000000002a03 r15: 0x0000000000000c00" reg_values = re.findall( '([a-zA-Z0-9]+: 0[Xx][0-9a-fA-F]+) *', stripped_line) for reg_value in reg_values: - # print 'reg_value = "%s"' % reg_value (reg, value) = reg_value.split(': ') - # print 'reg = "%s"' % reg - # print 'value = "%s"' % value thread.registers[reg.strip()] = int(value, 0) - elif parse_mode == PARSE_MODE_SYSTEM: + elif parse_mode == CrashLogParseMode.SYSTEM: self.system_profile.append(line) - elif parse_mode == PARSE_MODE_INSTRS: + elif parse_mode == CrashLogParseMode.INSTRS: pass f.close() @@ -575,7 +555,6 @@ def find_image_with_identifier(self, identifier): return None def create_target(self): - # print 'crashlog.create_target()...' if self.target is None: self.target = symbolication.Symbolicator.create_target(self) if self.target: @@ -723,7 +702,6 @@ def interactive_crashlogs(options, args): crash_logs = list() for crash_log_file in crash_log_files: - # print 'crash_log_file = "%s"' % crash_log_file crash_log = CrashLog(crash_log_file, options.verbose) if crash_log.error: print(crash_log.error) @@ -912,7 +890,6 @@ def SymbolicateCrashLog(crash_log, options): if err: print(err) else: - # print 'loaded %s' % image loaded_images.append(image) if crash_log.backtraces: diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 1772e7f4e55db0..57af82a3f58ed2 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -837,7 +837,8 @@ MCSection * TargetLoweringObjectFileELF::getSectionForLSDA(const Function &F, const TargetMachine &TM) const { // If neither COMDAT nor function sections, use the monolithic LSDA section. - if (!F.hasComdat() && !TM.getFunctionSections()) + // Re-use this path if LSDASection is null as in the Arm EHABI. + if (!LSDASection || (!F.hasComdat() && !TM.getFunctionSections())) return LSDASection; const auto *LSDA = cast(LSDASection); diff --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp index 9edbf5f68f324d..85ae195e58e851 100644 --- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp +++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp @@ -1626,7 +1626,10 @@ bool PPCFastISel::fastLowerCall(CallLoweringInfo &CLI) { if (!isTypeLegal(ArgTy, ArgVT) && ArgVT != MVT::i16 && ArgVT != MVT::i8) return false; - if (ArgVT.isVector()) + // FIXME: FastISel cannot handle non-simple types yet, including 128-bit FP + // types, which is passed through vector register. Skip these types and + // fallback to default SelectionDAG based selection. + if (ArgVT.isVector() || ArgVT == MVT::f128) return false; unsigned Arg = getRegForValue(ArgValue); diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 9bedcf7167262a..5b5504a458ed93 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1463,7 +1463,7 @@ const char *PPCTargetLowering::getTargetNodeName(unsigned Opcode) const { case PPCISD::ANDI_rec_1_GT_BIT: return "PPCISD::ANDI_rec_1_GT_BIT"; case PPCISD::VCMP: return "PPCISD::VCMP"; - case PPCISD::VCMPo: return "PPCISD::VCMPo"; + case PPCISD::VCMP_rec: return "PPCISD::VCMP_rec"; case PPCISD::LBRX: return "PPCISD::LBRX"; case PPCISD::STBRX: return "PPCISD::STBRX"; case PPCISD::LFIWAX: return "PPCISD::LFIWAX"; @@ -10460,7 +10460,7 @@ SDValue PPCTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, DAG.getConstant(CompareOpc, dl, MVT::i32) }; EVT VTs[] = { Op.getOperand(2).getValueType(), MVT::Glue }; - SDValue CompNode = DAG.getNode(PPCISD::VCMPo, dl, VTs, Ops); + SDValue CompNode = DAG.getNode(PPCISD::VCMP_rec, dl, VTs, Ops); // Now that we have the comparison, emit a copy from the CR to a GPR. // This is flagged to the above dot comparison. @@ -15148,43 +15148,43 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N, } break; case PPCISD::VCMP: - // If a VCMPo node already exists with exactly the same operands as this - // node, use its result instead of this node (VCMPo computes both a CR6 and - // a normal output). + // If a VCMP_rec node already exists with exactly the same operands as this + // node, use its result instead of this node (VCMP_rec computes both a CR6 + // and a normal output). // if (!N->getOperand(0).hasOneUse() && !N->getOperand(1).hasOneUse() && !N->getOperand(2).hasOneUse()) { - // Scan all of the users of the LHS, looking for VCMPo's that match. - SDNode *VCMPoNode = nullptr; + // Scan all of the users of the LHS, looking for VCMP_rec's that match. + SDNode *VCMPrecNode = nullptr; SDNode *LHSN = N->getOperand(0).getNode(); for (SDNode::use_iterator UI = LHSN->use_begin(), E = LHSN->use_end(); UI != E; ++UI) - if (UI->getOpcode() == PPCISD::VCMPo && + if (UI->getOpcode() == PPCISD::VCMP_rec && UI->getOperand(1) == N->getOperand(1) && UI->getOperand(2) == N->getOperand(2) && UI->getOperand(0) == N->getOperand(0)) { - VCMPoNode = *UI; + VCMPrecNode = *UI; break; } - // If there is no VCMPo node, or if the flag value has a single use, don't - // transform this. - if (!VCMPoNode || VCMPoNode->hasNUsesOfValue(0, 1)) + // If there is no VCMP_rec node, or if the flag value has a single use, + // don't transform this. + if (!VCMPrecNode || VCMPrecNode->hasNUsesOfValue(0, 1)) break; // Look at the (necessarily single) use of the flag value. If it has a // chain, this transformation is more complex. Note that multiple things // could use the value result, which we should ignore. SDNode *FlagUser = nullptr; - for (SDNode::use_iterator UI = VCMPoNode->use_begin(); + for (SDNode::use_iterator UI = VCMPrecNode->use_begin(); FlagUser == nullptr; ++UI) { - assert(UI != VCMPoNode->use_end() && "Didn't find user!"); + assert(UI != VCMPrecNode->use_end() && "Didn't find user!"); SDNode *User = *UI; for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { - if (User->getOperand(i) == SDValue(VCMPoNode, 1)) { + if (User->getOperand(i) == SDValue(VCMPrecNode, 1)) { FlagUser = User; break; } @@ -15194,7 +15194,7 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N, // If the user is a MFOCRF instruction, we know this is safe. // Otherwise we give up for right now. if (FlagUser->getOpcode() == PPCISD::MFOCRF) - return SDValue(VCMPoNode, 0); + return SDValue(VCMPrecNode, 0); } break; case ISD::BRCOND: { @@ -15283,7 +15283,7 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N, DAG.getConstant(CompareOpc, dl, MVT::i32) }; EVT VTs[] = { LHS.getOperand(2).getValueType(), MVT::Glue }; - SDValue CompNode = DAG.getNode(PPCISD::VCMPo, dl, VTs, Ops); + SDValue CompNode = DAG.getNode(PPCISD::VCMP_rec, dl, VTs, Ops); // Unpack the result based on how the target uses it. PPC::Predicate CompOpc; diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h index 7807840a72a114..70dcef4658ff91 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -265,11 +265,11 @@ namespace llvm { /// is VCMPGTSH. VCMP, - /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the - /// altivec VCMP*o instructions. For lack of better number, we use the + /// RESVEC, OUTFLAG = VCMP_rec(LHS, RHS, OPC) - Represents one of the + /// altivec VCMP*_rec instructions. For lack of better number, we use the /// opcode number encoding for the OPC field to identify the compare. For /// example, 838 is VCMPGTSH. - VCMPo, + VCMP_rec, /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This /// corresponds to the COND_BRANCH pseudo instruction. CRRC is the diff --git a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td index 3b65f4da0442f8..bda00b89892f24 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td +++ b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td @@ -784,47 +784,47 @@ class VCMP xo, string asmstr, ValueType Ty> : VXRForm_1; -class VCMPo xo, string asmstr, ValueType Ty> +class VCMP_rec xo, string asmstr, ValueType Ty> : VXRForm_1 { + [(set Ty:$vD, (Ty (PPCvcmp_rec Ty:$vA, Ty:$vB, xo)))]> { let Defs = [CR6]; let RC = 1; } // f32 element comparisons.0 def VCMPBFP : VCMP <966, "vcmpbfp $vD, $vA, $vB" , v4f32>; -def VCMPBFP_rec : VCMPo<966, "vcmpbfp. $vD, $vA, $vB" , v4f32>; +def VCMPBFP_rec : VCMP_rec<966, "vcmpbfp. $vD, $vA, $vB" , v4f32>; def VCMPEQFP : VCMP <198, "vcmpeqfp $vD, $vA, $vB" , v4f32>; -def VCMPEQFP_rec : VCMPo<198, "vcmpeqfp. $vD, $vA, $vB", v4f32>; +def VCMPEQFP_rec : VCMP_rec<198, "vcmpeqfp. $vD, $vA, $vB", v4f32>; def VCMPGEFP : VCMP <454, "vcmpgefp $vD, $vA, $vB" , v4f32>; -def VCMPGEFP_rec : VCMPo<454, "vcmpgefp. $vD, $vA, $vB", v4f32>; +def VCMPGEFP_rec : VCMP_rec<454, "vcmpgefp. $vD, $vA, $vB", v4f32>; def VCMPGTFP : VCMP <710, "vcmpgtfp $vD, $vA, $vB" , v4f32>; -def VCMPGTFP_rec : VCMPo<710, "vcmpgtfp. $vD, $vA, $vB", v4f32>; +def VCMPGTFP_rec : VCMP_rec<710, "vcmpgtfp. $vD, $vA, $vB", v4f32>; // i8 element comparisons. def VCMPEQUB : VCMP < 6, "vcmpequb $vD, $vA, $vB" , v16i8>; -def VCMPEQUB_rec : VCMPo< 6, "vcmpequb. $vD, $vA, $vB", v16i8>; +def VCMPEQUB_rec : VCMP_rec< 6, "vcmpequb. $vD, $vA, $vB", v16i8>; def VCMPGTSB : VCMP <774, "vcmpgtsb $vD, $vA, $vB" , v16i8>; -def VCMPGTSB_rec : VCMPo<774, "vcmpgtsb. $vD, $vA, $vB", v16i8>; +def VCMPGTSB_rec : VCMP_rec<774, "vcmpgtsb. $vD, $vA, $vB", v16i8>; def VCMPGTUB : VCMP <518, "vcmpgtub $vD, $vA, $vB" , v16i8>; -def VCMPGTUB_rec : VCMPo<518, "vcmpgtub. $vD, $vA, $vB", v16i8>; +def VCMPGTUB_rec : VCMP_rec<518, "vcmpgtub. $vD, $vA, $vB", v16i8>; // i16 element comparisons. def VCMPEQUH : VCMP < 70, "vcmpequh $vD, $vA, $vB" , v8i16>; -def VCMPEQUH_rec : VCMPo< 70, "vcmpequh. $vD, $vA, $vB", v8i16>; +def VCMPEQUH_rec : VCMP_rec< 70, "vcmpequh. $vD, $vA, $vB", v8i16>; def VCMPGTSH : VCMP <838, "vcmpgtsh $vD, $vA, $vB" , v8i16>; -def VCMPGTSH_rec : VCMPo<838, "vcmpgtsh. $vD, $vA, $vB", v8i16>; +def VCMPGTSH_rec : VCMP_rec<838, "vcmpgtsh. $vD, $vA, $vB", v8i16>; def VCMPGTUH : VCMP <582, "vcmpgtuh $vD, $vA, $vB" , v8i16>; -def VCMPGTUH_rec : VCMPo<582, "vcmpgtuh. $vD, $vA, $vB", v8i16>; +def VCMPGTUH_rec : VCMP_rec<582, "vcmpgtuh. $vD, $vA, $vB", v8i16>; // i32 element comparisons. def VCMPEQUW : VCMP <134, "vcmpequw $vD, $vA, $vB" , v4i32>; -def VCMPEQUW_rec : VCMPo<134, "vcmpequw. $vD, $vA, $vB", v4i32>; +def VCMPEQUW_rec : VCMP_rec<134, "vcmpequw. $vD, $vA, $vB", v4i32>; def VCMPGTSW : VCMP <902, "vcmpgtsw $vD, $vA, $vB" , v4i32>; -def VCMPGTSW_rec : VCMPo<902, "vcmpgtsw. $vD, $vA, $vB", v4i32>; +def VCMPGTSW_rec : VCMP_rec<902, "vcmpgtsw. $vD, $vA, $vB", v4i32>; def VCMPGTUW : VCMP <646, "vcmpgtuw $vD, $vA, $vB" , v4i32>; -def VCMPGTUW_rec : VCMPo<646, "vcmpgtuw. $vD, $vA, $vB", v4i32>; +def VCMPGTUW_rec : VCMP_rec<646, "vcmpgtuw. $vD, $vA, $vB", v4i32>; let isCodeGenOnly = 1, isMoveImm = 1, isAsCheapAsAMove = 1, isReMaterializable = 1 in { @@ -1291,11 +1291,11 @@ def VORC : VXForm_1<1348, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), // i64 element comparisons. def VCMPEQUD : VCMP <199, "vcmpequd $vD, $vA, $vB" , v2i64>; -def VCMPEQUD_rec : VCMPo<199, "vcmpequd. $vD, $vA, $vB", v2i64>; +def VCMPEQUD_rec : VCMP_rec<199, "vcmpequd. $vD, $vA, $vB", v2i64>; def VCMPGTSD : VCMP <967, "vcmpgtsd $vD, $vA, $vB" , v2i64>; -def VCMPGTSD_rec : VCMPo<967, "vcmpgtsd. $vD, $vA, $vB", v2i64>; +def VCMPGTSD_rec : VCMP_rec<967, "vcmpgtsd. $vD, $vA, $vB", v2i64>; def VCMPGTUD : VCMP <711, "vcmpgtud $vD, $vA, $vB" , v2i64>; -def VCMPGTUD_rec : VCMPo<711, "vcmpgtud. $vD, $vA, $vB", v2i64>; +def VCMPGTUD_rec : VCMP_rec<711, "vcmpgtud. $vD, $vA, $vB", v2i64>; // The cryptography instructions that do not require Category:Vector.Crypto def VPMSUMB : VX1_Int_Ty<1032, "vpmsumb", @@ -1363,21 +1363,21 @@ def VMSUMUDM : VA1a_Int_Ty3<35, "vmsumudm", int_ppc_altivec_vmsumudm, // i8 element comparisons. def VCMPNEB : VCMP < 7, "vcmpneb $vD, $vA, $vB" , v16i8>; -def VCMPNEB_rec : VCMPo < 7, "vcmpneb. $vD, $vA, $vB" , v16i8>; +def VCMPNEB_rec : VCMP_rec < 7, "vcmpneb. $vD, $vA, $vB" , v16i8>; def VCMPNEZB : VCMP <263, "vcmpnezb $vD, $vA, $vB" , v16i8>; -def VCMPNEZB_rec : VCMPo<263, "vcmpnezb. $vD, $vA, $vB", v16i8>; +def VCMPNEZB_rec : VCMP_rec<263, "vcmpnezb. $vD, $vA, $vB", v16i8>; // i16 element comparisons. def VCMPNEH : VCMP < 71, "vcmpneh $vD, $vA, $vB" , v8i16>; -def VCMPNEH_rec : VCMPo< 71, "vcmpneh. $vD, $vA, $vB" , v8i16>; +def VCMPNEH_rec : VCMP_rec< 71, "vcmpneh. $vD, $vA, $vB" , v8i16>; def VCMPNEZH : VCMP <327, "vcmpnezh $vD, $vA, $vB" , v8i16>; -def VCMPNEZH_rec : VCMPo<327, "vcmpnezh. $vD, $vA, $vB", v8i16>; +def VCMPNEZH_rec : VCMP_rec<327, "vcmpnezh. $vD, $vA, $vB", v8i16>; // i32 element comparisons. def VCMPNEW : VCMP <135, "vcmpnew $vD, $vA, $vB" , v4i32>; -def VCMPNEW_rec : VCMPo<135, "vcmpnew. $vD, $vA, $vB" , v4i32>; +def VCMPNEW_rec : VCMP_rec<135, "vcmpnew. $vD, $vA, $vB" , v4i32>; def VCMPNEZW : VCMP <391, "vcmpnezw $vD, $vA, $vB" , v4i32>; -def VCMPNEZW_rec : VCMPo<391, "vcmpnezw. $vD, $vA, $vB", v4i32>; +def VCMPNEZW_rec : VCMP_rec<391, "vcmpnezw. $vD, $vA, $vB", v4i32>; // VX-Form: [PO VRT / UIM VRB XO]. // We use VXForm_1 to implement it, that is, we use "VRA" (5 bit) to represent diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index a03975b18eb4ed..1a128f1ddf0d83 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -335,7 +335,7 @@ def PPCrfebb : SDNode<"PPCISD::RFEBB", SDT_PPCsc, [SDNPHasChain, SDNPSideEffect]>; def PPCvcmp : SDNode<"PPCISD::VCMP" , SDT_PPCvcmp, []>; -def PPCvcmp_o : SDNode<"PPCISD::VCMPo", SDT_PPCvcmp, [SDNPOutGlue]>; +def PPCvcmp_rec : SDNode<"PPCISD::VCMP_rec", SDT_PPCvcmp, [SDNPOutGlue]>; def PPCcondbranch : SDNode<"PPCISD::COND_BRANCH", SDT_PPCcondbr, [SDNPHasChain, SDNPOptInGlue]>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td index c052b614b1c6cb..aca83365f5edc9 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrPrefix.td +++ b/llvm/lib/Target/PowerPC/PPCInstrPrefix.td @@ -2316,9 +2316,9 @@ let Predicates = [IsISA3_1] in { def VCMPEQUQ : VCMP <455, "vcmpequq $vD, $vA, $vB" , v1i128>; def VCMPGTSQ : VCMP <903, "vcmpgtsq $vD, $vA, $vB" , v1i128>; def VCMPGTUQ : VCMP <647, "vcmpgtuq $vD, $vA, $vB" , v1i128>; - def VCMPEQUQ_rec : VCMPo <455, "vcmpequq. $vD, $vA, $vB" , v1i128>; - def VCMPGTSQ_rec : VCMPo <903, "vcmpgtsq. $vD, $vA, $vB" , v1i128>; - def VCMPGTUQ_rec : VCMPo <647, "vcmpgtuq. $vD, $vA, $vB" , v1i128>; + def VCMPEQUQ_rec : VCMP_rec <455, "vcmpequq. $vD, $vA, $vB" , v1i128>; + def VCMPGTSQ_rec : VCMP_rec <903, "vcmpgtsq. $vD, $vA, $vB" , v1i128>; + def VCMPGTUQ_rec : VCMP_rec <647, "vcmpgtuq. $vD, $vA, $vB" , v1i128>; def VMODSQ : VXForm_1<1803, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), "vmodsq $vD, $vA, $vB", IIC_VecGeneral, [(set v1i128:$vD, (srem v1i128:$vA, v1i128:$vB))]>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrVSX.td b/llvm/lib/Target/PowerPC/PPCInstrVSX.td index 18ed2cca0f025e..1ffbd405d87aa2 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrVSX.td +++ b/llvm/lib/Target/PowerPC/PPCInstrVSX.td @@ -167,7 +167,7 @@ multiclass XX3Form_Rcr opcode, bits<7> xo, string asmbase, def _rec : XX3Form_Rc, + (InTy (PPCvcmp_rec InTy:$XA, InTy:$XB, xo)))]>, isRecordForm; } } diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 57ce933075a85e..1672b17df966b6 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -538,7 +538,9 @@ RISCVInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const { default: break; case RISCV::ADDI: - if (MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0) + // Operand 1 can be a frameindex but callers expect registers + if (MI.getOperand(1).isReg() && MI.getOperand(2).isImm() && + MI.getOperand(2).getImm() == 0) return DestSourcePair{MI.getOperand(0), MI.getOperand(1)}; break; case RISCV::FSGNJ_D: diff --git a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll index f4bdd60089064e..0a8fc1b0e777ad 100644 --- a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll +++ b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll @@ -266,3 +266,32 @@ entry: store double %conv1, double* %d1, align 8 ret void } + +; Function Attrs: noinline optnone +define signext i32 @noopt_call_crash() #0 { +; CHECK-LABEL: noopt_call_crash: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr r0 +; CHECK-NEXT: std r0, 16(r1) +; CHECK-NEXT: stdu r1, -96(r1) +; CHECK-NEXT: .cfi_def_cfa_offset 96 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: bl in +; CHECK-NEXT: nop +; CHECK-NEXT: bl out +; CHECK-NEXT: nop +; CHECK-NEXT: li r3, 0 +; CHECK-NEXT: addi r1, r1, 96 +; CHECK-NEXT: ld r0, 16(r1) +; CHECK-NEXT: mtlr r0 +; CHECK-NEXT: blr +entry: + %call = call fp128 @in() + call void @out(fp128 %call) + ret i32 0 +} + +declare void @out(fp128) +declare fp128 @in() + +attributes #0 = { noinline optnone } diff --git a/llvm/test/CodeGen/RISCV/copy-frameindex.mir b/llvm/test/CodeGen/RISCV/copy-frameindex.mir new file mode 100644 index 00000000000000..27d52c65839d8d --- /dev/null +++ b/llvm/test/CodeGen/RISCV/copy-frameindex.mir @@ -0,0 +1,61 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=riscv64 -debugify-and-strip-all-safe -run-pass machine-sink %s -o - 2>&1 | FileCheck %s + +--- | + define void @sink_addi_fi(i32 %0) !dbg !5 { + bb.0: + %1 = alloca i32, align 4 + call void @llvm.dbg.value(metadata i32* %1, metadata !1, metadata !DIExpression()), !dbg !3 + %2 = icmp eq i32 %0, 0 + br i1 %2, label %bb.2, label %bb.1 + bb.1: + store volatile i32 0, i32* %1, align 4 + br label %bb.2 + bb.2: + ret void + } + + declare void @llvm.dbg.value(metadata, metadata, metadata) + + !llvm.dbg.cu = !{!0} + + !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !4) + !1 = !DILocalVariable(name: "var", scope: !5, file: !4, line: 2, type: !2) + !2 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) + !3 = !DILocation(line: 0, scope: !5) + !4 = !DIFile(filename: "test.c", directory: "") + !5 = distinct !DISubprogram(name: "sink_addi_fi", scope: !4, file: !4, line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !8) + !6 = !DISubroutineType(types: !7) + !7 = !{null, !2} + !8 = !{} + +... +--- +name: sink_addi_fi +liveins: + - { reg: '$x10', virtual-reg: '%0' } +stack: + - { id: 0, offset: 0, size: 4, alignment: 4 } +body: | + ; CHECK-LABEL: name: sink_addi_fi + ; CHECK: bb.0: + ; CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000) + ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $x10 + ; CHECK: BEQ killed [[COPY]], $x0, %bb.2 + ; CHECK: bb.1: + ; CHECK: successors: %bb.2(0x80000000) + ; CHECK: [[ADDI:%[0-9]+]]:gpr = ADDI %stack.0, 0 + ; CHECK: SW $x0, killed [[ADDI]], 0 :: (volatile store 4 into %stack.0) + ; CHECK: bb.2: + ; CHECK: PseudoRET + bb.0: + liveins: $x10 + %0:gpr = COPY $x10 + DBG_VALUE %stack.0, $noreg, !1, !DIExpression(), debug-location !3 + %1:gpr = ADDI %stack.0, 0 + DBG_VALUE %1, $noreg, !1, !DIExpression(DW_OP_plus_uconst, 0, DW_OP_stack_value), debug-location !3 + BEQ killed %0:gpr, $x0, %bb.2 + bb.1: + SW $x0, killed %1:gpr, 0 :: (volatile store 4 into %stack.0, align 4) + bb.2: + PseudoRET diff --git a/polly/lib/Transform/ForwardOpTree.cpp b/polly/lib/Transform/ForwardOpTree.cpp index 141ac26b714d86..f2cb80db71a622 100644 --- a/polly/lib/Transform/ForwardOpTree.cpp +++ b/polly/lib/Transform/ForwardOpTree.cpp @@ -487,6 +487,7 @@ class ForwardOpTreeImpl : ZoneAlgorithm { LLVM_DEBUG( dbgs() << " forwarded known load with preexisting MemoryAccess" << Access << "\n"); + (void)Access; NumKnownLoadsForwarded++; TotalKnownLoadsForwarded++; @@ -574,6 +575,7 @@ class ForwardOpTreeImpl : ZoneAlgorithm { MemoryAccess *Access = makeReadArrayAccess(TargetStmt, LI, SameVal); LLVM_DEBUG(dbgs() << " forwarded known load with new MemoryAccess" << Access << "\n"); + (void)Access; if (LocalTranslator) Translator = Translator.add_map(LocalTranslator);