llvm/test
Duncan P. N. Exon Smith 698c0a7097 ValueMapper: Treat LocalAsMetadata more like function-local Values
This is a partial re-commit -- maybe more of a re-implementation -- of
r265631 (reverted in r265637).

This makes RF_IgnoreMissingLocals behave (almost) consistently between
the Value and the Metadata hierarchy.  In particular:

  - MapValue returns nullptr or "metadata !{}" for missing locals in
    MetadataAsValue/LocalAsMetadata bridging paris, depending on
    the RF_IgnoreMissingLocals flag.

  - MapValue doesn't memoize LocalAsMetadata-related results.

  - MapMetadata no longer deals with LocalAsMetadata or
    RF_IgnoreMissingLocals at all.  (This wasn't in r265631 at all, but
    I realized during testing it would make the patch simpler with no
    loss of generality.)

r265631 went too far, making both functions universally ignore
RF_IgnoreMissingLocals.  This broke building (e.g.) compiler-rt.
Reassociate (and possibly other passes) don't currently maintain
dominates-use invariants for metadata operands, resulting in IR like
this:

    define void @foo(i32 %arg) {
      call void @llvm.some.intrinsic(metadata i32 %x)
      %x = add i32 1, i32 %arg
    }

If the inliner chooses to inline @foo into another function, then
RemapInstruction will call `MapValue(metadata i32 %x)` and assert that
the return is not nullptr.

I've filed PR27273 to add a Verifier check and fix the underlying
problem in the optimization passes.

As a workaround, return `!{}` instead of nullptr for unmapped
LocalAsMetadata when RF_IgnoreMissingLocals is unset.  Otherwise, match
the behaviour of r265631.

Original commit message:

    ValueMapper: Make LocalAsMetadata match function-local Values

    Start treating LocalAsMetadata similarly to function-local members of
    the Value hierarchy in MapValue and MapMetadata.

      - Don't memoize them.
      - Return nullptr if they are missing.

    This also cleans up ConstantAsMetadata to stop listening to the
    RF_IgnoreMissingLocals flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265759 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 00:33:44 +00:00
..
Analysis AMDGPU: Add a shader calling convention 2016-04-06 19:40:20 +00:00
Assembler Fix test/Assembler/ifunc-asm.ll test on hexagon-elf bots 2016-04-07 13:18:43 +00:00
Bindings [OCaml] Reinstate data_layout 2016-04-01 07:54:24 +00:00
Bitcode [GCC] Attribute ifunc support in llvm 2016-04-07 12:32:19 +00:00
BugPoint
CodeGen Do not select EhPad BB in MachineBlockPlacement when there is regular BB to schedule 2016-04-07 21:29:39 +00:00
DebugInfo Add missing emissionKind flags to the DICompileUnits of several old testcases. 2016-04-01 22:18:43 +00:00
Examples
ExecutionEngine
Feature
FileCheck
Instrumentation [sancov] enabling coverage edge pruning by default. 2016-04-06 23:24:37 +00:00
Integer
JitListener testcase gardening: update the emissionKind enum to the new syntax. (NFC) 2016-04-01 00:16:49 +00:00
LibDriver
Linker testcase gardening: update the emissionKind enum to the new syntax. (NFC) 2016-04-01 00:16:49 +00:00
LTO [LoopVectorize] Don't unconditionally print vectorization diagnostics 2016-04-01 00:34:39 +00:00
MC [AMDGPU] fix readlane/readfirstlane src vgpr operand type. 2016-04-07 13:41:51 +00:00
Object [AMDGPU] llvm-objdump: Minimal HSA Code Object disassembler support. 2016-04-07 07:24:01 +00:00
Other
SymbolRewriter
TableGen
ThinLTO/X86 ThinLTO: special handling for LinkOnce functions 2016-04-01 21:53:50 +00:00
tools Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
Transforms ValueMapper: Treat LocalAsMetadata more like function-local Values 2016-04-08 00:33:44 +00:00
Unit
Verifier [IR/Verifier] Fix (yet another) crash. 2016-04-08 00:01:32 +00:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg test: Always treat .mir files as tests even outside of CodeGen/MIR 2016-04-04 21:23:44 +00:00
lit.site.cfg.in
TestRunner.sh