Commit Graph

133303 Commits

Author SHA1 Message Date
Quentin Colombet
75072bc260 [RegBankSelect] Use RegisterBankInfo applyMapping method.
The RegBankSelect pass can now rely on the target to do the remapping of
the instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:45:04 +00:00
Vedant Kumar
8a025f711a [ProfileData] Update llvm's copy of InstrProfData.inc
The new version of the header introduces the INSTR_PROF_VISIBILITY
macro. See http://reviews.llvm.org/D21116 for more details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:39:32 +00:00
Quentin Colombet
5972504d7b [RegisterBankInfo] Implement the method to apply a mapping.
Now, the target will be able to provide its how implementation to remap
an instruction. This open the way to crazier optimizations, but to
beginning with, we will be able to handle something else than the
default mapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272165 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:39:21 +00:00
Quentin Colombet
05d61b46ed [RegBankSelect] Use the OperandMapper class to hold remap information.
Now that we have an entity that hold the remap information the
rewritting should be easier to do.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272164 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:30:55 +00:00
Quentin Colombet
cf4d78fc0d [RegBankSelect] Use const_iterator instead of iterator for repairReg.
The repairing code has no reason to change the source or destination of
the registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272163 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:24:55 +00:00
Quentin Colombet
94a69dc2a1 [RegisterBankInfo] Introduce OperandsMapper class.
This helper class is used to encapsulate the necessary information
to remap an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:18:13 +00:00
Quentin Colombet
4a3ecf8a53 [Target] Introduce a generic opcode for bitwise OR: G_OR.
This G_OR is used in GlobalISel to represent bitwise OR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272160 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 16:12:19 +00:00
Quentin Colombet
470be6185a [RegBankSelect] Introduce a command line option to override the running mode.
When the command line option is set, it overrides any thing that the
target may have set. The rationale is that we get what we asked for.

Options are respectively regbankselect-fast and regbankselect-greedy for
fast and greedy mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272158 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 15:49:23 +00:00
Quentin Colombet
ad15246a5e [RegBankSelect] Explain what it would take to support non-copy
repairing.

Copies are easy because we repair only when there is a mismatch. For
non-copy repairing, i.e., cases that involves breaking down or gathering
up the value, one of the operand may not have a register bank yet. Thus,
derivate a cost from that, requires more work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272157 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 15:40:32 +00:00
Oliver Stannard
25429add0f [ARM] MSR instructions implicitly set CPSR
The MSR instructions can write to the CPSR, but we did not model this
fact, so we could emit them in the middle of IT blocks, changing the
condition flags for later instructions in the block.

The tests use two calls to llvm.write_register.i32 because it is valid
to use these instructions at the end of an IT block, which if conversion
does do in some cases. With two calls, the first clobbers the flags, so
a branch has to be used to make the second one conditional.

Differential Revision: http://reviews.llvm.org/D21139



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272154 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 15:26:34 +00:00
Daniel Dunbar
3a7c4849b7 [lit] Ensure we get bytes when reading redirected output files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272147 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 14:41:44 +00:00
Saleem Abdulrasool
e169351252 Support: correct AArch64 TargetParser implementation
The architecture enumeration is shared across ARM and AArch64.  However, the
data is not.  The code incorrectly would index into the array using the
architecture index which was offset by the ARMv7 architecture enumeration.  We
do not have a marker for indicating the architectural family to which the
enumeration belongs so we cannot be clever about offsetting the index (at least
it is not immediately apparent to me).  Instead, fall back to the tried-and-true
method of slowly iterating the array (its not a large array, so the impact of
this is not too high).

Because of the incorrect indexing, if we were lucky, we would crash, but usually
we would return an invalid StringRef.  We did not have any tests for the AArch64
target parser previously;.  Extend the previous tests I had added for ARM to
cover AArch64 for ensuring that we return expected StringRefs.

Take the opportunity to change some iterator types to references.

This work is needed to support parsing `.arch name` directives in the AArch64
target asm parser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 14:30:00 +00:00
Davide Italiano
a99c29794a [PM] LoopSimplify. Remove unneeded pass dependencies. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272140 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 13:56:59 +00:00
Davide Italiano
9491ddb86e [PM/SimplifyCFG] Preserve GlobalsAA even if the IR is mutated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272139 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 13:32:23 +00:00
Vasileios Kalintiris
a0fa31c900 [mips] Add a proper file header in MipsFastISel.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 13:13:15 +00:00
Krzysztof Parzyszek
7bf435bbe7 [Hexagon] Modify HexagonExpandCondsets to handle subregisters
Also, switch to using functions from LiveIntervalAnalysis to update
live intervals, instead of performing the updates manually.

Re-committing r272045.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 12:31:16 +00:00
Diana Picus
c5d0b1da6e [ARM] Remove redundant check. NFC
isSwift is tested earlier and known to be false when we reach this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272127 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 10:29:02 +00:00
Benjamin Kramer
04a303b821 Avoid copies of std::strings and APInt/APFloats where we only read from it
As suggested by clang-tidy's performance-unnecessary-copy-initialization.
This can easily hit lifetime issues, so I audited every change and ran the
tests under asan, which came back clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 10:01:20 +00:00
Igor Breger
1e48871118 [AVX512] Fix cvtusi2sd instruction Opcode, it should be 0x7B instead of 0x2A.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272122 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 07:48:23 +00:00
Matt Arsenault
c9cf0c849e Make LiveDebugValues preserve CFG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 05:18:01 +00:00
Kostya Serebryany
819b4d1da2 [libFuzzer] add 'weak' back to __sanitizer_malloc_hook and __sanitizer_free_hook
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272116 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 04:49:29 +00:00
Kostya Serebryany
fd9cb1a5c5 [libFuzzer] add a test that is built w/o coverage instrumentation but has the coverage rt (it should now fail with a descriptive message)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:46:13 +00:00
Kostya Serebryany
9f5007947e [libFuzzer] docs: merge two lines with cmake instructions, add -DLLVM_ENABLE_ASSERTIONS=ON
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:31:40 +00:00
Quentin Colombet
d292b5eaf2 [AArch64][RegisterBankInfo] Use the generic implementation of copyCost.
Long term we may want to give high cost at FPR to/from GPR copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272086 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:24:00 +00:00
Quentin Colombet
178ae081fb [RegisterBankInfo] Adapt the copy cost logic to give something sane by default.
The generic implementation stated that all copies were free, which is
unlikely. Now, only the copies within the same register bank are free.
We assume they will get coalesced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:17:10 +00:00
Quentin Colombet
edb4f7c12a [RegisterBankInfo] Add a size argument for the cost of copy.
The cost of a copy may be different based on how many bits we have to
copy around. E.g., a 8-bit copy may be different than a 32-bit copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:11:03 +00:00
Quentin Colombet
5c05d4112b [RegisterBankInfo] Move a hidden function into a static method. NFC.
This will allow code reuse in the coming commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 01:04:32 +00:00
Matthias Braun
0f19dc2756 MIR: Fix parsing of stack object references in MachineMemOperands
The MachineMemOperand parser lacked the code to handle %stack.X
references (%fixed-stack.X was working).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272082 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 00:47:07 +00:00
Zachary Turner
44e9b3090f [pdb] Try to fix use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 00:25:08 +00:00
Peter Collingbourne
fa27f925be IR: Call dropAllReferences from GlobalVariable's destructor.
We were previously failing to do this and as a result failing to drop
attached metadata.

Not sure if there's a good way to test this. An in-progress patch exposed this
problem by allocating a GlobalVariable at the same address as a previously
allocated GlobalVariable.

Differential Revision: http://reviews.llvm.org/D21109

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 00:13:39 +00:00
Rui Ueyama
5ae402a784 [pdbdump] Print out # of hash buckets.
In the reference code, the field name is `cHashBuckets`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:53:43 +00:00
Rui Ueyama
650053d1ce [pdbdump] Print out TPI hash key size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:44:27 +00:00
Dan Liew
1a1c8bea2d [LibFuzzer] Declare and use sanitizer functions in `fuzzer::ExternalFunctions`
This fixes linking problems on OSX.

Unfortunately it turns out we need to use an instance of the
``fuzzer::ExternalFunctions`` object in several places so this
commit also replaces all instances with a single global instance.

It also turns out initializing a global ``fuzzer::ExternalFunctions``
before main is entered (i.e. letting the object be initialised by the
global initializers) is not safe (on OSX the call to ``Printf()`` in the
CTOR crashes if it is called from a global initializer) so we instead
have a global ``fuzzer::ExternalFunctions*`` and initialize it inside
``FuzzerDriver()``.

Multiple unit tests depend also depend on the
``fuzzer::ExternalFunctions*`` global so a ``main()`` function has been
added that initializes it before running any tests.

Differential Revision: http://reviews.llvm.org/D20943

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:32:50 +00:00
Kostya Serebryany
994c559755 [docs] fix the build by including ScudoHardenedAllocator into toc; mention SourceBasedCodeCoverage.html in libFuzzer docs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:13:54 +00:00
Vedant Kumar
192404027d Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"
Changes since the initial commit:
- Use echo instead of printf. This should side-step the character
  escaping issues on Windows.

Differential Revision: http://reviews.llvm.org/D20980

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 22:47:31 +00:00
Daniel Dunbar
8a560fc113 [lit] Ignore errors when decoding redirected output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 22:06:57 +00:00
Easwaran Raman
953ac69462 Use FileCheck instead of grepping for patterns. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 21:46:14 +00:00
George Burgess IV
dada9c0ac0 [CFLAA] Kill dead code/fix comments in StratifiedSets.
Also use default/delete instead of hand-written ctors.

Thanks to Jia Chen for bringing this stuff up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 21:41:18 +00:00
Nicolai Haehnle
2ac1fa00c9 AMDGPU: Add amdgpu-ps-wqm-outputs function attributes
Summary:
The presence of this attribute indicates that VGPR outputs should be computed
in whole quad mode. This will be used by Mesa for prolog pixel shaders, so
that derivatives can be taken of shader inputs computed by the prolog, fixing
a bug.

The generated code could certainly be improved: if a prolog pixel shader is
used (which isn't common in modern OpenGL - they're used for gl_Color, polygon
stipples, and forcing per-sample interpolation), Mesa will use this attribute
unconditionally, because it has to be conservative. So WQM may be used in the
prolog when it isn't really needed, and furthermore a silly back-and-forth
switch is likely to happen at the boundary between prolog and main shader
parts.

Fixing this is a bit involved: we'd first have to add a mechanism by which
LLVM writes the WQM-related input requirements to the main shader part binary,
and then Mesa specializes the prolog part accordingly. At that point, we may
as well just compile a monolithic shader...

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95130

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

Differential Revision: http://reviews.llvm.org/D20839

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 21:37:17 +00:00
Dan Liew
d3e1f7de2b [LibFuzzer] Split the fuzzer-oom.test into two tests.
This is necessary because the existing fuzzer-oom.test was Linux
specific due to its use of __sanitizer_print_memory_profile() which
is only available on Linux right now and so the test would fail on OSX.

Differential Revision: http://reviews.llvm.org/D20977

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 21:23:30 +00:00
Simon Pilgrim
3aa4772f49 [X86][SSE4A] Regenerated SSE4A intrinsics tests
There are no VEX encoded versions of SSE4A instructions, make sure that AVX targets give the same output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 21:15:45 +00:00
Zachary Turner
ca5b485311 [pdb] Fix broken unit test compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:46:39 +00:00
Zachary Turner
90d4a1bb6f [pdb] Convert StringRefs to ArrayRef<uint8_t>s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272058 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:38:37 +00:00
Reid Kleckner
2b8506b5b6 Add info to SourceLevelDebugging about CodeView
Adds some discussion of the nature of the format, and some developer
docs on how to work with it in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:27:30 +00:00
Eric Christopher
c2a7f10882 Revert "Differential Revision: http://reviews.llvm.org/D20557"
Author: Wei Ding <wei.ding2@amd.com>
Date:   Tue Jun 7 19:04:44 2016 +0000

    Differential Revision: http://reviews.llvm.org/D20557

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272044
    91177308-0d34-0410-b5e6-96231b3b80d8

as it was breaking the bots.

This reverts commit r272044.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272056 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:27:12 +00:00
Eric Christopher
3f950e9262 Reformat for some clarity and 80-columns. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272055 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:27:06 +00:00
Mike Aizatsky
b1953d8c1b [libfuzzer] custom crossover interface function.
Differential Revision: http://reviews.llvm.org/D21089

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:22:15 +00:00
Etienne Bergeron
70cf01c276 [stack-protection] Add support for MSVC buffer security check
Summary:
This patch is adding support for the MSVC buffer security check implementation

The buffer security check is turned on with the '/GS' compiler switch.
  * https://msdn.microsoft.com/en-us/library/8dbf701c.aspx
  * To be added to clang here: http://reviews.llvm.org/D20347

Some overview of buffer security check feature and implementation:
  * https://msdn.microsoft.com/en-us/library/aa290051(VS.71).aspx
  * http://www.ksyash.com/2011/01/buffer-overflow-protection-3/
  * http://blog.osom.info/2012/02/understanding-vs-c-compilers-buffer.html


For the following example:
```
int example(int offset, int index) {
  char buffer[10];
  memset(buffer, 0xCC, index);
  return buffer[index];
}
```

The MSVC compiler is adding these instructions to perform stack integrity check:
```
        push        ebp  
        mov         ebp,esp  
        sub         esp,50h  
  [1]   mov         eax,dword ptr [__security_cookie (01068024h)]  
  [2]   xor         eax,ebp  
  [3]   mov         dword ptr [ebp-4],eax  
        push        ebx  
        push        esi  
        push        edi  
        mov         eax,dword ptr [index]  
        push        eax  
        push        0CCh  
        lea         ecx,[buffer]  
        push        ecx  
        call        _memset (010610B9h)  
        add         esp,0Ch  
        mov         eax,dword ptr [index]  
        movsx       eax,byte ptr buffer[eax]  
        pop         edi  
        pop         esi  
        pop         ebx  
  [4]   mov         ecx,dword ptr [ebp-4]  
  [5]   xor         ecx,ebp  
  [6]   call        @__security_check_cookie@4 (01061276h)  
        mov         esp,ebp  
        pop         ebp  
        ret  
```

The instrumentation above is:
  * [1] is loading the global security canary,
  * [3] is storing the local computed ([2]) canary to the guard slot,
  * [4] is loading the guard slot and ([5]) re-compute the global canary,
  * [6] is validating the resulting canary with the '__security_check_cookie' and performs error handling.

Overview of the current stack-protection implementation:
  * lib/CodeGen/StackProtector.cpp
    * There is a default stack-protection implementation applied on intermediate representation.
    * The target can overload 'getIRStackGuard' method if it has a standard location for the stack protector cookie.
    * An intrinsic 'Intrinsic::stackprotector' is added to the prologue. It will be expanded by the instruction selection pass (DAG or Fast).
    * Basic Blocks are added to every instrumented function to receive the code for handling stack guard validation and errors handling.
    * Guard manipulation and comparison are added directly to the intermediate representation.

  * lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  * lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    * There is an implementation that adds instrumentation during instruction selection (for better handling of sibbling calls).
      * see long comment above 'class StackProtectorDescriptor' declaration.
    * The target needs to override 'getSDagStackGuard' to activate SDAG stack protection generation. (note: getIRStackGuard MUST be nullptr).
      * 'getSDagStackGuard' returns the appropriate stack guard (security cookie)
    * The code is generated by 'SelectionDAGBuilder.cpp' and 'SelectionDAGISel.cpp'.

  * include/llvm/Target/TargetLowering.h
    * Contains function to retrieve the default Guard 'Value'; should be overriden by each target to select which implementation is used and provide Guard 'Value'.

  * lib/Target/X86/X86ISelLowering.cpp
    * Contains the x86 specialisation; Guard 'Value' used by the SelectionDAG algorithm.

Function-based Instrumentation:
  * The MSVC doesn't inline the stack guard comparison in every function. Instead, a call to '__security_check_cookie' is added to the epilogue before every return instructions.
  * To support function-based instrumentation, this patch is
    * adding a function to get the function-based check (llvm 'Value', see include/llvm/Target/TargetLowering.h),
      * If provided, the stack protection instrumentation won't be inlined and a call to that function will be added to the prologue.
    * modifying (SelectionDAGISel.cpp) do avoid producing basic blocks used for inline instrumentation,
    * generating the function-based instrumentation during the ISEL pass (SelectionDAGBuilder.cpp),
    * if FastISEL (not SelectionDAG), using the fallback which rely on the same function-based implemented over intermediate representation (StackProtector.cpp).

Modifications
  * adding support for MSVC (lib/Target/X86/X86ISelLowering.cpp)
  * adding support function-based instrumentation (lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp, .h)

Results

  * IR generated instrumentation:
```
clang-cl /GS test.cc /Od /c -mllvm -print-isel-input
```

```
*** Final LLVM Code input to ISel ***

; Function Attrs: nounwind sspstrong
define i32 @"\01?example@@YAHHH@Z"(i32 %offset, i32 %index) #0 {
entry:
  %StackGuardSlot = alloca i8*                                                  <<<-- Allocated guard slot
  %0 = call i8* @llvm.stackguard()                                              <<<-- Loading Stack Guard value
  call void @llvm.stackprotector(i8* %0, i8** %StackGuardSlot)                  <<<-- Prologue intrinsic call (store to Guard slot)
  %index.addr = alloca i32, align 4
  %offset.addr = alloca i32, align 4
  %buffer = alloca [10 x i8], align 1
  store i32 %index, i32* %index.addr, align 4
  store i32 %offset, i32* %offset.addr, align 4
  %arraydecay = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 0
  %1 = load i32, i32* %index.addr, align 4
  call void @llvm.memset.p0i8.i32(i8* %arraydecay, i8 -52, i32 %1, i32 1, i1 false)
  %2 = load i32, i32* %index.addr, align 4
  %arrayidx = getelementptr inbounds [10 x i8], [10 x i8]* %buffer, i32 0, i32 %2
  %3 = load i8, i8* %arrayidx, align 1
  %conv = sext i8 %3 to i32
  %4 = load volatile i8*, i8** %StackGuardSlot                                  <<<-- Loading Guard slot
  call void @__security_check_cookie(i8* %4)                                    <<<-- Epilogue function-based check
  ret i32 %conv
}
```

  * SelectionDAG generated instrumentation:

```
clang-cl /GS test.cc /O1 /c /FA
```

```
"?example@@YAHHH@Z":                    # @"\01?example@@YAHHH@Z"
# BB#0:                                 # %entry
        pushl   %esi
        subl    $16, %esp
        movl    ___security_cookie, %eax                                        <<<-- Loading Stack Guard value
        movl    28(%esp), %esi
        movl    %eax, 12(%esp)                                                  <<<-- Store to Guard slot
        leal    2(%esp), %eax
        pushl   %esi
        pushl   $204
        pushl   %eax
        calll   _memset
        addl    $12, %esp
        movsbl  2(%esp,%esi), %esi
        movl    12(%esp), %ecx                                                  <<<-- Loading Guard slot
        calll   @__security_check_cookie@4                                      <<<-- Epilogue function-based check
        movl    %esi, %eax
        addl    $16, %esp
        popl    %esi
        retl
```

Reviewers: kcc, pcc, eugenis, rnk

Subscribers: majnemer, llvm-commits, hans, thakis, rnk

Differential Revision: http://reviews.llvm.org/D20346

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:15:35 +00:00
Daniel Dunbar
311dd52c44 [lit] Fix an uninitialized var on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 20:14:17 +00:00
Zachary Turner
babe1202e2 [yaml] Add a ScalarTraits for mapping endian aware types.
This allows mapping of any endian-aware type whose underlying
type (e.g. uint32_t) provides a ScalarTraits specialization.

Reviewed by: majnemer
Differential Revision: http://reviews.llvm.org/D21057

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 19:32:09 +00:00