<!doctype html><html>
<head>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<meta charset='UTF-8'>
<style>
.red {
background-color: #ffd0d0;
}
.cyan {
background-color: cyan;
}
body {
font-family: -apple-system, sans-serif;
}
pre {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
.source-name-title {
padding: 5px 10px;
border-bottom: 1px solid #dbdbdb;
background-color: #eee;
line-height: 35px;
}
.centered {
display: table;
margin-left: left;
margin-right: auto;
border: 1px solid #dbdbdb;
border-radius: 3px;
}
.expansion-view {
background-color: rgba(0, 0, 0, 0);
margin-left: 0px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
border: 1px solid #dbdbdb;
border-radius: 3px;
}
table {
border-collapse: collapse;
}
.light-row {
background: #ffffff;
border: 1px solid #dbdbdb;
}
.column-entry {
text-align: right;
}
.column-entry-left {
text-align: left;
}
.column-entry-yellow {
text-align: right;
background-color: #ffffd0;
}
.column-entry-red {
text-align: right;
background-color: #ffd0d0;
}
.column-entry-green {
text-align: right;
background-color: #d0ffd0;
}
.line-number {
text-align: right;
color: #aaa;
}
.covered-line {
text-align: right;
color: #0080ff;
}
.uncovered-line {
text-align: right;
color: #ff3300;
}
.tooltip {
position: relative;
display: inline;
background-color: #b3e6ff;
text-decoration: none;
}
.tooltip span.tooltip-content {
position: absolute;
width: 100px;
margin-left: -50px;
color: #FFFFFF;
background: #000000;
height: 30px;
line-height: 30px;
text-align: center;
visibility: hidden;
border-radius: 6px;
}
.tooltip span.tooltip-content:after {
content: '';
position: absolute;
top: 100%;
left: 50%;
margin-left: -8px;
width: 0; height: 0;
border-top: 8px solid #000000;
border-right: 8px solid transparent;
border-left: 8px solid transparent;
}
:hover.tooltip span.tooltip-content {
visibility: visible;
opacity: 0.8;
bottom: 30px;
left: 50%;
z-index: 999;
}
th, td {
vertical-align: top;
padding: 2px 5px;
border-collapse: collapse;
border-right: solid 1px #eee;
border-left: solid 1px #eee;
}
td:first-child {
border-left: none;
}
td:last-child {
border-right: none;
}
</style>
</head>
<body>
<h2>Coverage Report</h2>
<ul>
<li><a href='#ADDSUB'>llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp</a></li>
<li><a href='#ANDXOR'>llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp</a></li>
<li><a href='#CALLS'>llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp</a></li>
<li><a href='#CASTS'>llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp</a></li>
<li><a href='#COMPARES'>llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp</a></li>
<li><a href='#ALLOCA'>llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp</a></li>
<li><a href='#MULDIV'>llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp</a></li>
<li><a href='#PHI'>llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp</a></li>
<li><a href='#SELECT'>llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp</a></li>
<li><a href='#SHIFTS'>llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp</a></li>
<li><a href='#DEMANDED'>llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp</a></li>
<li><a href='#VECTOR'>llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp</a></li>
</ul>
<div class='centered'><table><div class='source-name-title'><pre><a name='ADDSUB' href='#ADDSUB'>lib/Transforms/InstCombine/InstCombineAddSub.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_ADDSUB_42'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1' href='#L_ADDSUB_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineAddSub.cpp ------------------------------------*- C++ -*-===//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_2' href='#L_ADDSUB_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_3' href='#L_ADDSUB_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_4' href='#L_ADDSUB_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_5' href='#L_ADDSUB_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_6' href='#L_ADDSUB_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_7' href='#L_ADDSUB_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_8' href='#L_ADDSUB_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_9' href='#L_ADDSUB_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_10' href='#L_ADDSUB_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visit functions for add, fadd, sub, and fsub.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_11' href='#L_ADDSUB_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_12' href='#L_ADDSUB_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_13' href='#L_ADDSUB_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_14' href='#L_ADDSUB_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_15' href='#L_ADDSUB_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/STLExtras.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_16' href='#L_ADDSUB_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_17' href='#L_ADDSUB_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DataLayout.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_18' href='#L_ADDSUB_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/GetElementPtrTypeIterator.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_19' href='#L_ADDSUB_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_20' href='#L_ADDSUB_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_21' href='#L_ADDSUB_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_22' href='#L_ADDSUB_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_23' href='#L_ADDSUB_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_24' href='#L_ADDSUB_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_25' href='#L_ADDSUB_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_26' href='#L_ADDSUB_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>namespace {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_27' href='#L_ADDSUB_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_28' href='#L_ADDSUB_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Class representing coefficient of floating-point addend.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_29' href='#L_ADDSUB_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// This class needs to be highly efficient, which is especially true for</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_30' href='#L_ADDSUB_30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// the constructor. As of I write this comment, the cost of the default</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_31' href='#L_ADDSUB_31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// constructor is merely 4-byte-store-zero (Assuming compiler is able to</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_32' href='#L_ADDSUB_32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// perform write-merging).</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_33' href='#L_ADDSUB_33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_34' href='#L_ADDSUB_34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> class FAddendCoef {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_35' href='#L_ADDSUB_35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_36' href='#L_ADDSUB_36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The constructor has to initialize a APFloat, which is unnecessary for</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_37' href='#L_ADDSUB_37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // most addends which have coefficient either 1 or -1. So, the constructor</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_38' href='#L_ADDSUB_38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // is expensive. In order to avoid the cost of the constructor, we should</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_39' href='#L_ADDSUB_39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // reuse some instances whenever possible. The pre-created instances</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_40' href='#L_ADDSUB_40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // FAddCombine::Add[0-5] embodies this idea.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_41' href='#L_ADDSUB_41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_42' href='#L_ADDSUB_42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> FAddendCoef() : IsFp(false), BufHasFpVal(false), IntVal(0) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_43' href='#L_ADDSUB_43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ~FAddendCoef();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_44' href='#L_ADDSUB_44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_45' href='#L_ADDSUB_45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void set(short C) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_46' href='#L_ADDSUB_46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(!insaneIntVal(C) && "Insane coefficient");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_47' href='#L_ADDSUB_47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsFp = false; IntVal = C;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_48' href='#L_ADDSUB_48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_49' href='#L_ADDSUB_49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_50' href='#L_ADDSUB_50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void set(const APFloat& C);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_51' href='#L_ADDSUB_51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_52' href='#L_ADDSUB_52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void negate();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_53' href='#L_ADDSUB_53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_54' href='#L_ADDSUB_54'><pre>54</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isZero() const <div class='tooltip'><span class='red'>{ return isInt() ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!IntVal</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>getFpVal().isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_55' href='#L_ADDSUB_55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *getValue(Type *) const;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_56' href='#L_ADDSUB_56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_57' href='#L_ADDSUB_57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // If possible, don't define operator+/operator- etc because these</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_58' href='#L_ADDSUB_58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // operators inevitably call FAddendCoef's constructor which is not cheap.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_59' href='#L_ADDSUB_59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void operator=(const FAddendCoef &A);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_60' href='#L_ADDSUB_60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void operator+=(const FAddendCoef &A);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_61' href='#L_ADDSUB_61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void operator*=(const FAddendCoef &S);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_62' href='#L_ADDSUB_62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_63' href='#L_ADDSUB_63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isOne() const <div class='tooltip'><span class='red'>{ return isInt() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IntVal == 1</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_64' href='#L_ADDSUB_64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isTwo() const <div class='tooltip'><span class='red'>{ return isInt() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IntVal == 2</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_65' href='#L_ADDSUB_65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isMinusOne() const <div class='tooltip'><span class='red'>{ return isInt() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IntVal == -1</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_66' href='#L_ADDSUB_66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isMinusTwo() const <div class='tooltip'><span class='red'>{ return isInt() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IntVal == -2</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_67' href='#L_ADDSUB_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_68' href='#L_ADDSUB_68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> private:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_69' href='#L_ADDSUB_69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool insaneIntVal(int V) <div class='tooltip'><span class='red'>{ return V > 4 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V < -4</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_70' href='#L_ADDSUB_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APFloat *getFpValPtr()</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_71' href='#L_ADDSUB_71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>{ return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_72' href='#L_ADDSUB_72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APFloat *getFpValPtr() const</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_73' href='#L_ADDSUB_73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>{ return reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]); }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_74' href='#L_ADDSUB_74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_75' href='#L_ADDSUB_75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const APFloat &getFpVal() const <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_76' href='#L_ADDSUB_76'><pre>76</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(IsFp && BufHasFpVal && "Incorret state");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_77' href='#L_ADDSUB_77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return *getFpValPtr();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_78' href='#L_ADDSUB_78'><pre>78</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_79' href='#L_ADDSUB_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_80' href='#L_ADDSUB_80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> APFloat &getFpVal() <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_81' href='#L_ADDSUB_81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(IsFp && BufHasFpVal && "Incorret state");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_82' href='#L_ADDSUB_82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return *getFpValPtr();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_83' href='#L_ADDSUB_83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_84' href='#L_ADDSUB_84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_85' href='#L_ADDSUB_85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isInt() const <span class='red'>{ return !IsFp; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_86' href='#L_ADDSUB_86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_87' href='#L_ADDSUB_87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // If the coefficient is represented by an integer, promote it to a</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_88' href='#L_ADDSUB_88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // floating point.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_89' href='#L_ADDSUB_89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void convertToFpType(const fltSemantics &Sem);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_90' href='#L_ADDSUB_90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_91' href='#L_ADDSUB_91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Construct an APFloat from a signed integer.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_92' href='#L_ADDSUB_92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // TODO: We should get rid of this function when APFloat can be constructed</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_93' href='#L_ADDSUB_93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // from an *SIGNED* integer.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_94' href='#L_ADDSUB_94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APFloat createAPFloatFromInt(const fltSemantics &Sem, int Val);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_95' href='#L_ADDSUB_95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_96' href='#L_ADDSUB_96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> private:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_97' href='#L_ADDSUB_97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bool IsFp;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_98' href='#L_ADDSUB_98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_99' href='#L_ADDSUB_99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // True iff FpValBuf contains an instance of APFloat.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_100' href='#L_ADDSUB_100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bool BufHasFpVal;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_101' href='#L_ADDSUB_101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_102' href='#L_ADDSUB_102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // The integer coefficient of an individual addend is either 1 or -1,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_103' href='#L_ADDSUB_103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // and we try to simplify at most 4 addends from neighboring at most</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_104' href='#L_ADDSUB_104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // two instructions. So the range of <IntVal> falls in [-4, 4]. APInt</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_105' href='#L_ADDSUB_105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // is overkill of this end.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_106' href='#L_ADDSUB_106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> short IntVal;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_107' href='#L_ADDSUB_107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_108' href='#L_ADDSUB_108'><pre>108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> AlignedCharArrayUnion<APFloat> FpValBuf;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_109' href='#L_ADDSUB_109'><pre>109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_110' href='#L_ADDSUB_110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_111' href='#L_ADDSUB_111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// FAddend is used to represent floating-point addend. An addend is</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_112' href='#L_ADDSUB_112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// represented as <C, V>, where the V is a symbolic value, and C is a</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_113' href='#L_ADDSUB_113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// constant coefficient. A constant addend is represented as <C, 0>.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_114' href='#L_ADDSUB_114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_115' href='#L_ADDSUB_115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> class FAddend {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_116' href='#L_ADDSUB_116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_117' href='#L_ADDSUB_117'><pre>117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> FAddend() : Val(nullptr) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_118' href='#L_ADDSUB_118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_119' href='#L_ADDSUB_119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *getSymVal() const <span class='red'>{ return Val; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_120' href='#L_ADDSUB_120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const FAddendCoef &getCoef() const <span class='red'>{ return Coeff; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_121' href='#L_ADDSUB_121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_122' href='#L_ADDSUB_122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isConstant() const <span class='red'>{ return Val == nullptr; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_123' href='#L_ADDSUB_123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool isZero() const <span class='red'>{ return Coeff.isZero(); }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_124' href='#L_ADDSUB_124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_125' href='#L_ADDSUB_125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void set(short Coefficient, Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_126' href='#L_ADDSUB_126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Coeff.set(Coefficient);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_127' href='#L_ADDSUB_127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_128' href='#L_ADDSUB_128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_129' href='#L_ADDSUB_129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void set(const APFloat &Coefficient, Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_130' href='#L_ADDSUB_130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Coeff.set(Coefficient);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_131' href='#L_ADDSUB_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_132' href='#L_ADDSUB_132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_133' href='#L_ADDSUB_133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void set(const ConstantFP *Coefficient, Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_134' href='#L_ADDSUB_134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Coeff.set(Coefficient->getValueAPF());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_135' href='#L_ADDSUB_135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_136' href='#L_ADDSUB_136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_137' href='#L_ADDSUB_137'><pre>137</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_138' href='#L_ADDSUB_138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void negate() <span class='red'>{ Coeff.negate(); }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_139' href='#L_ADDSUB_139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_140' href='#L_ADDSUB_140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Drill down the U-D chain one step to find the definition of V, and</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_141' href='#L_ADDSUB_141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// try to break the definition into one or two addends.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_142' href='#L_ADDSUB_142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static unsigned drillValueDownOneStep(Value* V, FAddend &A0, FAddend &A1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_143' href='#L_ADDSUB_143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_144' href='#L_ADDSUB_144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Similar to FAddend::drillDownOneStep() except that the value being</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_145' href='#L_ADDSUB_145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// splitted is the addend itself.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_146' href='#L_ADDSUB_146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned drillAddendDownOneStep(FAddend &Addend0, FAddend &Addend1) const;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_147' href='#L_ADDSUB_147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_148' href='#L_ADDSUB_148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void operator+=(const FAddend &T) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_149' href='#L_ADDSUB_149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((Val == T.Val) && "Symbolic-values disagree");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_150' href='#L_ADDSUB_150'><pre>150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Coeff += T.Coeff;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_151' href='#L_ADDSUB_151'><pre>151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_152' href='#L_ADDSUB_152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_153' href='#L_ADDSUB_153'><pre>153</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> private:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_154' href='#L_ADDSUB_154'><pre>154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void Scale(const FAddendCoef& ScaleAmt) <span class='red'>{ Coeff *= ScaleAmt; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_155' href='#L_ADDSUB_155'><pre>155</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_156' href='#L_ADDSUB_156'><pre>156</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // This addend has the value of "Coeff * Val".</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_157' href='#L_ADDSUB_157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *Val;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_158' href='#L_ADDSUB_158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FAddendCoef Coeff;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_159' href='#L_ADDSUB_159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_160' href='#L_ADDSUB_160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_161' href='#L_ADDSUB_161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// FAddCombine is the class for optimizing an unsafe fadd/fsub along</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_162' href='#L_ADDSUB_162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// with its neighboring at most two instructions.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_163' href='#L_ADDSUB_163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_164' href='#L_ADDSUB_164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> class FAddCombine {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_165' href='#L_ADDSUB_165'><pre>165</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> public:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_166' href='#L_ADDSUB_166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> FAddCombine(InstCombiner::BuilderTy *B) : Builder(B), Instr(nullptr) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_167' href='#L_ADDSUB_167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *simplify(Instruction *FAdd);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_168' href='#L_ADDSUB_168'><pre>168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_169' href='#L_ADDSUB_169'><pre>169</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> private:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_170' href='#L_ADDSUB_170'><pre>170</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> typedef SmallVector<const FAddend*, 4> AddendVect;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_171' href='#L_ADDSUB_171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_172' href='#L_ADDSUB_172'><pre>172</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *simplifyFAdd(AddendVect& V, unsigned InstrQuota);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_173' href='#L_ADDSUB_173'><pre>173</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_174' href='#L_ADDSUB_174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *performFactorization(Instruction *I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_175' href='#L_ADDSUB_175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_176' href='#L_ADDSUB_176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Convert given addend to a Value</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_177' href='#L_ADDSUB_177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createAddendVal(const FAddend &A, bool& NeedNeg);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_178' href='#L_ADDSUB_178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_179' href='#L_ADDSUB_179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> /// Return the number of instructions needed to emit the N-ary addition.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_180' href='#L_ADDSUB_180'><pre>180</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned calcInstrNumber(const AddendVect& Vect);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_181' href='#L_ADDSUB_181'><pre>181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createFSub(Value *Opnd0, Value *Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_182' href='#L_ADDSUB_182'><pre>182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createFAdd(Value *Opnd0, Value *Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_183' href='#L_ADDSUB_183'><pre>183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createFMul(Value *Opnd0, Value *Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_184' href='#L_ADDSUB_184'><pre>184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createFDiv(Value *Opnd0, Value *Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_185' href='#L_ADDSUB_185'><pre>185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createFNeg(Value *V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_186' href='#L_ADDSUB_186'><pre>186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *createNaryFAdd(const AddendVect& Opnds, unsigned InstrQuota);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_187' href='#L_ADDSUB_187'><pre>187</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void createInstPostProc(Instruction *NewInst, bool NoNumber = false);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_188' href='#L_ADDSUB_188'><pre>188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_189' href='#L_ADDSUB_189'><pre>189</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InstCombiner::BuilderTy *Builder;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_190' href='#L_ADDSUB_190'><pre>190</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *Instr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_191' href='#L_ADDSUB_191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_192' href='#L_ADDSUB_192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Debugging stuff are clustered here.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_193' href='#L_ADDSUB_193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #ifndef NDEBUG</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_194' href='#L_ADDSUB_194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned CreateInstrNum;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_195' href='#L_ADDSUB_195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void initCreateInstNum() <span class='red'>{ CreateInstrNum = 0; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_196' href='#L_ADDSUB_196'><pre>196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> void incCreateInstNum() <span class='red'>{ CreateInstrNum++; }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_197' href='#L_ADDSUB_197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #else</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_198' href='#L_ADDSUB_198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void initCreateInstNum() {}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_199' href='#L_ADDSUB_199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void incCreateInstNum() {}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_200' href='#L_ADDSUB_200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> #endif</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_201' href='#L_ADDSUB_201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_202' href='#L_ADDSUB_202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_203' href='#L_ADDSUB_203'><pre>203</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>} // anonymous namespace</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_204' href='#L_ADDSUB_204'><pre>204</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_205' href='#L_ADDSUB_205'><pre>205</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_206' href='#L_ADDSUB_206'><pre>206</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_207' href='#L_ADDSUB_207'><pre>207</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Implementation of</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_208' href='#L_ADDSUB_208'><pre>208</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// {FAddendCoef, FAddend, FAddition, FAddCombine}.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_209' href='#L_ADDSUB_209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_210' href='#L_ADDSUB_210'><pre>210</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_211' href='#L_ADDSUB_211'><pre>211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>FAddendCoef::~FAddendCoef() <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_212' href='#L_ADDSUB_212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>BufHasFpVal</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_213' href='#L_ADDSUB_213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>getFpValPtr()->~APFloat()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_214' href='#L_ADDSUB_214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_215' href='#L_ADDSUB_215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_216' href='#L_ADDSUB_216'><pre>216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::set(const APFloat& C) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_217' href='#L_ADDSUB_217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat *P = getFpValPtr();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_218' href='#L_ADDSUB_218'><pre>218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_219' href='#L_ADDSUB_219'><pre>219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isInt()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_220' href='#L_ADDSUB_220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // As the buffer is meanless byte stream, we cannot call</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_221' href='#L_ADDSUB_221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // APFloat::operator=().</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_222' href='#L_ADDSUB_222'><pre>222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> new(P) APFloat(C);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_223' href='#L_ADDSUB_223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_224' href='#L_ADDSUB_224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>*P = C</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_225' href='#L_ADDSUB_225'><pre>225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_226' href='#L_ADDSUB_226'><pre>226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsFp = BufHasFpVal = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_227' href='#L_ADDSUB_227'><pre>227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_228' href='#L_ADDSUB_228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_229' href='#L_ADDSUB_229'><pre>229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::convertToFpType(const fltSemantics &Sem) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_230' href='#L_ADDSUB_230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_231' href='#L_ADDSUB_231'><pre>231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_232' href='#L_ADDSUB_232'><pre>232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_233' href='#L_ADDSUB_233'><pre>233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APFloat *P = getFpValPtr();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_234' href='#L_ADDSUB_234'><pre>234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>IntVal > 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_235' href='#L_ADDSUB_235'><pre>235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>new(P) APFloat(Sem, IntVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_236' href='#L_ADDSUB_236'><pre>236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_237' href='#L_ADDSUB_237'><pre>237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> new(P) APFloat(Sem, 0 - IntVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_238' href='#L_ADDSUB_238'><pre>238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> P->changeSign();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_239' href='#L_ADDSUB_239'><pre>239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_240' href='#L_ADDSUB_240'><pre>240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsFp = BufHasFpVal = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_241' href='#L_ADDSUB_241'><pre>241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_242' href='#L_ADDSUB_242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_243' href='#L_ADDSUB_243'><pre>243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>APFloat FAddendCoef::createAPFloatFromInt(const fltSemantics &Sem, int Val) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_244' href='#L_ADDSUB_244'><pre>244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Val >= 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_245' href='#L_ADDSUB_245'><pre>245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return APFloat(Sem, Val)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_246' href='#L_ADDSUB_246'><pre>246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_247' href='#L_ADDSUB_247'><pre>247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APFloat T(Sem, 0 - Val);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_248' href='#L_ADDSUB_248'><pre>248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> T.changeSign();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_249' href='#L_ADDSUB_249'><pre>249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_250' href='#L_ADDSUB_250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return T</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_251' href='#L_ADDSUB_251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_252' href='#L_ADDSUB_252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_253' href='#L_ADDSUB_253'><pre>253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::operator=(const FAddendCoef &That) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_254' href='#L_ADDSUB_254'><pre>254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>That.isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_255' href='#L_ADDSUB_255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>set(That.IntVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_256' href='#L_ADDSUB_256'><pre>256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_257' href='#L_ADDSUB_257'><pre>257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>set(That.getFpVal())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_258' href='#L_ADDSUB_258'><pre>258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_259' href='#L_ADDSUB_259'><pre>259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_260' href='#L_ADDSUB_260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::operator+=(const FAddendCoef &That) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_261' href='#L_ADDSUB_261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum APFloat::roundingMode RndMode = APFloat::rmNearestTiesToEven;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_262' href='#L_ADDSUB_262'><pre>262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isInt() == That.isInt()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_263' href='#L_ADDSUB_263'><pre>263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_264' href='#L_ADDSUB_264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IntVal += That.IntVal</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_265' href='#L_ADDSUB_265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_266' href='#L_ADDSUB_266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>getFpVal().add(That.getFpVal(), RndMode)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_267' href='#L_ADDSUB_267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_268' href='#L_ADDSUB_268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_269' href='#L_ADDSUB_269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_270' href='#L_ADDSUB_270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isInt()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_271' href='#L_ADDSUB_271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APFloat &T = That.getFpVal();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_272' href='#L_ADDSUB_272'><pre>272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> convertToFpType(T.getSemantics());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_273' href='#L_ADDSUB_273'><pre>273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> getFpVal().add(T, RndMode);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_274' href='#L_ADDSUB_274'><pre>274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_275' href='#L_ADDSUB_275'><pre>275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_276' href='#L_ADDSUB_276'><pre>276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_277' href='#L_ADDSUB_277'><pre>277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APFloat &T = getFpVal();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_278' href='#L_ADDSUB_278'><pre>278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> T.add(createAPFloatFromInt(T.getSemantics(), That.IntVal), RndMode);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_279' href='#L_ADDSUB_279'><pre>279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_280' href='#L_ADDSUB_280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_281' href='#L_ADDSUB_281'><pre>281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::operator*=(const FAddendCoef &That) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_282' href='#L_ADDSUB_282'><pre>282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>That.isOne()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_283' href='#L_ADDSUB_283'><pre>283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_284' href='#L_ADDSUB_284'><pre>284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_285' href='#L_ADDSUB_285'><pre>285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>That.isMinusOne()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_286' href='#L_ADDSUB_286'><pre>286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> negate();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_287' href='#L_ADDSUB_287'><pre>287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_288' href='#L_ADDSUB_288'><pre>288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_289' href='#L_ADDSUB_289'><pre>289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_290' href='#L_ADDSUB_290'><pre>290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isInt() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>That.isInt()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_291' href='#L_ADDSUB_291'><pre>291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Res = IntVal * (int)That.IntVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_292' href='#L_ADDSUB_292'><pre>292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(!insaneIntVal(Res) && "Insane int value");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_293' href='#L_ADDSUB_293'><pre>293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntVal = Res;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_294' href='#L_ADDSUB_294'><pre>294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_295' href='#L_ADDSUB_295'><pre>295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_296' href='#L_ADDSUB_296'><pre>296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_297' href='#L_ADDSUB_297'><pre>297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const fltSemantics &Semantic =</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_298' href='#L_ADDSUB_298'><pre>298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isInt() ? </span><div class='tooltip'><span class='red'>That.getFpVal().getSemantics()</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>getFpVal().getSemantics()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_299' href='#L_ADDSUB_299'><pre>299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_300' href='#L_ADDSUB_300'><pre>300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_301' href='#L_ADDSUB_301'><pre>301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>convertToFpType(Semantic)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_302' href='#L_ADDSUB_302'><pre>302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat &F0 = getFpVal();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_303' href='#L_ADDSUB_303'><pre>303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_304' href='#L_ADDSUB_304'><pre>304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>That.isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_305' href='#L_ADDSUB_305'><pre>305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>F0.multiply(createAPFloatFromInt(Semantic, That.IntVal),</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_306' href='#L_ADDSUB_306'><pre>306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::rmNearestTiesToEven)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_307' href='#L_ADDSUB_307'><pre>307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_308' href='#L_ADDSUB_308'><pre>308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>F0.multiply(That.getFpVal(), APFloat::rmNearestTiesToEven)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_309' href='#L_ADDSUB_309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_310' href='#L_ADDSUB_310'><pre>310</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_311' href='#L_ADDSUB_311'><pre>311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddendCoef::negate() <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_312' href='#L_ADDSUB_312'><pre>312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isInt()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_313' href='#L_ADDSUB_313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IntVal = 0 - IntVal</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_314' href='#L_ADDSUB_314'><pre>314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_315' href='#L_ADDSUB_315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>getFpVal().changeSign()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_316' href='#L_ADDSUB_316'><pre>316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_317' href='#L_ADDSUB_317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_318' href='#L_ADDSUB_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddendCoef::getValue(Type *Ty) const <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_319' href='#L_ADDSUB_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return isInt() ?</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_320' href='#L_ADDSUB_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantFP::get(Ty, float(IntVal))</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_321' href='#L_ADDSUB_321'><pre>321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantFP::get(Ty->getContext(), getFpVal())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_322' href='#L_ADDSUB_322'><pre>322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_323' href='#L_ADDSUB_323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_324' href='#L_ADDSUB_324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The definition of <Val> Addends</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_325' href='#L_ADDSUB_325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// =========================================</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_326' href='#L_ADDSUB_326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// A + B <1, A>, <1,B></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_327' href='#L_ADDSUB_327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// A - B <1, A>, <1,B></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_328' href='#L_ADDSUB_328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// 0 - B <-1, B></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_329' href='#L_ADDSUB_329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// C * A, <C, A></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_330' href='#L_ADDSUB_330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// A + C <1, A> <C, NULL></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_331' href='#L_ADDSUB_331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// 0 +/- 0 <0, NULL> (corner case)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_332' href='#L_ADDSUB_332'><pre>332</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_333' href='#L_ADDSUB_333'><pre>333</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Legend: A and B are not constant, C is constant</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_334' href='#L_ADDSUB_334'><pre>334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_335' href='#L_ADDSUB_335'><pre>335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsigned FAddend::drillValueDownOneStep</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_336' href='#L_ADDSUB_336'><pre>336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (Value *Val, FAddend &Addend0, FAddend &Addend1) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_337' href='#L_ADDSUB_337'><pre>337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *I = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_338' href='#L_ADDSUB_338'><pre>338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Val || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!(I = dyn_cast<Instruction>(Val))</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_339' href='#L_ADDSUB_339'><pre>339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return 0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_340' href='#L_ADDSUB_340'><pre>340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_341' href='#L_ADDSUB_341'><pre>341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned Opcode = I->getOpcode();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_342' href='#L_ADDSUB_342'><pre>342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_343' href='#L_ADDSUB_343'><pre>343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opcode == Instruction::FAdd || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opcode == Instruction::FSub</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_344' href='#L_ADDSUB_344'><pre>344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP *C0, *C1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_345' href='#L_ADDSUB_345'><pre>345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0 = I->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_346' href='#L_ADDSUB_346'><pre>346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd1 = I->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_347' href='#L_ADDSUB_347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(C0 = dyn_cast<ConstantFP>(Opnd0)) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C0->isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_348' href='#L_ADDSUB_348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Opnd0 = nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_349' href='#L_ADDSUB_349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_350' href='#L_ADDSUB_350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(C1 = dyn_cast<ConstantFP>(Opnd1)) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1->isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_351' href='#L_ADDSUB_351'><pre>351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Opnd1 = nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_352' href='#L_ADDSUB_352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_353' href='#L_ADDSUB_353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_354' href='#L_ADDSUB_354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!C0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_355' href='#L_ADDSUB_355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend0.set(1, Opnd0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_356' href='#L_ADDSUB_356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_357' href='#L_ADDSUB_357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend0.set(C0, nullptr)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_358' href='#L_ADDSUB_358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_359' href='#L_ADDSUB_359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_360' href='#L_ADDSUB_360'><pre>360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_361' href='#L_ADDSUB_361'><pre>361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FAddend &Addend = Opnd0 ? </span><div class='tooltip'><span class='red'>Addend1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Addend0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_362' href='#L_ADDSUB_362'><pre>362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!C1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_363' href='#L_ADDSUB_363'><pre>363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend.set(1, Opnd1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_364' href='#L_ADDSUB_364'><pre>364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_365' href='#L_ADDSUB_365'><pre>365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend.set(C1, nullptr)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_366' href='#L_ADDSUB_366'><pre>366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opcode == Instruction::FSub</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_367' href='#L_ADDSUB_367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend.negate()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_368' href='#L_ADDSUB_368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_369' href='#L_ADDSUB_369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_370' href='#L_ADDSUB_370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd0 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_371' href='#L_ADDSUB_371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>return Opnd0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'> ? </span><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_372' href='#L_ADDSUB_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_373' href='#L_ADDSUB_373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Both operands are zero. Weird!</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_374' href='#L_ADDSUB_374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend0.set(APFloat(C0->getValueAPF().getSemantics()), nullptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_375' href='#L_ADDSUB_375'><pre>375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return 1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_376' href='#L_ADDSUB_376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_377' href='#L_ADDSUB_377'><pre>377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_378' href='#L_ADDSUB_378'><pre>378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I->getOpcode() == Instruction::FMul</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_379' href='#L_ADDSUB_379'><pre>379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V0 = I->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_380' href='#L_ADDSUB_380'><pre>380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V1 = I->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_381' href='#L_ADDSUB_381'><pre>381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantFP *</span><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(V0)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_382' href='#L_ADDSUB_382'><pre>382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Addend0.set(C, V1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_383' href='#L_ADDSUB_383'><pre>383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_384' href='#L_ADDSUB_384'><pre>384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_385' href='#L_ADDSUB_385'><pre>385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_386' href='#L_ADDSUB_386'><pre>386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantFP *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(V1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_387' href='#L_ADDSUB_387'><pre>387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Addend0.set(C, V0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_388' href='#L_ADDSUB_388'><pre>388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_389' href='#L_ADDSUB_389'><pre>389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_390' href='#L_ADDSUB_390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_391' href='#L_ADDSUB_391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_392' href='#L_ADDSUB_392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return 0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_393' href='#L_ADDSUB_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_394' href='#L_ADDSUB_394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_395' href='#L_ADDSUB_395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Try to break *this* addend into two addends. e.g. Suppose this addend is</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_396' href='#L_ADDSUB_396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// <2.3, V>, and V = X + Y, by calling this function, we obtain two addends,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_397' href='#L_ADDSUB_397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// i.e. <2.3, X> and <2.3, Y>.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_398' href='#L_ADDSUB_398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_399' href='#L_ADDSUB_399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>unsigned FAddend::drillAddendDownOneStep</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_400' href='#L_ADDSUB_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (FAddend &Addend0, FAddend &Addend1) const <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_401' href='#L_ADDSUB_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isConstant()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_402' href='#L_ADDSUB_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return 0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_403' href='#L_ADDSUB_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_404' href='#L_ADDSUB_404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned BreakNum = FAddend::drillValueDownOneStep(Val, Addend0, Addend1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_405' href='#L_ADDSUB_405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!BreakNum || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Coeff.isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_406' href='#L_ADDSUB_406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BreakNum</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_407' href='#L_ADDSUB_407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_408' href='#L_ADDSUB_408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend0.Scale(Coeff);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_409' href='#L_ADDSUB_409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_410' href='#L_ADDSUB_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>BreakNum == 2</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_411' href='#L_ADDSUB_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Addend1.Scale(Coeff)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_412' href='#L_ADDSUB_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_413' href='#L_ADDSUB_413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BreakNum</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_414' href='#L_ADDSUB_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_415' href='#L_ADDSUB_415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_416' href='#L_ADDSUB_416'><pre>416</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Try to perform following optimization on the input instruction I. Return the</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_417' href='#L_ADDSUB_417'><pre>417</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// simplified expression if was successful; otherwise, return 0.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_418' href='#L_ADDSUB_418'><pre>418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_419' href='#L_ADDSUB_419'><pre>419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Instruction "I" is Simplified into</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_420' href='#L_ADDSUB_420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// -------------------------------------------------------</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_421' href='#L_ADDSUB_421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// (x * y) +/- (x * z) x * (y +/- z)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_422' href='#L_ADDSUB_422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// (y / x) +/- (z / x) (y +/- z) / x</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_423' href='#L_ADDSUB_423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_424' href='#L_ADDSUB_424'><pre>424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::performFactorization(Instruction *I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_425' href='#L_ADDSUB_425'><pre>425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((I->getOpcode() == Instruction::FAdd ||</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_426' href='#L_ADDSUB_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->getOpcode() == Instruction::FSub) && "Expect add/sub");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_427' href='#L_ADDSUB_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_428' href='#L_ADDSUB_428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *I0 = dyn_cast<Instruction>(I->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_429' href='#L_ADDSUB_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *I1 = dyn_cast<Instruction>(I->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_430' href='#L_ADDSUB_430'><pre>430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_431' href='#L_ADDSUB_431'><pre>431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!I0 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!I1</span><span class='tooltip-content'>0</span></div><span class='red'> || </span><div class='tooltip'><span class='red'>I0->getOpcode() != I1->getOpcode()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_432' href='#L_ADDSUB_432'><pre>432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_433' href='#L_ADDSUB_433'><pre>433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_434' href='#L_ADDSUB_434'><pre>434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool isMpy = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_435' href='#L_ADDSUB_435'><pre>435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I0->getOpcode() == Instruction::FMul</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_436' href='#L_ADDSUB_436'><pre>436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>isMpy = true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_437' href='#L_ADDSUB_437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I0->getOpcode() != Instruction::FDiv</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_438' href='#L_ADDSUB_438'><pre>438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_439' href='#L_ADDSUB_439'><pre>439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_440' href='#L_ADDSUB_440'><pre>440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Opnd0_0 = I0->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_441' href='#L_ADDSUB_441'><pre>441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0_1 = I0->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_442' href='#L_ADDSUB_442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd1_0 = I1->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_443' href='#L_ADDSUB_443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd1_1 = I1->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_444' href='#L_ADDSUB_444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_445' href='#L_ADDSUB_445'><pre>445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Input Instr I Factor AddSub0 AddSub1</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_446' href='#L_ADDSUB_446'><pre>446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ----------------------------------------------</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_447' href='#L_ADDSUB_447'><pre>447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (x*y) +/- (x*z) x y z</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_448' href='#L_ADDSUB_448'><pre>448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (y/x) +/- (z/x) x y z</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_449' href='#L_ADDSUB_449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_450' href='#L_ADDSUB_450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Factor = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_451' href='#L_ADDSUB_451'><pre>451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *AddSub0 = nullptr, *AddSub1 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_452' href='#L_ADDSUB_452'><pre>452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_453' href='#L_ADDSUB_453'><pre>453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isMpy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_454' href='#L_ADDSUB_454'><pre>454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd0_0 == Opnd1_0 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_0 == Opnd1_1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_455' href='#L_ADDSUB_455'><pre>455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Factor = Opnd0_0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_456' href='#L_ADDSUB_456'><pre>456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_1 == Opnd1_0 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_1 == Opnd1_1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_457' href='#L_ADDSUB_457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Factor = Opnd0_1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_458' href='#L_ADDSUB_458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_459' href='#L_ADDSUB_459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Factor</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_460' href='#L_ADDSUB_460'><pre>460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddSub0 = (Factor == Opnd0_0) ? </span><div class='tooltip'><span class='red'>Opnd0_1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Opnd0_0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_461' href='#L_ADDSUB_461'><pre>461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddSub1 = (Factor == Opnd1_0) ? </span><div class='tooltip'><span class='red'>Opnd1_1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Opnd1_0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_462' href='#L_ADDSUB_462'><pre>462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_463' href='#L_ADDSUB_463'><pre>463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_1 == Opnd1_1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_464' href='#L_ADDSUB_464'><pre>464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Factor = Opnd0_1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_465' href='#L_ADDSUB_465'><pre>465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddSub0 = Opnd0_0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_466' href='#L_ADDSUB_466'><pre>466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddSub1 = Opnd1_0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_467' href='#L_ADDSUB_467'><pre>467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_468' href='#L_ADDSUB_468'><pre>468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_469' href='#L_ADDSUB_469'><pre>469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Factor</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_470' href='#L_ADDSUB_470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_471' href='#L_ADDSUB_471'><pre>471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_472' href='#L_ADDSUB_472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>FastMathFlags Flags;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_473' href='#L_ADDSUB_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Flags.setUnsafeAlgebra();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_474' href='#L_ADDSUB_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>I0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>Flags &= I->getFastMathFlags()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_475' href='#L_ADDSUB_475'><pre>475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>I1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>Flags &= I->getFastMathFlags()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_476' href='#L_ADDSUB_476'><pre>476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_477' href='#L_ADDSUB_477'><pre>477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Create expression "NewAddSub = AddSub0 +/- AddsSub1"</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_478' href='#L_ADDSUB_478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAddSub = (I->getOpcode() == Instruction::FAdd) ?</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_479' href='#L_ADDSUB_479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createFAdd(AddSub0, AddSub1)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_480' href='#L_ADDSUB_480'><pre>480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createFSub(AddSub0, AddSub1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_481' href='#L_ADDSUB_481'><pre>481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantFP *</span><div class='tooltip'><span class='red'>CFP</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(NewAddSub)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_482' href='#L_ADDSUB_482'><pre>482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APFloat &F = CFP->getValueAPF();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_483' href='#L_ADDSUB_483'><pre>483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!F.isNormal()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_484' href='#L_ADDSUB_484'><pre>484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_485' href='#L_ADDSUB_485'><pre>485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (Instruction *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Instruction>(NewAddSub))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_486' href='#L_ADDSUB_486'><pre>486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->setFastMathFlags(Flags)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_487' href='#L_ADDSUB_487'><pre>487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_488' href='#L_ADDSUB_488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isMpy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_489' href='#L_ADDSUB_489'><pre>489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RI = createFMul(Factor, NewAddSub);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_490' href='#L_ADDSUB_490'><pre>490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>II</span><span class='red'> = dyn_cast<Instruction>(RI))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_491' href='#L_ADDSUB_491'><pre>491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->setFastMathFlags(Flags)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_492' href='#L_ADDSUB_492'><pre>492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_493' href='#L_ADDSUB_493'><pre>493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_494' href='#L_ADDSUB_494'><pre>494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_495' href='#L_ADDSUB_495'><pre>495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *RI = createFDiv(NewAddSub, Factor);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_496' href='#L_ADDSUB_496'><pre>496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>II</span><span class='red'> = dyn_cast<Instruction>(RI))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_497' href='#L_ADDSUB_497'><pre>497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->setFastMathFlags(Flags)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_498' href='#L_ADDSUB_498'><pre>498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RI</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_499' href='#L_ADDSUB_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_500' href='#L_ADDSUB_500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_501' href='#L_ADDSUB_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::simplify(Instruction *I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_502' href='#L_ADDSUB_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(I->hasUnsafeAlgebra() && "Should be in unsafe mode");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_503' href='#L_ADDSUB_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_504' href='#L_ADDSUB_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Currently we are not able to handle vector type.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_505' href='#L_ADDSUB_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I->getType()->isVectorTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_506' href='#L_ADDSUB_506'><pre>506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_507' href='#L_ADDSUB_507'><pre>507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_508' href='#L_ADDSUB_508'><pre>508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>((I->getOpcode() == Instruction::FAdd ||</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_509' href='#L_ADDSUB_509'><pre>509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->getOpcode() == Instruction::FSub) && "Expect add/sub");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_510' href='#L_ADDSUB_510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_511' href='#L_ADDSUB_511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Save the instruction before calling other member-functions.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_512' href='#L_ADDSUB_512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instr = I;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_513' href='#L_ADDSUB_513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_514' href='#L_ADDSUB_514'><pre>514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FAddend Opnd0, Opnd1, Opnd0_0, Opnd0_1, Opnd1_0, Opnd1_1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_515' href='#L_ADDSUB_515'><pre>515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_516' href='#L_ADDSUB_516'><pre>516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned OpndNum = FAddend::drillValueDownOneStep(I, Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_517' href='#L_ADDSUB_517'><pre>517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_518' href='#L_ADDSUB_518'><pre>518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Step 1: Expand the 1st addend into Opnd0_0 and Opnd0_1.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_519' href='#L_ADDSUB_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Opnd0_ExpNum = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_520' href='#L_ADDSUB_520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Opnd1_ExpNum = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_521' href='#L_ADDSUB_521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_522' href='#L_ADDSUB_522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Opnd0.isConstant()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_523' href='#L_ADDSUB_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Opnd0_ExpNum = Opnd0.drillAddendDownOneStep(Opnd0_0, Opnd0_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_524' href='#L_ADDSUB_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_525' href='#L_ADDSUB_525'><pre>525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Step 2: Expand the 2nd addend into Opnd1_0 and Opnd1_1.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_526' href='#L_ADDSUB_526'><pre>526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>OpndNum == 2 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!Opnd1.isConstant()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_527' href='#L_ADDSUB_527'><pre>527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Opnd1_ExpNum = Opnd1.drillAddendDownOneStep(Opnd1_0, Opnd1_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_528' href='#L_ADDSUB_528'><pre>528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_529' href='#L_ADDSUB_529'><pre>529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Step 3: Try to optimize Opnd0_0 + Opnd0_1 + Opnd1_0 + Opnd1_1</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_530' href='#L_ADDSUB_530'><pre>530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd0_ExpNum && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd1_ExpNum</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_531' href='#L_ADDSUB_531'><pre>531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddendVect AllOpnds;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_532' href='#L_ADDSUB_532'><pre>532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd0_0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_533' href='#L_ADDSUB_533'><pre>533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd1_0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_534' href='#L_ADDSUB_534'><pre>534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd0_ExpNum == 2</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_535' href='#L_ADDSUB_535'><pre>535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AllOpnds.push_back(&Opnd0_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_536' href='#L_ADDSUB_536'><pre>536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd1_ExpNum == 2</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_537' href='#L_ADDSUB_537'><pre>537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AllOpnds.push_back(&Opnd1_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_538' href='#L_ADDSUB_538'><pre>538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_539' href='#L_ADDSUB_539'><pre>539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Compute instruction quota. We should save at least one instruction.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_540' href='#L_ADDSUB_540'><pre>540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InstQuota = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_541' href='#L_ADDSUB_541'><pre>541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_542' href='#L_ADDSUB_542'><pre>542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V0 = I->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_543' href='#L_ADDSUB_543'><pre>543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V1 = I->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_544' href='#L_ADDSUB_544'><pre>544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InstQuota = ((!isa<Constant>(V0) && </span><span class='red'>V0->hasOneUse()</span><span class='red'>) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_545' href='#L_ADDSUB_545'><pre>545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(!isa<Constant>(V1) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V1->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) ? </span><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_546' href='#L_ADDSUB_546'><pre>546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_547' href='#L_ADDSUB_547'><pre>547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>R</span><span class='red'> = simplifyFAdd(AllOpnds, InstQuota))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_548' href='#L_ADDSUB_548'><pre>548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return R</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_549' href='#L_ADDSUB_549'><pre>549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_550' href='#L_ADDSUB_550'><pre>550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_551' href='#L_ADDSUB_551'><pre>551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>OpndNum != 2</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_552' href='#L_ADDSUB_552'><pre>552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The input instruction is : "I=0.0 +/- V". If the "V" were able to be</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_553' href='#L_ADDSUB_553'><pre>553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // splitted into two addends, say "V = X - Y", the instruction would have</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_554' href='#L_ADDSUB_554'><pre>554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // been optimized into "I = Y - X" in the previous steps.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_555' href='#L_ADDSUB_555'><pre>555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_556' href='#L_ADDSUB_556'><pre>556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const FAddendCoef &CE = Opnd0.getCoef();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_557' href='#L_ADDSUB_557'><pre>557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CE.isOne() ? </span><div class='tooltip'><span class='red'>Opnd0.getSymVal()</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>nullptr</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_558' href='#L_ADDSUB_558'><pre>558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_559' href='#L_ADDSUB_559'><pre>559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_560' href='#L_ADDSUB_560'><pre>560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // step 4: Try to optimize Opnd0 + Opnd1_0 [+ Opnd1_1]</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_561' href='#L_ADDSUB_561'><pre>561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd1_ExpNum</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_562' href='#L_ADDSUB_562'><pre>562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddendVect AllOpnds;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_563' href='#L_ADDSUB_563'><pre>563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_564' href='#L_ADDSUB_564'><pre>564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd1_0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_565' href='#L_ADDSUB_565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd1_ExpNum == 2</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_566' href='#L_ADDSUB_566'><pre>566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AllOpnds.push_back(&Opnd1_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_567' href='#L_ADDSUB_567'><pre>567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_568' href='#L_ADDSUB_568'><pre>568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>R</span><span class='red'> = simplifyFAdd(AllOpnds, 1))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_569' href='#L_ADDSUB_569'><pre>569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return R</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_570' href='#L_ADDSUB_570'><pre>570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_571' href='#L_ADDSUB_571'><pre>571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_572' href='#L_ADDSUB_572'><pre>572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // step 5: Try to optimize Opnd1 + Opnd0_0 [+ Opnd0_1]</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_573' href='#L_ADDSUB_573'><pre>573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_ExpNum</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_574' href='#L_ADDSUB_574'><pre>574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddendVect AllOpnds;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_575' href='#L_ADDSUB_575'><pre>575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_576' href='#L_ADDSUB_576'><pre>576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllOpnds.push_back(&Opnd0_0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_577' href='#L_ADDSUB_577'><pre>577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd0_ExpNum == 2</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_578' href='#L_ADDSUB_578'><pre>578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AllOpnds.push_back(&Opnd0_1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_579' href='#L_ADDSUB_579'><pre>579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_580' href='#L_ADDSUB_580'><pre>580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>R</span><span class='red'> = simplifyFAdd(AllOpnds, 1))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_581' href='#L_ADDSUB_581'><pre>581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return R</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_582' href='#L_ADDSUB_582'><pre>582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_583' href='#L_ADDSUB_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_584' href='#L_ADDSUB_584'><pre>584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // step 6: Try factorization as the last resort,</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_585' href='#L_ADDSUB_585'><pre>585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return performFactorization(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_586' href='#L_ADDSUB_586'><pre>586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_587' href='#L_ADDSUB_587'><pre>587</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_588' href='#L_ADDSUB_588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::simplifyFAdd(AddendVect& Addends, unsigned InstrQuota) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_589' href='#L_ADDSUB_589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned AddendNum = Addends.size();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_590' href='#L_ADDSUB_590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(AddendNum <= 4 && "Too many addends");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_591' href='#L_ADDSUB_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_592' href='#L_ADDSUB_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // For saving intermediate results;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_593' href='#L_ADDSUB_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NextTmpIdx = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_594' href='#L_ADDSUB_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FAddend TmpResult[3];</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_595' href='#L_ADDSUB_595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_596' href='#L_ADDSUB_596'><pre>596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Points to the constant addend of the resulting simplified expression.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_597' href='#L_ADDSUB_597'><pre>597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the resulting expr has constant-addend, this constant-addend is</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_598' href='#L_ADDSUB_598'><pre>598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // desirable to reside at the top of the resulting expression tree. Placing</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_599' href='#L_ADDSUB_599'><pre>599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // constant close to supper-expr(s) will potentially reveal some optimization</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_600' href='#L_ADDSUB_600'><pre>600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // opportunities in super-expr(s).</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_601' href='#L_ADDSUB_601'><pre>601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_602' href='#L_ADDSUB_602'><pre>602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const FAddend *ConstAdd = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_603' href='#L_ADDSUB_603'><pre>603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_604' href='#L_ADDSUB_604'><pre>604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplified addends are placed <SimpVect>.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_605' href='#L_ADDSUB_605'><pre>605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddendVect SimpVect;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_606' href='#L_ADDSUB_606'><pre>606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_607' href='#L_ADDSUB_607'><pre>607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The outer loop works on one symbolic-value at a time. Suppose the input</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_608' href='#L_ADDSUB_608'><pre>608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // addends are : <a1, x>, <b1, y>, <a2, x>, <c1, z>, <b2, y>, ...</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_609' href='#L_ADDSUB_609'><pre>609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The symbolic-values will be processed in this order: x, y, z.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_610' href='#L_ADDSUB_610'><pre>610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_611' href='#L_ADDSUB_611'><pre>611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned SymIdx = 0; </span><div class='tooltip'><span class='red'>SymIdx < AddendNum</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>SymIdx++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_612' href='#L_ADDSUB_612'><pre>612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_613' href='#L_ADDSUB_613'><pre>613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const FAddend *ThisAddend = Addends[SymIdx];</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_614' href='#L_ADDSUB_614'><pre>614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!ThisAddend</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_615' href='#L_ADDSUB_615'><pre>615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This addend was processed before.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_616' href='#L_ADDSUB_616'><pre>616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_617' href='#L_ADDSUB_617'><pre>617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_618' href='#L_ADDSUB_618'><pre>618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_619' href='#L_ADDSUB_619'><pre>619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Val = ThisAddend->getSymVal();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_620' href='#L_ADDSUB_620'><pre>620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned StartIdx = SimpVect.size();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_621' href='#L_ADDSUB_621'><pre>621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpVect.push_back(ThisAddend);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_622' href='#L_ADDSUB_622'><pre>622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_623' href='#L_ADDSUB_623'><pre>623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The inner loop collects addends sharing same symbolic-value, and these</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_624' href='#L_ADDSUB_624'><pre>624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // addends will be later on folded into a single addend. Following above</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_625' href='#L_ADDSUB_625'><pre>625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // example, if the symbolic value "y" is being processed, the inner loop</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_626' href='#L_ADDSUB_626'><pre>626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // will collect two addends "<b1,y>" and "<b2,Y>". These two addends will</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_627' href='#L_ADDSUB_627'><pre>627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // be later on folded into "<b1+b2, y>".</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_628' href='#L_ADDSUB_628'><pre>628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_629' href='#L_ADDSUB_629'><pre>629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned SameSymIdx = SymIdx + 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_630' href='#L_ADDSUB_630'><pre>630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>SameSymIdx < AddendNum</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>SameSymIdx++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_631' href='#L_ADDSUB_631'><pre>631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const FAddend *T = Addends[SameSymIdx];</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_632' href='#L_ADDSUB_632'><pre>632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>T && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>T->getSymVal() == Val</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_633' href='#L_ADDSUB_633'><pre>633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Set null such that next iteration of the outer loop will not process</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_634' href='#L_ADDSUB_634'><pre>634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // this addend again.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_635' href='#L_ADDSUB_635'><pre>635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Addends[SameSymIdx] = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_636' href='#L_ADDSUB_636'><pre>636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpVect.push_back(T);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_637' href='#L_ADDSUB_637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_638' href='#L_ADDSUB_638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_639' href='#L_ADDSUB_639'><pre>639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_640' href='#L_ADDSUB_640'><pre>640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If multiple addends share same symbolic value, fold them together.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_641' href='#L_ADDSUB_641'><pre>641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>StartIdx + 1 != SimpVect.size()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_642' href='#L_ADDSUB_642'><pre>642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FAddend &R = TmpResult[NextTmpIdx ++];</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_643' href='#L_ADDSUB_643'><pre>643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> R = *SimpVect[StartIdx];</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_644' href='#L_ADDSUB_644'><pre>644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Idx = StartIdx + 1; </span><div class='tooltip'><span class='red'>Idx < SimpVect.size()</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>Idx++</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_645' href='#L_ADDSUB_645'><pre>645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>R += *SimpVect[Idx]</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_646' href='#L_ADDSUB_646'><pre>646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_647' href='#L_ADDSUB_647'><pre>647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Pop all addends being folded and push the resulting folded addend.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_648' href='#L_ADDSUB_648'><pre>648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpVect.resize(StartIdx);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_649' href='#L_ADDSUB_649'><pre>649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Val</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_650' href='#L_ADDSUB_650'><pre>650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!R.isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_651' href='#L_ADDSUB_651'><pre>651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpVect.push_back(&R);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_652' href='#L_ADDSUB_652'><pre>652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_653' href='#L_ADDSUB_653'><pre>653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_654' href='#L_ADDSUB_654'><pre>654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't push constant addend at this time. It will be the last element</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_655' href='#L_ADDSUB_655'><pre>655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // of <SimpVect>.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_656' href='#L_ADDSUB_656'><pre>656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstAdd = &R;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_657' href='#L_ADDSUB_657'><pre>657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_658' href='#L_ADDSUB_658'><pre>658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_659' href='#L_ADDSUB_659'><pre>659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_660' href='#L_ADDSUB_660'><pre>660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_661' href='#L_ADDSUB_661'><pre>661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((NextTmpIdx <= array_lengthof(TmpResult) + 1) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_662' href='#L_ADDSUB_662'><pre>662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "out-of-bound access");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_663' href='#L_ADDSUB_663'><pre>663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_664' href='#L_ADDSUB_664'><pre>664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ConstAdd</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_665' href='#L_ADDSUB_665'><pre>665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SimpVect.push_back(ConstAdd)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_666' href='#L_ADDSUB_666'><pre>666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_667' href='#L_ADDSUB_667'><pre>667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Result;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_668' href='#L_ADDSUB_668'><pre>668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!SimpVect.empty()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_669' href='#L_ADDSUB_669'><pre>669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Result = createNaryFAdd(SimpVect, InstrQuota)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_670' href='#L_ADDSUB_670'><pre>670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_671' href='#L_ADDSUB_671'><pre>671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The addition is folded to 0.0.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_672' href='#L_ADDSUB_672'><pre>672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result = ConstantFP::get(Instr->getType(), 0.0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_673' href='#L_ADDSUB_673'><pre>673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_674' href='#L_ADDSUB_674'><pre>674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_675' href='#L_ADDSUB_675'><pre>675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Result;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_676' href='#L_ADDSUB_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_677' href='#L_ADDSUB_677'><pre>677</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_678' href='#L_ADDSUB_678'><pre>678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *FAddCombine::createNaryFAdd</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_679' href='#L_ADDSUB_679'><pre>679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> (const AddendVect &Opnds, unsigned InstrQuota) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_680' href='#L_ADDSUB_680'><pre>680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(!Opnds.empty() && "Expect at least one addend");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_681' href='#L_ADDSUB_681'><pre>681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_682' href='#L_ADDSUB_682'><pre>682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Step 1: Check if the # of instructions needed exceeds the quota.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_683' href='#L_ADDSUB_683'><pre>683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_684' href='#L_ADDSUB_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InstrNeeded = calcInstrNumber(Opnds);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_685' href='#L_ADDSUB_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>InstrNeeded > InstrQuota</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_686' href='#L_ADDSUB_686'><pre>686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_687' href='#L_ADDSUB_687'><pre>687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_688' href='#L_ADDSUB_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>initCreateInstNum();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_689' href='#L_ADDSUB_689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_690' href='#L_ADDSUB_690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // step 2: Emit the N-ary addition.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_691' href='#L_ADDSUB_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that at most three instructions are involved in Fadd-InstCombine: the</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_692' href='#L_ADDSUB_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // addition in question, and at most two neighboring instructions.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_693' href='#L_ADDSUB_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The resulting optimized addition should have at least one less instruction</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_694' href='#L_ADDSUB_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // than the original addition expression tree. This implies that the resulting</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_695' href='#L_ADDSUB_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // N-ary addition has at most two instructions, and we don't need to worry</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_696' href='#L_ADDSUB_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // about tree-height when constructing the N-ary addition.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_697' href='#L_ADDSUB_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_698' href='#L_ADDSUB_698'><pre>698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LastVal = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_699' href='#L_ADDSUB_699'><pre>699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LastValNeedNeg = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_700' href='#L_ADDSUB_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_701' href='#L_ADDSUB_701'><pre>701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Iterate the addends, creating fadd/fsub using adjacent two addends.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_702' href='#L_ADDSUB_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (const FAddend *Opnd : Opnds) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_703' href='#L_ADDSUB_703'><pre>703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool NeedNeg;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_704' href='#L_ADDSUB_704'><pre>704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = createAddendVal(*Opnd, NeedNeg);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_705' href='#L_ADDSUB_705'><pre>705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!LastVal</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_706' href='#L_ADDSUB_706'><pre>706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LastVal = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_707' href='#L_ADDSUB_707'><pre>707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LastValNeedNeg = NeedNeg;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_708' href='#L_ADDSUB_708'><pre>708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_709' href='#L_ADDSUB_709'><pre>709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_710' href='#L_ADDSUB_710'><pre>710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_711' href='#L_ADDSUB_711'><pre>711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LastValNeedNeg == NeedNeg</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_712' href='#L_ADDSUB_712'><pre>712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LastVal = createFAdd(LastVal, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_713' href='#L_ADDSUB_713'><pre>713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_714' href='#L_ADDSUB_714'><pre>714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_715' href='#L_ADDSUB_715'><pre>715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_716' href='#L_ADDSUB_716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LastValNeedNeg</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_717' href='#L_ADDSUB_717'><pre>717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LastVal = createFSub(V, LastVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_718' href='#L_ADDSUB_718'><pre>718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_719' href='#L_ADDSUB_719'><pre>719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LastVal = createFSub(LastVal, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_720' href='#L_ADDSUB_720'><pre>720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_721' href='#L_ADDSUB_721'><pre>721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LastValNeedNeg = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_722' href='#L_ADDSUB_722'><pre>722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_723' href='#L_ADDSUB_723'><pre>723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_724' href='#L_ADDSUB_724'><pre>724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>LastValNeedNeg</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_725' href='#L_ADDSUB_725'><pre>725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LastVal = createFNeg(LastVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_726' href='#L_ADDSUB_726'><pre>726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_727' href='#L_ADDSUB_727'><pre>727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_728' href='#L_ADDSUB_728'><pre>728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> #ifndef NDEBUG</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_729' href='#L_ADDSUB_729'><pre>729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(CreateInstrNum == InstrNeeded &&</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_730' href='#L_ADDSUB_730'><pre>730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Inconsistent in instruction numbers");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_731' href='#L_ADDSUB_731'><pre>731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> #endif</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_732' href='#L_ADDSUB_732'><pre>732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_733' href='#L_ADDSUB_733'><pre>733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LastVal</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_734' href='#L_ADDSUB_734'><pre>734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_735' href='#L_ADDSUB_735'><pre>735</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_736' href='#L_ADDSUB_736'><pre>736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createFSub(Value *Opnd0, Value *Opnd1) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_737' href='#L_ADDSUB_737'><pre>737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Builder->CreateFSub(Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_738' href='#L_ADDSUB_738'><pre>738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = dyn_cast<Instruction>(V))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_739' href='#L_ADDSUB_739'><pre>739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createInstPostProc(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_740' href='#L_ADDSUB_740'><pre>740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_741' href='#L_ADDSUB_741'><pre>741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_742' href='#L_ADDSUB_742'><pre>742</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_743' href='#L_ADDSUB_743'><pre>743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createFNeg(Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_744' href='#L_ADDSUB_744'><pre>744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Zero = cast<Value>(ConstantFP::getZeroValueForNegation(V->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_745' href='#L_ADDSUB_745'><pre>745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewV = createFSub(Zero, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_746' href='#L_ADDSUB_746'><pre>746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = dyn_cast<Instruction>(NewV))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_747' href='#L_ADDSUB_747'><pre>747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createInstPostProc(I, true)</span><span class='red'>; // fneg's don't receive instruction numbers.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_748' href='#L_ADDSUB_748'><pre>748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewV;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_749' href='#L_ADDSUB_749'><pre>749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_750' href='#L_ADDSUB_750'><pre>750</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_751' href='#L_ADDSUB_751'><pre>751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createFAdd(Value *Opnd0, Value *Opnd1) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_752' href='#L_ADDSUB_752'><pre>752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Builder->CreateFAdd(Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_753' href='#L_ADDSUB_753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = dyn_cast<Instruction>(V))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_754' href='#L_ADDSUB_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createInstPostProc(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_755' href='#L_ADDSUB_755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_756' href='#L_ADDSUB_756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_757' href='#L_ADDSUB_757'><pre>757</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_758' href='#L_ADDSUB_758'><pre>758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createFMul(Value *Opnd0, Value *Opnd1) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_759' href='#L_ADDSUB_759'><pre>759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Builder->CreateFMul(Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_760' href='#L_ADDSUB_760'><pre>760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = dyn_cast<Instruction>(V))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_761' href='#L_ADDSUB_761'><pre>761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createInstPostProc(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_762' href='#L_ADDSUB_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_763' href='#L_ADDSUB_763'><pre>763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_764' href='#L_ADDSUB_764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_765' href='#L_ADDSUB_765'><pre>765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createFDiv(Value *Opnd0, Value *Opnd1) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_766' href='#L_ADDSUB_766'><pre>766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Builder->CreateFDiv(Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_767' href='#L_ADDSUB_767'><pre>767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = dyn_cast<Instruction>(V))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_768' href='#L_ADDSUB_768'><pre>768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>createInstPostProc(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_769' href='#L_ADDSUB_769'><pre>769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_770' href='#L_ADDSUB_770'><pre>770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_771' href='#L_ADDSUB_771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_772' href='#L_ADDSUB_772'><pre>772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void FAddCombine::createInstPostProc(Instruction *NewInstr, bool NoNumber) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_773' href='#L_ADDSUB_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewInstr->setDebugLoc(Instr->getDebugLoc());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_774' href='#L_ADDSUB_774'><pre>774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_775' href='#L_ADDSUB_775'><pre>775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Keep track of the number of instruction created.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_776' href='#L_ADDSUB_776'><pre>776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!NoNumber</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_777' href='#L_ADDSUB_777'><pre>777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>incCreateInstNum()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_778' href='#L_ADDSUB_778'><pre>778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_779' href='#L_ADDSUB_779'><pre>779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Propagate fast-math flags</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_780' href='#L_ADDSUB_780'><pre>780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewInstr->setFastMathFlags(Instr->getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_781' href='#L_ADDSUB_781'><pre>781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_782' href='#L_ADDSUB_782'><pre>782</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_783' href='#L_ADDSUB_783'><pre>783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Return the number of instruction needed to emit the N-ary addition.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_784' href='#L_ADDSUB_784'><pre>784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// NOTE: Keep this function in sync with createAddendVal().</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_785' href='#L_ADDSUB_785'><pre>785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>unsigned FAddCombine::calcInstrNumber(const AddendVect &Opnds) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_786' href='#L_ADDSUB_786'><pre>786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned OpndNum = Opnds.size();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_787' href='#L_ADDSUB_787'><pre>787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InstrNeeded = OpndNum - 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_788' href='#L_ADDSUB_788'><pre>788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_789' href='#L_ADDSUB_789'><pre>789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The number of addends in the form of "(-1)*x".</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_790' href='#L_ADDSUB_790'><pre>790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NegOpndNum = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_791' href='#L_ADDSUB_791'><pre>791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_792' href='#L_ADDSUB_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Adjust the number of instructions needed to emit the N-ary add.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_793' href='#L_ADDSUB_793'><pre>793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (const FAddend *Opnd : Opnds) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_794' href='#L_ADDSUB_794'><pre>794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd->isConstant()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_795' href='#L_ADDSUB_795'><pre>795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_796' href='#L_ADDSUB_796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_797' href='#L_ADDSUB_797'><pre>797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const FAddendCoef &CE = Opnd->getCoef();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_798' href='#L_ADDSUB_798'><pre>798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CE.isMinusOne() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CE.isMinusTwo()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_799' href='#L_ADDSUB_799'><pre>799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NegOpndNum++</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_800' href='#L_ADDSUB_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_801' href='#L_ADDSUB_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Let the addend be "c * x". If "c == +/-1", the value of the addend</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_802' href='#L_ADDSUB_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is immediately available; otherwise, it needs exactly one instruction</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_803' href='#L_ADDSUB_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to evaluate the value.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_804' href='#L_ADDSUB_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CE.isMinusOne() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CE.isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_805' href='#L_ADDSUB_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InstrNeeded++</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_806' href='#L_ADDSUB_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_807' href='#L_ADDSUB_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NegOpndNum == OpndNum</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_808' href='#L_ADDSUB_808'><pre>808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InstrNeeded++</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_809' href='#L_ADDSUB_809'><pre>809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InstrNeeded;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_810' href='#L_ADDSUB_810'><pre>810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_811' href='#L_ADDSUB_811'><pre>811</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_812' href='#L_ADDSUB_812'><pre>812</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Input Addend Value NeedNeg(output)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_813' href='#L_ADDSUB_813'><pre>813</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ================================================================</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_814' href='#L_ADDSUB_814'><pre>814</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Constant C C false</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_815' href='#L_ADDSUB_815'><pre>815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// <+/-1, V> V coefficient is -1</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_816' href='#L_ADDSUB_816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// <2/-2, V> "fadd V, V" coefficient is -2</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_817' href='#L_ADDSUB_817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// <C, V> "fmul V, C" false</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_818' href='#L_ADDSUB_818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_819' href='#L_ADDSUB_819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// NOTE: Keep this function in sync with FAddCombine::calcInstrNumber.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_820' href='#L_ADDSUB_820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *FAddCombine::createAddendVal(const FAddend &Opnd, bool &NeedNeg) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_821' href='#L_ADDSUB_821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const FAddendCoef &Coeff = Opnd.getCoef();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_822' href='#L_ADDSUB_822'><pre>822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_823' href='#L_ADDSUB_823'><pre>823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd.isConstant()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_824' href='#L_ADDSUB_824'><pre>824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NeedNeg = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_825' href='#L_ADDSUB_825'><pre>825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Coeff.getValue(Instr->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_826' href='#L_ADDSUB_826'><pre>826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_827' href='#L_ADDSUB_827'><pre>827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_828' href='#L_ADDSUB_828'><pre>828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *OpndVal = Opnd.getSymVal();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_829' href='#L_ADDSUB_829'><pre>829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_830' href='#L_ADDSUB_830'><pre>830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Coeff.isMinusOne() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Coeff.isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_831' href='#L_ADDSUB_831'><pre>831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NeedNeg = Coeff.isMinusOne();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_832' href='#L_ADDSUB_832'><pre>832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return OpndVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_833' href='#L_ADDSUB_833'><pre>833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_834' href='#L_ADDSUB_834'><pre>834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_835' href='#L_ADDSUB_835'><pre>835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Coeff.isTwo() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Coeff.isMinusTwo()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_836' href='#L_ADDSUB_836'><pre>836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NeedNeg = Coeff.isMinusTwo();</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_837' href='#L_ADDSUB_837'><pre>837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return createFAdd(OpndVal, OpndVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_838' href='#L_ADDSUB_838'><pre>838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_839' href='#L_ADDSUB_839'><pre>839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_840' href='#L_ADDSUB_840'><pre>840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NeedNeg = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_841' href='#L_ADDSUB_841'><pre>841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return createFMul(OpndVal, Coeff.getValue(Instr->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_842' href='#L_ADDSUB_842'><pre>842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_843' href='#L_ADDSUB_843'><pre>843</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_844' href='#L_ADDSUB_844'><pre>844</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If one of the operands only has one non-zero bit, and if the other</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_845' href='#L_ADDSUB_845'><pre>845</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// operand has a known-zero bit in a more significant place than it (not</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_846' href='#L_ADDSUB_846'><pre>846</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// including the sign bit) the ripple may go up to and fill the zero, but</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_847' href='#L_ADDSUB_847'><pre>847</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// won't change the sign. For example, (X & ~4) + 1.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_848' href='#L_ADDSUB_848'><pre>848</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool checkRippleForAdd(const APInt &Op0KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_849' href='#L_ADDSUB_849'><pre>849</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre> const APInt &Op1KnownZero) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_850' href='#L_ADDSUB_850'><pre>850</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre> APInt Op1MaybeOne = ~Op1KnownZero;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_851' href='#L_ADDSUB_851'><pre>851</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre> // Make sure that one of the operand has at most one bit set to 1.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_852' href='#L_ADDSUB_852'><pre>852</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre> if (Op1MaybeOne.countPopulation() != 1)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_853' href='#L_ADDSUB_853'><pre>853</pre></a></td><td class='covered-line'><pre>321k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_854' href='#L_ADDSUB_854'><pre>854</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_855' href='#L_ADDSUB_855'><pre>855</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre> // Find the most significant known 0 other than the sign bit.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_856' href='#L_ADDSUB_856'><pre>856</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> int BitWidth = Op0KnownZero.getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_857' href='#L_ADDSUB_857'><pre>857</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> APInt Op0KnownZeroTemp(Op0KnownZero);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_858' href='#L_ADDSUB_858'><pre>858</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> Op0KnownZeroTemp.clearBit(BitWidth - 1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_859' href='#L_ADDSUB_859'><pre>859</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> int Op0ZeroPosition = BitWidth - Op0KnownZeroTemp.countLeadingZeros() - 1;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_860' href='#L_ADDSUB_860'><pre>860</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_861' href='#L_ADDSUB_861'><pre>861</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> int Op1OnePosition = BitWidth - Op1MaybeOne.countLeadingZeros() - 1;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_862' href='#L_ADDSUB_862'><pre>862</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> assert(Op1OnePosition >= 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_863' href='#L_ADDSUB_863'><pre>863</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_864' href='#L_ADDSUB_864'><pre>864</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> // This also covers the case of no known zero, since in that case</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_865' href='#L_ADDSUB_865'><pre>865</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> // Op0ZeroPosition is -1.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_866' href='#L_ADDSUB_866'><pre>866</pre></a></td><td class='covered-line'><pre>58.9k</pre></td><td class='code'><pre> return Op0ZeroPosition >= Op1OnePosition;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_867' href='#L_ADDSUB_867'><pre>867</pre></a></td><td class='covered-line'><pre>380k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_868' href='#L_ADDSUB_868'><pre>868</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_869' href='#L_ADDSUB_869'><pre>869</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we can prove that:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_870' href='#L_ADDSUB_870'><pre>870</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (sext (add LHS, RHS)) === (add (sext LHS), (sext RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_871' href='#L_ADDSUB_871'><pre>871</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This basically requires proving that the add in the original type would not</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_872' href='#L_ADDSUB_872'><pre>872</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// overflow to change the sign bit or have a carry out.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_873' href='#L_ADDSUB_873'><pre>873</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::WillNotOverflowSignedAdd(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_874' href='#L_ADDSUB_874'><pre>874</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> Instruction &CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_875' href='#L_ADDSUB_875'><pre>875</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // There are different heuristics we can use for this. Here are some simple</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_876' href='#L_ADDSUB_876'><pre>876</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // ones.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_877' href='#L_ADDSUB_877'><pre>877</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_878' href='#L_ADDSUB_878'><pre>878</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // If LHS and RHS each have at least two sign bits, the addition will look</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_879' href='#L_ADDSUB_879'><pre>879</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // like</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_880' href='#L_ADDSUB_880'><pre>880</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_881' href='#L_ADDSUB_881'><pre>881</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // XX..... +</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_882' href='#L_ADDSUB_882'><pre>882</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // YY.....</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_883' href='#L_ADDSUB_883'><pre>883</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_884' href='#L_ADDSUB_884'><pre>884</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // If the carry into the most significant position is 0, X and Y can't both</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_885' href='#L_ADDSUB_885'><pre>885</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // be 1 and therefore the carry out of the addition is also 0.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_886' href='#L_ADDSUB_886'><pre>886</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_887' href='#L_ADDSUB_887'><pre>887</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // If the carry into the most significant position is 1, X and Y can't both</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_888' href='#L_ADDSUB_888'><pre>888</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // be 0 and therefore the carry out of the addition is also 1.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_889' href='#L_ADDSUB_889'><pre>889</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_890' href='#L_ADDSUB_890'><pre>890</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // Since the carry into the most significant position is always equal to</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_891' href='#L_ADDSUB_891'><pre>891</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // the carry out of the addition, there is no signed overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_892' href='#L_ADDSUB_892'><pre>892</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> if (ComputeNumSignBits(LHS, 0, &CxtI) > 1 &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_893' href='#L_ADDSUB_893'><pre>893</pre></a></td><td class='covered-line'><pre>5.91k</pre></td><td class='code'><pre> ComputeNumSignBits(RHS, 0, &CxtI) > 1)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_894' href='#L_ADDSUB_894'><pre>894</pre></a></td><td class='covered-line'><pre>2.05k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_895' href='#L_ADDSUB_895'><pre>895</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_896' href='#L_ADDSUB_896'><pre>896</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> unsigned BitWidth = LHS->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_897' href='#L_ADDSUB_897'><pre>897</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> APInt LHSKnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_898' href='#L_ADDSUB_898'><pre>898</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> APInt LHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_899' href='#L_ADDSUB_899'><pre>899</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> computeKnownBits(LHS, LHSKnownZero, LHSKnownOne, 0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_900' href='#L_ADDSUB_900'><pre>900</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_901' href='#L_ADDSUB_901'><pre>901</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> APInt RHSKnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_902' href='#L_ADDSUB_902'><pre>902</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> APInt RHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_903' href='#L_ADDSUB_903'><pre>903</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> computeKnownBits(RHS, RHSKnownZero, RHSKnownOne, 0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_904' href='#L_ADDSUB_904'><pre>904</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_905' href='#L_ADDSUB_905'><pre>905</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> // Addition of two 2's compliment numbers having opposite signs will never</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_906' href='#L_ADDSUB_906'><pre>906</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> // overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_907' href='#L_ADDSUB_907'><pre>907</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> if (<div class='tooltip'>(LHSKnownOne[BitWidth - 1] && <span class='tooltip-content'>190k</span></div><div class='tooltip'>RHSKnownZero[BitWidth - 1]<span class='tooltip-content'>44</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_908' href='#L_ADDSUB_908'><pre>908</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> <div class='tooltip'>(LHSKnownZero[BitWidth - 1] && <span class='tooltip-content'>190k</span></div><div class='tooltip'>RHSKnownOne[BitWidth - 1]<span class='tooltip-content'>3.72k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_909' href='#L_ADDSUB_909'><pre>909</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_910' href='#L_ADDSUB_910'><pre>910</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_911' href='#L_ADDSUB_911'><pre>911</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> // Check if carry bit of addition will not cause overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_912' href='#L_ADDSUB_912'><pre>912</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>190k</span></div><div class='tooltip'>checkRippleForAdd(LHSKnownZero, RHSKnownZero)<span class='tooltip-content'>190k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_913' href='#L_ADDSUB_913'><pre>913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_914' href='#L_ADDSUB_914'><pre>914</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>190k</span></div><div class='tooltip'>checkRippleForAdd(RHSKnownZero, LHSKnownZero)<span class='tooltip-content'>190k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_915' href='#L_ADDSUB_915'><pre>915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_916' href='#L_ADDSUB_916'><pre>916</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_917' href='#L_ADDSUB_917'><pre>917</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_918' href='#L_ADDSUB_918'><pre>918</pre></a></td><td class='covered-line'><pre>190k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_919' href='#L_ADDSUB_919'><pre>919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_920' href='#L_ADDSUB_920'><pre>920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Return true if we can prove that:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_921' href='#L_ADDSUB_921'><pre>921</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (sub LHS, RHS) === (sub nsw LHS, RHS)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_922' href='#L_ADDSUB_922'><pre>922</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This basically requires proving that the add in the original type would not</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_923' href='#L_ADDSUB_923'><pre>923</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// overflow to change the sign bit or have a carry out.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_924' href='#L_ADDSUB_924'><pre>924</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// TODO: Handle this for Vectors.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_925' href='#L_ADDSUB_925'><pre>925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::WillNotOverflowSignedSub(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_926' href='#L_ADDSUB_926'><pre>926</pre></a></td><td class='covered-line'><pre>68.8k</pre></td><td class='code'><pre> Instruction &CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_927' href='#L_ADDSUB_927'><pre>927</pre></a></td><td class='covered-line'><pre>68.8k</pre></td><td class='code'><pre> // If LHS and RHS each have at least two sign bits, the subtraction</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_928' href='#L_ADDSUB_928'><pre>928</pre></a></td><td class='covered-line'><pre>68.8k</pre></td><td class='code'><pre> // cannot overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_929' href='#L_ADDSUB_929'><pre>929</pre></a></td><td class='covered-line'><pre>68.8k</pre></td><td class='code'><pre> if (ComputeNumSignBits(LHS, 0, &CxtI) > 1 &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_930' href='#L_ADDSUB_930'><pre>930</pre></a></td><td class='covered-line'><pre>8.57k</pre></td><td class='code'><pre> ComputeNumSignBits(RHS, 0, &CxtI) > 1)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_931' href='#L_ADDSUB_931'><pre>931</pre></a></td><td class='covered-line'><pre>896</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_932' href='#L_ADDSUB_932'><pre>932</pre></a></td><td class='covered-line'><pre>68.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_933' href='#L_ADDSUB_933'><pre>933</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> unsigned BitWidth = LHS->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_934' href='#L_ADDSUB_934'><pre>934</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> APInt LHSKnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_935' href='#L_ADDSUB_935'><pre>935</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> APInt LHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_936' href='#L_ADDSUB_936'><pre>936</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> computeKnownBits(LHS, LHSKnownZero, LHSKnownOne, 0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_937' href='#L_ADDSUB_937'><pre>937</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_938' href='#L_ADDSUB_938'><pre>938</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> APInt RHSKnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_939' href='#L_ADDSUB_939'><pre>939</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> APInt RHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_940' href='#L_ADDSUB_940'><pre>940</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> computeKnownBits(RHS, RHSKnownZero, RHSKnownOne, 0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_941' href='#L_ADDSUB_941'><pre>941</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_942' href='#L_ADDSUB_942'><pre>942</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> // Subtraction of two 2's compliment numbers having identical signs will</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_943' href='#L_ADDSUB_943'><pre>943</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> // never overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_944' href='#L_ADDSUB_944'><pre>944</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>(LHSKnownOne[BitWidth - 1] && <span class='tooltip-content'>67.9k</span></div><div class='tooltip'>RHSKnownOne[BitWidth - 1]<span class='tooltip-content'>259</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_945' href='#L_ADDSUB_945'><pre>945</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> <div class='tooltip'>(LHSKnownZero[BitWidth - 1] && <span class='tooltip-content'>67.9k</span></div><div class='tooltip'>RHSKnownZero[BitWidth - 1]<span class='tooltip-content'>7.15k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_946' href='#L_ADDSUB_946'><pre>946</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_947' href='#L_ADDSUB_947'><pre>947</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_948' href='#L_ADDSUB_948'><pre>948</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre> // TODO: implement logic similar to checkRippleForAdd</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_949' href='#L_ADDSUB_949'><pre>949</pre></a></td><td class='covered-line'><pre>67.8k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_950' href='#L_ADDSUB_950'><pre>950</pre></a></td><td class='covered-line'><pre>67.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_951' href='#L_ADDSUB_951'><pre>951</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_952' href='#L_ADDSUB_952'><pre>952</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Return true if we can prove that:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_953' href='#L_ADDSUB_953'><pre>953</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (sub LHS, RHS) === (sub nuw LHS, RHS)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_954' href='#L_ADDSUB_954'><pre>954</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::WillNotOverflowUnsignedSub(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_955' href='#L_ADDSUB_955'><pre>955</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> Instruction &CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_956' href='#L_ADDSUB_956'><pre>956</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> // If the LHS is negative and the RHS is non-negative, no unsigned wrap.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_957' href='#L_ADDSUB_957'><pre>957</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> bool LHSKnownNonNegative, LHSKnownNegative;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_958' href='#L_ADDSUB_958'><pre>958</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> bool RHSKnownNonNegative, RHSKnownNegative;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_959' href='#L_ADDSUB_959'><pre>959</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> ComputeSignBit(LHS, LHSKnownNonNegative, LHSKnownNegative, /*Depth=*/0,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_960' href='#L_ADDSUB_960'><pre>960</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_961' href='#L_ADDSUB_961'><pre>961</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> ComputeSignBit(RHS, RHSKnownNonNegative, RHSKnownNegative, /*Depth=*/0,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_962' href='#L_ADDSUB_962'><pre>962</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_963' href='#L_ADDSUB_963'><pre>963</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSKnownNegative && <span class='tooltip-content'>131k</span></div><div class='tooltip'>RHSKnownNonNegative<span class='tooltip-content'>304</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_964' href='#L_ADDSUB_964'><pre>964</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_965' href='#L_ADDSUB_965'><pre>965</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_966' href='#L_ADDSUB_966'><pre>966</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_967' href='#L_ADDSUB_967'><pre>967</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_968' href='#L_ADDSUB_968'><pre>968</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_969' href='#L_ADDSUB_969'><pre>969</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Checks if any operand is negative and we can convert add to sub.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_970' href='#L_ADDSUB_970'><pre>970</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This function checks for following negative patterns</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_971' href='#L_ADDSUB_971'><pre>971</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ADD(XOR(OR(Z, NOT(C)), C)), 1) == NEG(AND(Z, C))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_972' href='#L_ADDSUB_972'><pre>972</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ADD(XOR(AND(Z, C), C), 1) == NEG(OR(Z, ~C))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_973' href='#L_ADDSUB_973'><pre>973</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// XOR(AND(Z, C), (C + 1)) == NEG(OR(Z, ~C)) if C is even</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_974' href='#L_ADDSUB_974'><pre>974</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *checkForNegativeOperand(BinaryOperator &I,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_975' href='#L_ADDSUB_975'><pre>975</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_976' href='#L_ADDSUB_976'><pre>976</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_977' href='#L_ADDSUB_977'><pre>977</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_978' href='#L_ADDSUB_978'><pre>978</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> // This function creates 2 instructions to replace ADD, we need at least one</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_979' href='#L_ADDSUB_979'><pre>979</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> // of LHS or RHS to have one use to ensure benefit in transform.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_980' href='#L_ADDSUB_980'><pre>980</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHS->hasOneUse() && <span class='tooltip-content'>561k</span></div><div class='tooltip'>!RHS->hasOneUse()<span class='tooltip-content'>323k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_981' href='#L_ADDSUB_981'><pre>981</pre></a></td><td class='covered-line'><pre>297k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_982' href='#L_ADDSUB_982'><pre>982</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_983' href='#L_ADDSUB_983'><pre>983</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> Value *X = nullptr, *Y = nullptr, *Z = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_984' href='#L_ADDSUB_984'><pre>984</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> const APInt *C1 = nullptr, *C2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_985' href='#L_ADDSUB_985'><pre>985</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_986' href='#L_ADDSUB_986'><pre>986</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // if ONE is on other side, swap</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_987' href='#L_ADDSUB_987'><pre>987</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> if (match(RHS, m_Add(m_Value(X), m_One())))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_988' href='#L_ADDSUB_988'><pre>988</pre></a></td><td class='covered-line'><pre>299</pre></td><td class='code'><pre> std::swap(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_989' href='#L_ADDSUB_989'><pre>989</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_990' href='#L_ADDSUB_990'><pre>990</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(LHS, m_Add(m_Value(X), m_One()))<span class='tooltip-content'>264k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.54k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_991' href='#L_ADDSUB_991'><pre>991</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> // if XOR on other side, swap</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_992' href='#L_ADDSUB_992'><pre>992</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> if (match(RHS, m_Xor(m_Value(Y), m_APInt(C1))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_993' href='#L_ADDSUB_993'><pre>993</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> std::swap(X, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_994' href='#L_ADDSUB_994'><pre>994</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_995' href='#L_ADDSUB_995'><pre>995</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(X, m_Xor(m_Value(Y), m_APInt(C1)))<span class='tooltip-content'>2.54k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>63</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_996' href='#L_ADDSUB_996'><pre>996</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // X = XOR(Y, C1), Y = OR(Z, C2), C2 = NOT(C1) ==> X == NOT(AND(Z, C1))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_997' href='#L_ADDSUB_997'><pre>997</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // ADD(ADD(X, 1), RHS) == ADD(X, ADD(RHS, 1)) == SUB(RHS, AND(Z, C1))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_998' href='#L_ADDSUB_998'><pre>998</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Y, m_Or(m_Value(Z), m_APInt(C2))) && <span class='tooltip-content'>63</span></div><div class='tooltip'><span class='red'>(*C2 == ~(*C1))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_999' href='#L_ADDSUB_999'><pre>999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAnd = Builder->CreateAnd(Z, *C1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1000' href='#L_ADDSUB_1000'><pre>1000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateSub(RHS, NewAnd, "sub");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1001' href='#L_ADDSUB_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>63</span></div><div class='tooltip'>match(Y, m_And(m_Value(Z), m_APInt(C2))) && <span class='tooltip-content'>63</span></div><div class='tooltip'><span class='red'>(*C1 == *C2)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1002' href='#L_ADDSUB_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X = XOR(Y, C1), Y = AND(Z, C2), C2 == C1 ==> X == NOT(OR(Z, ~C1))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1003' href='#L_ADDSUB_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ADD(ADD(X, 1), RHS) == ADD(X, ADD(RHS, 1)) == SUB(RHS, OR(Z, ~C1))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1004' href='#L_ADDSUB_1004'><pre>1004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOr = Builder->CreateOr(Z, ~(*C1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1005' href='#L_ADDSUB_1005'><pre>1005</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateSub(RHS, NewOr, "sub");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1006' href='#L_ADDSUB_1006'><pre>1006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1007' href='#L_ADDSUB_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1008' href='#L_ADDSUB_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1009' href='#L_ADDSUB_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1010' href='#L_ADDSUB_1010'><pre>1010</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // Restore LHS and RHS</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1011' href='#L_ADDSUB_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> LHS = I.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1012' href='#L_ADDSUB_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> RHS = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1013' href='#L_ADDSUB_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1014' href='#L_ADDSUB_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // if XOR is on other side, swap</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1015' href='#L_ADDSUB_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> if (match(RHS, m_Xor(m_Value(Y), m_APInt(C1))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1016' href='#L_ADDSUB_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>674</pre></td><td class='code'><pre> std::swap(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1017' href='#L_ADDSUB_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1018' href='#L_ADDSUB_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // C2 is ODD</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1019' href='#L_ADDSUB_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // LHS = XOR(Y, C1), Y = AND(Z, C2), C1 == (C2 + 1) => LHS == NEG(OR(Z, ~C2))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1020' href='#L_ADDSUB_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // ADD(LHS, RHS) == SUB(RHS, OR(Z, ~C2))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1021' href='#L_ADDSUB_1021'><pre>1021</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> if (match(LHS, m_Xor(m_Value(Y), m_APInt(C1))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1022' href='#L_ADDSUB_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.02k</span></div><div class='tooltip'>C1->countTrailingZeros() == 0<span class='tooltip-content'>1.02k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1023' href='#L_ADDSUB_1023'><pre>1023</pre></a></td><td class='covered-line'><pre>838</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>838</span></div><div class='tooltip'>match(Y, m_And(m_Value(Z), m_APInt(C2))) && <span class='tooltip-content'>838</span></div><div class='tooltip'><span class='red'>*C1 == (*C2 + 1)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1024' href='#L_ADDSUB_1024'><pre>1024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOr = Builder->CreateOr(Z, ~(*C2));</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1025' href='#L_ADDSUB_1025'><pre>1025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateSub(RHS, NewOr, "sub");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1026' href='#L_ADDSUB_1026'><pre>1026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1027' href='#L_ADDSUB_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1028' href='#L_ADDSUB_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1029' href='#L_ADDSUB_1029'><pre>1029</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1030' href='#L_ADDSUB_1030'><pre>1030</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitAdd(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1031' href='#L_ADDSUB_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1032' href='#L_ADDSUB_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1033' href='#L_ADDSUB_1033'><pre>1033</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1034' href='#L_ADDSUB_1034'><pre>1034</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1035' href='#L_ADDSUB_1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1036' href='#L_ADDSUB_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1037' href='#L_ADDSUB_1037'><pre>1037</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>563k</span></div><div class='tooltip'>V<span class='tooltip-content'>563k</span></div> = SimplifyAddInst(LHS, RHS, I.hasNoSignedWrap(),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1038' href='#L_ADDSUB_1038'><pre>1038</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> I.hasNoUnsignedWrap(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1039' href='#L_ADDSUB_1039'><pre>1039</pre></a></td><td class='covered-line'><pre>245</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1040' href='#L_ADDSUB_1040'><pre>1040</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1041' href='#L_ADDSUB_1041'><pre>1041</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> // (A*B)+(A*C) -> A*(B+C) etc</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1042' href='#L_ADDSUB_1042'><pre>1042</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>563k</span></div><div class='tooltip'>V<span class='tooltip-content'>563k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1043' href='#L_ADDSUB_1043'><pre>1043</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1044' href='#L_ADDSUB_1044'><pre>1044</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1045' href='#L_ADDSUB_1045'><pre>1045</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> const APInt *Val;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1046' href='#L_ADDSUB_1046'><pre>1046</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(RHS, m_APInt(Val))<span class='tooltip-content'>563k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>388k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1047' href='#L_ADDSUB_1047'><pre>1047</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> if (<div class='tooltip'>Val->isSignBit()<span class='tooltip-content'>388k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1048' href='#L_ADDSUB_1048'><pre>1048</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If wrapping is not allowed, then the addition must set the sign bit:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1049' href='#L_ADDSUB_1049'><pre>1049</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // X + (signbit) --> X | signbit</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1050' href='#L_ADDSUB_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>I.hasNoSignedWrap() || <span class='tooltip-content'>7</span></div><div class='tooltip'>I.hasNoUnsignedWrap()<span class='tooltip-content'>7</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1051' href='#L_ADDSUB_1051'><pre>1051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(LHS, RHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1052' href='#L_ADDSUB_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1053' href='#L_ADDSUB_1053'><pre>1053</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If wrapping is allowed, then the addition flips the sign bit of LHS:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1054' href='#L_ADDSUB_1054'><pre>1054</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // X + (signbit) --> X ^ signbit</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1055' href='#L_ADDSUB_1055'><pre>1055</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1056' href='#L_ADDSUB_1056'><pre>1056</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1057' href='#L_ADDSUB_1057'><pre>1057</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1058' href='#L_ADDSUB_1058'><pre>1058</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> // Is this add the last step in a convoluted sext?</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1059' href='#L_ADDSUB_1059'><pre>1059</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1060' href='#L_ADDSUB_1060'><pre>1060</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1061' href='#L_ADDSUB_1061'><pre>1061</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> if (match(LHS, m_ZExt(m_Xor(m_Value(X), m_APInt(C)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1062' href='#L_ADDSUB_1062'><pre>1062</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> C->isMinSignedValue() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1063' href='#L_ADDSUB_1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>C->sext(LHS->getType()->getScalarSizeInBits()) == *Val</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1064' href='#L_ADDSUB_1064'><pre>1064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // add(zext(xor i16 X, -32768), -32768) --> sext X</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1065' href='#L_ADDSUB_1065'><pre>1065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::Create(Instruction::SExt, X, LHS->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1066' href='#L_ADDSUB_1066'><pre>1066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1067' href='#L_ADDSUB_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1068' href='#L_ADDSUB_1068'><pre>1068</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>388k</span></div><div class='tooltip'>Val->isNegative() &&<span class='tooltip-content'>388k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1069' href='#L_ADDSUB_1069'><pre>1069</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> match(LHS, m_ZExt(m_NUWAdd(m_Value(X), m_APInt(C)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1070' href='#L_ADDSUB_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>Val->sge(-C->sext(Val->getBitWidth()))<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1071' href='#L_ADDSUB_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (add (zext (add nuw X, C)), Val) -> (zext (add nuw X, C+Val))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1072' href='#L_ADDSUB_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *NewC =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1073' href='#L_ADDSUB_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt::get(X->getType(), *C + Val->trunc(C->getBitWidth()));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1074' href='#L_ADDSUB_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ZExtInst(Builder->CreateNUWAdd(X, NewC), I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1075' href='#L_ADDSUB_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1076' href='#L_ADDSUB_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1077' href='#L_ADDSUB_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1078' href='#L_ADDSUB_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> // FIXME: Use the match above instead of dyn_cast to allow these transforms</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1079' href='#L_ADDSUB_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>563k</pre></td><td class='code'><pre> // for splat vectors.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1080' href='#L_ADDSUB_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>562k</span></div><div class='tooltip'>CI<span class='tooltip-content'>562k</span></div> = dyn_cast<ConstantInt>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>388k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1081' href='#L_ADDSUB_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> // zext(bool) + C -> bool ? C + 1 : C</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1082' href='#L_ADDSUB_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> if (ZExtInst *ZI = dyn_cast<ZExtInst>(LHS))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1083' href='#L_ADDSUB_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>10.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>10.4k</span></div><div class='tooltip'>ZI->getSrcTy()->isIntegerTy(1)<span class='tooltip-content'>10.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1084' href='#L_ADDSUB_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> return SelectInst::Create(ZI->getOperand(0), AddOne(CI), CI);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1085' href='#L_ADDSUB_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1086' href='#L_ADDSUB_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> Value *XorLHS = nullptr; ConstantInt *XorRHS = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1087' href='#L_ADDSUB_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(LHS, m_Xor(m_Value(XorLHS), m_ConstantInt(XorRHS)))<span class='tooltip-content'>388k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>198</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1088' href='#L_ADDSUB_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> uint32_t TySizeBits = I.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1089' href='#L_ADDSUB_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> const APInt &RHSVal = CI->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1090' href='#L_ADDSUB_1090'><pre>1090</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> unsigned ExtendAmt = 0;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1091' href='#L_ADDSUB_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // If we have ADD(XOR(AND(X, 0xFF), 0x80), 0xF..F80), it's a sext.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1092' href='#L_ADDSUB_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // If we have ADD(XOR(AND(X, 0xFF), 0xF..F80), 0x80), it's a sext.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1093' href='#L_ADDSUB_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> if (<div class='tooltip'>XorRHS->getValue() == -RHSVal<span class='tooltip-content'>198</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1094' href='#L_ADDSUB_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (RHSVal.isPowerOf2())</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1095' href='#L_ADDSUB_1095'><pre>1095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>ExtendAmt = TySizeBits - RHSVal.logBase2() - 1</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1096' href='#L_ADDSUB_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>10</span></div><div class='tooltip'>XorRHS->getValue().isPowerOf2()<span class='tooltip-content'>10</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1097' href='#L_ADDSUB_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> ExtendAmt = TySizeBits - XorRHS->getValue().logBase2() - 1;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1098' href='#L_ADDSUB_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1099' href='#L_ADDSUB_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1100' href='#L_ADDSUB_1100'><pre>1100</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> if (<div class='tooltip'>ExtendAmt<span class='tooltip-content'>198</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1101' href='#L_ADDSUB_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> APInt Mask = APInt::getHighBitsSet(TySizeBits, ExtendAmt);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1102' href='#L_ADDSUB_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (!MaskedValueIsZero(XorLHS, Mask, 0, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1103' href='#L_ADDSUB_1103'><pre>1103</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> ExtendAmt = 0;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1104' href='#L_ADDSUB_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1105' href='#L_ADDSUB_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1106' href='#L_ADDSUB_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> if (<div class='tooltip'>ExtendAmt<span class='tooltip-content'>198</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1107' href='#L_ADDSUB_1107'><pre>1107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *ShAmt = ConstantInt::get(I.getType(), ExtendAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1108' href='#L_ADDSUB_1108'><pre>1108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewShl = Builder->CreateShl(XorLHS, ShAmt, "sext");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1109' href='#L_ADDSUB_1109'><pre>1109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAShr(NewShl, ShAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1110' href='#L_ADDSUB_1110'><pre>1110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1111' href='#L_ADDSUB_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1112' href='#L_ADDSUB_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // If this is a xor that was canonicalized from a sub, turn it back into</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1113' href='#L_ADDSUB_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // a sub and fuse this add with it.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1114' href='#L_ADDSUB_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>198</span></div><div class='tooltip'>LHS->hasOneUse() && <span class='tooltip-content'>198</span></div><div class='tooltip'>(XorRHS->getValue()+1).isPowerOf2()<span class='tooltip-content'>99</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1115' href='#L_ADDSUB_1115'><pre>1115</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> IntegerType *IT = cast<IntegerType>(I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1116' href='#L_ADDSUB_1116'><pre>1116</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> APInt LHSKnownOne(IT->getBitWidth(), 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1117' href='#L_ADDSUB_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> APInt LHSKnownZero(IT->getBitWidth(), 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1118' href='#L_ADDSUB_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> computeKnownBits(XorLHS, LHSKnownZero, LHSKnownOne, 0, &I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1119' href='#L_ADDSUB_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if ((XorRHS->getValue() | LHSKnownZero).isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1120' href='#L_ADDSUB_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(ConstantExpr::getAdd(XorRHS, CI),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1121' href='#L_ADDSUB_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> XorLHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1122' href='#L_ADDSUB_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1123' href='#L_ADDSUB_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // (X + signbit) + C could have gotten canonicalized to (X ^ signbit) + C,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1124' href='#L_ADDSUB_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>198</pre></td><td class='code'><pre> // transform them into (X + (signbit ^ C))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1125' href='#L_ADDSUB_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>195</span></div><div class='tooltip'>XorRHS->getValue().isSignBit()<span class='tooltip-content'>195</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1126' href='#L_ADDSUB_1126'><pre>1126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAdd(XorLHS,</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1127' href='#L_ADDSUB_1127'><pre>1127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantExpr::getXor(XorRHS, CI))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1128' href='#L_ADDSUB_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1129' href='#L_ADDSUB_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1130' href='#L_ADDSUB_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1131' href='#L_ADDSUB_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>562k</span></div><div class='tooltip'>isa<Constant>(RHS) && <span class='tooltip-content'>562k</span></div><div class='tooltip'>isa<PHINode>(LHS)<span class='tooltip-content'>388k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1132' href='#L_ADDSUB_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>218k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>218k</span></div><div class='tooltip'>NV<span class='tooltip-content'>218k</span></div> = FoldOpIntoPhi(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1133' href='#L_ADDSUB_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>261</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1134' href='#L_ADDSUB_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1135' href='#L_ADDSUB_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>562k</span></div><div class='tooltip'>I.getType()->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>562k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1136' href='#L_ADDSUB_1136'><pre>1136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(LHS, RHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1137' href='#L_ADDSUB_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1138' href='#L_ADDSUB_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> // X + X --> X << 1</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1139' href='#L_ADDSUB_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>562k</span></div><div class='tooltip'>LHS == RHS<span class='tooltip-content'>562k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>46</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1140' href='#L_ADDSUB_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> BinaryOperator *New =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1141' href='#L_ADDSUB_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1142' href='#L_ADDSUB_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> New->setHasNoSignedWrap(I.hasNoSignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1143' href='#L_ADDSUB_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> New->setHasNoUnsignedWrap(I.hasNoUnsignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1144' href='#L_ADDSUB_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> return New;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1145' href='#L_ADDSUB_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1146' href='#L_ADDSUB_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1147' href='#L_ADDSUB_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> // -A + B --> B - A</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1148' href='#L_ADDSUB_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> // -A + -B --> -(A + B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1149' href='#L_ADDSUB_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>562k</span></div><div class='tooltip'>LHSV<span class='tooltip-content'>562k</span></div> = dyn_castNegVal(LHS)) <div class='tooltip'>{<span class='tooltip-content'>278</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1150' href='#L_ADDSUB_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>278</pre></td><td class='code'><pre> if (!isa<Constant>(RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1151' href='#L_ADDSUB_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>92</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>92</span></div><div class='tooltip'>RHSV<span class='tooltip-content'>92</span></div> = dyn_castNegVal(RHS)) <div class='tooltip'>{<span class='tooltip-content'>62</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1152' href='#L_ADDSUB_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateAdd(LHSV, RHSV, "sum");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1153' href='#L_ADDSUB_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> return BinaryOperator::CreateNeg(NewAdd);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1154' href='#L_ADDSUB_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1155' href='#L_ADDSUB_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>278</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1156' href='#L_ADDSUB_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(RHS, LHSV);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1157' href='#L_ADDSUB_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>278</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1158' href='#L_ADDSUB_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1159' href='#L_ADDSUB_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> // A + -B --> A - B</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1160' href='#L_ADDSUB_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>562k</span></div><div class='tooltip'>!isa<Constant>(RHS)<span class='tooltip-content'>562k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1161' href='#L_ADDSUB_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>174k</span></div><div class='tooltip'>V<span class='tooltip-content'>174k</span></div> = dyn_castNegVal(RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1162' href='#L_ADDSUB_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>874</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(LHS, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1163' href='#L_ADDSUB_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>562k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1164' href='#L_ADDSUB_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>561k</span></div><div class='tooltip'>V<span class='tooltip-content'>561k</span></div> = checkForNegativeOperand(I, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1165' href='#L_ADDSUB_1165'><pre>1165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1166' href='#L_ADDSUB_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1167' href='#L_ADDSUB_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> // A+B --> A|B iff A and B have no bits set in common.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1168' href='#L_ADDSUB_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>561k</span></div><div class='tooltip'>haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT)<span class='tooltip-content'>561k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1169' href='#L_ADDSUB_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>559</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1170' href='#L_ADDSUB_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>561k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1171' href='#L_ADDSUB_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>560k</span></div><div class='tooltip'>CRHS<span class='tooltip-content'>560k</span></div> = dyn_cast<Constant>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>387k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1172' href='#L_ADDSUB_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1173' href='#L_ADDSUB_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> if (match(LHS, m_Not(m_Value(X)))) // ~X + C --> (C-1) - X</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1174' href='#L_ADDSUB_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(SubOne(CRHS), X);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1175' href='#L_ADDSUB_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1176' href='#L_ADDSUB_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1177' href='#L_ADDSUB_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // FIXME: We already did a check for ConstantInt RHS above this.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1178' href='#L_ADDSUB_1178'><pre>1178</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // FIXME: Is this pattern covered by another fold? No regression tests fail on</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1179' href='#L_ADDSUB_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // removal.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1180' href='#L_ADDSUB_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>560k</span></div><div class='tooltip'>CRHS<span class='tooltip-content'>560k</span></div> = dyn_cast<ConstantInt>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>387k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1181' href='#L_ADDSUB_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> // (X & FF00) + xx00 -> (X+xx00) & FF00</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1182' href='#L_ADDSUB_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1183' href='#L_ADDSUB_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> ConstantInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1184' href='#L_ADDSUB_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> if (LHS->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1185' href='#L_ADDSUB_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> match(LHS, m_And(m_Value(X), m_ConstantInt(C2))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1186' href='#L_ADDSUB_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> <div class='tooltip'>CRHS->getValue() == (CRHS->getValue() & C2->getValue())<span class='tooltip-content'>1.69k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.05k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1187' href='#L_ADDSUB_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // See if all bits from the first bit set in the Add RHS up are included</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1188' href='#L_ADDSUB_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // in the mask. First, get the rightmost bit.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1189' href='#L_ADDSUB_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> const APInt &AddRHSV = CRHS->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1190' href='#L_ADDSUB_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1191' href='#L_ADDSUB_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // Form a mask of all bits from the lowest bit added through the top.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1192' href='#L_ADDSUB_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> APInt AddRHSHighBits(~((AddRHSV & -AddRHSV)-1));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1193' href='#L_ADDSUB_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1194' href='#L_ADDSUB_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // See if the and mask includes all of these bits.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1195' href='#L_ADDSUB_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> APInt AddRHSHighBitsAnd(AddRHSHighBits & C2->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1196' href='#L_ADDSUB_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1197' href='#L_ADDSUB_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> if (<div class='tooltip'>AddRHSHighBits == AddRHSHighBitsAnd<span class='tooltip-content'>1.05k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1198' href='#L_ADDSUB_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Okay, the xform is safe. Insert the new add pronto.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1199' href='#L_ADDSUB_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateAdd(X, CRHS, LHS->getName());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1200' href='#L_ADDSUB_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NewAdd, C2);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1201' href='#L_ADDSUB_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1202' href='#L_ADDSUB_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1203' href='#L_ADDSUB_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1204' href='#L_ADDSUB_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> // Try to fold constant add into select arguments.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1205' href='#L_ADDSUB_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>387k</span></div><div class='tooltip'>SI<span class='tooltip-content'>387k</span></div> = dyn_cast<SelectInst>(LHS))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1206' href='#L_ADDSUB_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>3.97k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>3.97k</span></div><div class='tooltip'>R<span class='tooltip-content'>3.97k</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1207' href='#L_ADDSUB_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1208' href='#L_ADDSUB_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1209' href='#L_ADDSUB_1209'><pre>1209</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1210' href='#L_ADDSUB_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // add (select X 0 (sub n A)) A --> select X A n</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1211' href='#L_ADDSUB_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1212' href='#L_ADDSUB_1212'><pre>1212</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> SelectInst *SI = dyn_cast<SelectInst>(LHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1213' href='#L_ADDSUB_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> Value *A = RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1214' href='#L_ADDSUB_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> if (<div class='tooltip'>!SI<span class='tooltip-content'>560k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>552k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1215' href='#L_ADDSUB_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>552k</pre></td><td class='code'><pre> SI = dyn_cast<SelectInst>(RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1216' href='#L_ADDSUB_1216'><pre>1216</pre></a></td><td class='covered-line'><pre>552k</pre></td><td class='code'><pre> A = LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1217' href='#L_ADDSUB_1217'><pre>1217</pre></a></td><td class='covered-line'><pre>552k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1218' href='#L_ADDSUB_1218'><pre>1218</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> if (<div class='tooltip'>SI && <span class='tooltip-content'>560k</span></div><div class='tooltip'>SI->hasOneUse()<span class='tooltip-content'>11.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.67k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1219' href='#L_ADDSUB_1219'><pre>1219</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> Value *TV = SI->getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1220' href='#L_ADDSUB_1220'><pre>1220</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> Value *FV = SI->getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1221' href='#L_ADDSUB_1221'><pre>1221</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> Value *N;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1222' href='#L_ADDSUB_1222'><pre>1222</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1223' href='#L_ADDSUB_1223'><pre>1223</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> // Can we fold the add into the argument of the select?</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1224' href='#L_ADDSUB_1224'><pre>1224</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> // We check both true and false select arguments for a matching subtract.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1225' href='#L_ADDSUB_1225'><pre>1225</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(FV, m_Zero()) && <span class='tooltip-content'>5.67k</span></div><div class='tooltip'>match(TV, m_Sub(m_Value(N), m_Specific(A)))<span class='tooltip-content'>599</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1226' href='#L_ADDSUB_1226'><pre>1226</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> // Fold the add into the true select value.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1227' href='#L_ADDSUB_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SelectInst::Create(SI->getCondition(), N, A)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1228' href='#L_ADDSUB_1228'><pre>1228</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1229' href='#L_ADDSUB_1229'><pre>1229</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.67k</span></div><div class='tooltip'>match(TV, m_Zero()) && <span class='tooltip-content'>5.67k</span></div><div class='tooltip'>match(FV, m_Sub(m_Value(N), m_Specific(A)))<span class='tooltip-content'>1.77k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1230' href='#L_ADDSUB_1230'><pre>1230</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> // Fold the add into the false select value.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1231' href='#L_ADDSUB_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SelectInst::Create(SI->getCondition(), A, N)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1232' href='#L_ADDSUB_1232'><pre>1232</pre></a></td><td class='covered-line'><pre>5.67k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1233' href='#L_ADDSUB_1233'><pre>1233</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1234' href='#L_ADDSUB_1234'><pre>1234</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1235' href='#L_ADDSUB_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // Check for (add (sext x), y), see if we can merge this into an</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1236' href='#L_ADDSUB_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // integer add followed by a sext.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1237' href='#L_ADDSUB_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (SExtInst *<span class='tooltip-content'>560k</span></div><div class='tooltip'>LHSConv<span class='tooltip-content'>560k</span></div> = dyn_cast<SExtInst>(LHS)) <div class='tooltip'>{<span class='tooltip-content'>3.15k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1238' href='#L_ADDSUB_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre> // (add (sext x), cst) --> (sext (add x, cst'))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1239' href='#L_ADDSUB_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>RHSC<span class='tooltip-content'>3.15k</span></div> = dyn_cast<ConstantInt>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>2.11k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1240' href='#L_ADDSUB_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>2.11k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSConv->hasOneUse()<span class='tooltip-content'>2.11k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.52k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1241' href='#L_ADDSUB_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> Constant *CI =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1242' href='#L_ADDSUB_1242'><pre>1242</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> ConstantExpr::getTrunc(RHSC, LHSConv->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1243' href='#L_ADDSUB_1243'><pre>1243</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> if (ConstantExpr::getSExt(CI, I.getType()) == RHSC &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1244' href='#L_ADDSUB_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre> <div class='tooltip'>WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI, I)<span class='tooltip-content'>1.49k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1245' href='#L_ADDSUB_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // Insert the new, smaller add.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1246' href='#L_ADDSUB_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *NewAdd =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1247' href='#L_ADDSUB_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Builder->CreateNSWAdd(LHSConv->getOperand(0), CI, "addconv");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1248' href='#L_ADDSUB_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new SExtInst(NewAdd, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1249' href='#L_ADDSUB_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1250' href='#L_ADDSUB_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1251' href='#L_ADDSUB_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>2.11k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1252' href='#L_ADDSUB_1252'><pre>1252</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1253' href='#L_ADDSUB_1253'><pre>1253</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre> // (add (sext x), (sext y)) --> (sext (add int x, y))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1254' href='#L_ADDSUB_1254'><pre>1254</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre> <div class='tooltip'>if (SExtInst *<span class='tooltip-content'>3.15k</span></div><div class='tooltip'>RHSConv<span class='tooltip-content'>3.15k</span></div> = dyn_cast<SExtInst>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>637</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1255' href='#L_ADDSUB_1255'><pre>1255</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> // Only do this if x/y have the same type, if at last one of them has a</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1256' href='#L_ADDSUB_1256'><pre>1256</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> // single use (so we don't increase the number of sexts), and if the</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1257' href='#L_ADDSUB_1257'><pre>1257</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> // integer add will not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1258' href='#L_ADDSUB_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> if (LHSConv->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1259' href='#L_ADDSUB_1259'><pre>1259</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> RHSConv->getOperand(0)->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1260' href='#L_ADDSUB_1260'><pre>1260</pre></a></td><td class='covered-line'><pre>602</pre></td><td class='code'><pre> <div class='tooltip'>(LHSConv->hasOneUse() || <span class='tooltip-content'>602</span></div><div class='tooltip'>RHSConv->hasOneUse()<span class='tooltip-content'>43</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1261' href='#L_ADDSUB_1261'><pre>1261</pre></a></td><td class='covered-line'><pre>562</pre></td><td class='code'><pre> WillNotOverflowSignedAdd(LHSConv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1262' href='#L_ADDSUB_1262'><pre>1262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> RHSConv->getOperand(0), I)) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1263' href='#L_ADDSUB_1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new integer add.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1264' href='#L_ADDSUB_1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAdd = Builder->CreateNSWAdd(LHSConv->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1265' href='#L_ADDSUB_1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHSConv->getOperand(0), "addconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1266' href='#L_ADDSUB_1266'><pre>1266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new SExtInst(NewAdd, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1267' href='#L_ADDSUB_1267'><pre>1267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1268' href='#L_ADDSUB_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>637</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1269' href='#L_ADDSUB_1269'><pre>1269</pre></a></td><td class='covered-line'><pre>3.15k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1270' href='#L_ADDSUB_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1271' href='#L_ADDSUB_1271'><pre>1271</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // Check for (add (zext x), y), see if we can merge this into an</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1272' href='#L_ADDSUB_1272'><pre>1272</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // integer add followed by a zext.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1273' href='#L_ADDSUB_1273'><pre>1273</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>560k</span></div><div class='tooltip'>LHSConv<span class='tooltip-content'>560k</span></div> = dyn_cast<ZExtInst>(LHS)) <div class='tooltip'>{<span class='tooltip-content'>13.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1274' href='#L_ADDSUB_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> // (add (zext x), cst) --> (zext (add x, cst'))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1275' href='#L_ADDSUB_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>RHSC<span class='tooltip-content'>13.2k</span></div> = dyn_cast<ConstantInt>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>10.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1276' href='#L_ADDSUB_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSConv->hasOneUse()<span class='tooltip-content'>10.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.30k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1277' href='#L_ADDSUB_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>5.30k</pre></td><td class='code'><pre> Constant *CI =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1278' href='#L_ADDSUB_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>5.30k</pre></td><td class='code'><pre> ConstantExpr::getTrunc(RHSC, LHSConv->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1279' href='#L_ADDSUB_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>5.30k</pre></td><td class='code'><pre> if (ConstantExpr::getZExt(CI, I.getType()) == RHSC &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1280' href='#L_ADDSUB_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>3.53k</pre></td><td class='code'><pre> computeOverflowForUnsignedAdd(LHSConv->getOperand(0), CI, &I) ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1281' href='#L_ADDSUB_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> OverflowResult::NeverOverflows) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1282' href='#L_ADDSUB_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // Insert the new, smaller add.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1283' href='#L_ADDSUB_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *NewAdd =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1284' href='#L_ADDSUB_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Builder->CreateNUWAdd(LHSConv->getOperand(0), CI, "addconv");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1285' href='#L_ADDSUB_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return new ZExtInst(NewAdd, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1286' href='#L_ADDSUB_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1287' href='#L_ADDSUB_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>5.30k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1288' href='#L_ADDSUB_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1289' href='#L_ADDSUB_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1290' href='#L_ADDSUB_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> // (add (zext x), (zext y)) --> (zext (add int x, y))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1291' href='#L_ADDSUB_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>13.2k</span></div><div class='tooltip'>RHSConv<span class='tooltip-content'>13.2k</span></div> = dyn_cast<ZExtInst>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>2.13k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1292' href='#L_ADDSUB_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // Only do this if x/y have the same type, if at last one of them has a</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1293' href='#L_ADDSUB_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // single use (so we don't increase the number of zexts), and if the</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1294' href='#L_ADDSUB_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // integer add will not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1295' href='#L_ADDSUB_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> if (LHSConv->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1296' href='#L_ADDSUB_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> RHSConv->getOperand(0)->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1297' href='#L_ADDSUB_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre> <div class='tooltip'>(LHSConv->hasOneUse() || <span class='tooltip-content'>2.00k</span></div><div class='tooltip'>RHSConv->hasOneUse()<span class='tooltip-content'>165</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1298' href='#L_ADDSUB_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>1.89k</pre></td><td class='code'><pre> computeOverflowForUnsignedAdd(LHSConv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1299' href='#L_ADDSUB_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>1.89k</pre></td><td class='code'><pre> RHSConv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1300' href='#L_ADDSUB_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> &I) == OverflowResult::NeverOverflows) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1301' href='#L_ADDSUB_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Insert the new integer add.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1302' href='#L_ADDSUB_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateNUWAdd(</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1303' href='#L_ADDSUB_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> LHSConv->getOperand(0), RHSConv->getOperand(0), "addconv");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1304' href='#L_ADDSUB_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ZExtInst(NewAdd, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1305' href='#L_ADDSUB_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1306' href='#L_ADDSUB_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1307' href='#L_ADDSUB_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1308' href='#L_ADDSUB_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1309' href='#L_ADDSUB_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // (add (xor A, B) (and A, B)) --> (or A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1310' href='#L_ADDSUB_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1311' href='#L_ADDSUB_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1312' href='#L_ADDSUB_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> if (match(RHS, m_Xor(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1313' href='#L_ADDSUB_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> (match(LHS, m_And(m_Specific(A), m_Specific(B))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1314' href='#L_ADDSUB_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> match(LHS, m_And(m_Specific(B), m_Specific(A)))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1315' href='#L_ADDSUB_1315'><pre>1315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1316' href='#L_ADDSUB_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1317' href='#L_ADDSUB_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>560k</span></div><div class='tooltip'>match(LHS, m_Xor(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>560k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1318' href='#L_ADDSUB_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> (match(RHS, m_And(m_Specific(A), m_Specific(B))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1319' href='#L_ADDSUB_1319'><pre>1319</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> match(RHS, m_And(m_Specific(B), m_Specific(A)))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1320' href='#L_ADDSUB_1320'><pre>1320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1321' href='#L_ADDSUB_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1322' href='#L_ADDSUB_1322'><pre>1322</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1323' href='#L_ADDSUB_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // (add (or A, B) (and A, B)) --> (add A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1324' href='#L_ADDSUB_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1325' href='#L_ADDSUB_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1326' href='#L_ADDSUB_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> if (match(RHS, m_Or(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1327' href='#L_ADDSUB_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> (match(LHS, m_And(m_Specific(A), m_Specific(B))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1328' href='#L_ADDSUB_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> <div class='tooltip'>match(LHS, m_And(m_Specific(B), m_Specific(A)))<span class='tooltip-content'>1.05k</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1329' href='#L_ADDSUB_1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *New = BinaryOperator::CreateAdd(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1330' href='#L_ADDSUB_1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> New->setHasNoSignedWrap(I.hasNoSignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1331' href='#L_ADDSUB_1331'><pre>1331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> New->setHasNoUnsignedWrap(I.hasNoUnsignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1332' href='#L_ADDSUB_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return New;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1333' href='#L_ADDSUB_1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1334' href='#L_ADDSUB_1334'><pre>1334</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1335' href='#L_ADDSUB_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>560k</span></div><div class='tooltip'>match(LHS, m_Or(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>560k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1336' href='#L_ADDSUB_1336'><pre>1336</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> (match(RHS, m_And(m_Specific(A), m_Specific(B))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1337' href='#L_ADDSUB_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> <div class='tooltip'>match(RHS, m_And(m_Specific(B), m_Specific(A)))<span class='tooltip-content'>2.25k</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1338' href='#L_ADDSUB_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *New = BinaryOperator::CreateAdd(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1339' href='#L_ADDSUB_1339'><pre>1339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> New->setHasNoSignedWrap(I.hasNoSignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1340' href='#L_ADDSUB_1340'><pre>1340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> New->setHasNoUnsignedWrap(I.hasNoUnsignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1341' href='#L_ADDSUB_1341'><pre>1341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return New;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1342' href='#L_ADDSUB_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1343' href='#L_ADDSUB_1343'><pre>1343</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1344' href='#L_ADDSUB_1344'><pre>1344</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1345' href='#L_ADDSUB_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // TODO(jingyue): Consider WillNotOverflowSignedAdd and</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1346' href='#L_ADDSUB_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // WillNotOverflowUnsignedAdd to reduce the number of invocations of</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1347' href='#L_ADDSUB_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> // computeKnownBits.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1348' href='#L_ADDSUB_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>560k</span></div><div class='tooltip'>!I.hasNoSignedWrap() && <span class='tooltip-content'>560k</span></div><div class='tooltip'>WillNotOverflowSignedAdd(LHS, RHS, I)<span class='tooltip-content'>190k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.08k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1349' href='#L_ADDSUB_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>2.08k</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1350' href='#L_ADDSUB_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>2.08k</pre></td><td class='code'><pre> I.setHasNoSignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1351' href='#L_ADDSUB_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>2.08k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1352' href='#L_ADDSUB_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre> if (!I.hasNoUnsignedWrap() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1353' href='#L_ADDSUB_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>446k</pre></td><td class='code'><pre> computeOverflowForUnsignedAdd(LHS, RHS, &I) ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1354' href='#L_ADDSUB_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>2.55k</pre></td><td class='code'><pre> OverflowResult::NeverOverflows) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1355' href='#L_ADDSUB_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>2.55k</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1356' href='#L_ADDSUB_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>2.55k</pre></td><td class='code'><pre> I.setHasNoUnsignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1357' href='#L_ADDSUB_1357'><pre>1357</pre></a></td><td class='covered-line'><pre>2.55k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1358' href='#L_ADDSUB_1358'><pre>1358</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1359' href='#L_ADDSUB_1359'><pre>1359</pre></a></td><td class='covered-line'><pre>555k</pre></td><td class='code'><pre> return Changed ? <div class='tooltip'>&I<span class='tooltip-content'>5.86k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>555k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1360' href='#L_ADDSUB_1360'><pre>1360</pre></a></td><td class='covered-line'><pre>560k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1361' href='#L_ADDSUB_1361'><pre>1361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1362' href='#L_ADDSUB_1362'><pre>1362</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1363' href='#L_ADDSUB_1363'><pre>1363</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1364' href='#L_ADDSUB_1364'><pre>1364</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1365' href='#L_ADDSUB_1365'><pre>1365</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1366' href='#L_ADDSUB_1366'><pre>1366</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1367' href='#L_ADDSUB_1367'><pre>1367</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1368' href='#L_ADDSUB_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1369' href='#L_ADDSUB_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>163k</span></div><div class='tooltip'>V<span class='tooltip-content'>163k</span></div> =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1370' href='#L_ADDSUB_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1371' href='#L_ADDSUB_1371'><pre>1371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1372' href='#L_ADDSUB_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1373' href='#L_ADDSUB_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>163k</span></div><div class='tooltip'>isa<Constant>(RHS)<span class='tooltip-content'>163k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1374' href='#L_ADDSUB_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>6.10k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>6.10k</span></div><div class='tooltip'>FoldedFAdd<span class='tooltip-content'>6.10k</span></div> = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1375' href='#L_ADDSUB_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return FoldedFAdd;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1376' href='#L_ADDSUB_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1377' href='#L_ADDSUB_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> // -A + B --> B - A</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1378' href='#L_ADDSUB_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> // -A + -B --> -(A + B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1379' href='#L_ADDSUB_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>163k</span></div><div class='tooltip'>LHSV<span class='tooltip-content'>163k</span></div> = dyn_castFNegVal(LHS)) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1380' href='#L_ADDSUB_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Instruction *RI = BinaryOperator::CreateFSub(RHS, LHSV);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1381' href='#L_ADDSUB_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> RI->copyFastMathFlags(&I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1382' href='#L_ADDSUB_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1383' href='#L_ADDSUB_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1384' href='#L_ADDSUB_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1385' href='#L_ADDSUB_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> // A + -B --> A - B</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1386' href='#L_ADDSUB_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>163k</span></div><div class='tooltip'>!isa<Constant>(RHS)<span class='tooltip-content'>163k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1387' href='#L_ADDSUB_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>156k</span></div><div class='tooltip'>V<span class='tooltip-content'>156k</span></div> = dyn_castFNegVal(RHS)) <div class='tooltip'>{<span class='tooltip-content'>49</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1388' href='#L_ADDSUB_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> Instruction *RI = BinaryOperator::CreateFSub(LHS, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1389' href='#L_ADDSUB_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> RI->copyFastMathFlags(&I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1390' href='#L_ADDSUB_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1391' href='#L_ADDSUB_1391'><pre>1391</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1392' href='#L_ADDSUB_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1393' href='#L_ADDSUB_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> // Check for (fadd double (sitofp x), y), see if we can merge this into an</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1394' href='#L_ADDSUB_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> // integer add followed by a promotion.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1395' href='#L_ADDSUB_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> <div class='tooltip'>if (SIToFPInst *<span class='tooltip-content'>162k</span></div><div class='tooltip'>LHSConv<span class='tooltip-content'>162k</span></div> = dyn_cast<SIToFPInst>(LHS)) <div class='tooltip'>{<span class='tooltip-content'>553</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1396' href='#L_ADDSUB_1396'><pre>1396</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // (fadd double (sitofp x), fpcst) --> (sitofp (add int x, intcst))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1397' href='#L_ADDSUB_1397'><pre>1397</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // ... if the constant fits in the integer value. This is useful for things</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1398' href='#L_ADDSUB_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // like (double)(x & 1234) + 4.0 -> (double)((X & 1234)+4) which no longer</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1399' href='#L_ADDSUB_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // requires a constant pool load, and generally allows the add to be better</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1400' href='#L_ADDSUB_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // instcombined.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1401' href='#L_ADDSUB_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> if (ConstantFP *<div class='tooltip'>CFP<span class='tooltip-content'>553</span></div> = dyn_cast<ConstantFP>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>458</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1402' href='#L_ADDSUB_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>458</pre></td><td class='code'><pre> Constant *CI =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1403' href='#L_ADDSUB_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>458</pre></td><td class='code'><pre> ConstantExpr::getFPToSI(CFP, LHSConv->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1404' href='#L_ADDSUB_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>458</pre></td><td class='code'><pre> if (LHSConv->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1405' href='#L_ADDSUB_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>380</pre></td><td class='code'><pre> ConstantExpr::getSIToFP(CI, I.getType()) == CFP &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1406' href='#L_ADDSUB_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>129</pre></td><td class='code'><pre> <div class='tooltip'>WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI, I)<span class='tooltip-content'>129</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1407' href='#L_ADDSUB_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new integer add.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1408' href='#L_ADDSUB_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAdd = Builder->CreateNSWAdd(LHSConv->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1409' href='#L_ADDSUB_1409'><pre>1409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI, "addconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1410' href='#L_ADDSUB_1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new SIToFPInst(NewAdd, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1411' href='#L_ADDSUB_1411'><pre>1411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1412' href='#L_ADDSUB_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>458</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1413' href='#L_ADDSUB_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1414' href='#L_ADDSUB_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // (fadd double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1415' href='#L_ADDSUB_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> <div class='tooltip'>if (SIToFPInst *<span class='tooltip-content'>553</span></div><div class='tooltip'>RHSConv<span class='tooltip-content'>553</span></div> = dyn_cast<SIToFPInst>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>34</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1416' href='#L_ADDSUB_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> // Only do this if x/y have the same type, if at last one of them has a</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1417' href='#L_ADDSUB_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> // single use (so we don't increase the number of int->fp conversions),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1418' href='#L_ADDSUB_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> // and if the integer add will not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1419' href='#L_ADDSUB_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> if (LHSConv->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1420' href='#L_ADDSUB_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> RHSConv->getOperand(0)->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1421' href='#L_ADDSUB_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> <div class='tooltip'>(LHSConv->hasOneUse() || <span class='tooltip-content'>34</span></div><div class='tooltip'>RHSConv->hasOneUse()<span class='tooltip-content'>14</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1422' href='#L_ADDSUB_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> WillNotOverflowSignedAdd(LHSConv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1423' href='#L_ADDSUB_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> RHSConv->getOperand(0), I)) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1424' href='#L_ADDSUB_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Insert the new integer add.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1425' href='#L_ADDSUB_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateNSWAdd(LHSConv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1426' href='#L_ADDSUB_1426'><pre>1426</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> RHSConv->getOperand(0),"addconv");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1427' href='#L_ADDSUB_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new SIToFPInst(NewAdd, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1428' href='#L_ADDSUB_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1429' href='#L_ADDSUB_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1430' href='#L_ADDSUB_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1431' href='#L_ADDSUB_1431'><pre>1431</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1432' href='#L_ADDSUB_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> // select C, 0, B + select C, A, 0 -> select C, A, B</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1433' href='#L_ADDSUB_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1434' href='#L_ADDSUB_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> Value *A1, *B1, *C1, *A2, *B2, *C2;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1435' href='#L_ADDSUB_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> if (match(LHS, m_Select(m_Value(C1), m_Value(A1), m_Value(B1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1436' href='#L_ADDSUB_1436'><pre>1436</pre></a></td><td class='covered-line'><pre>488</pre></td><td class='code'><pre> <div class='tooltip'>match(RHS, m_Select(m_Value(C2), m_Value(A2), m_Value(B2)))<span class='tooltip-content'>488</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1437' href='#L_ADDSUB_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (<div class='tooltip'>C1 == C2<span class='tooltip-content'>16</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1438' href='#L_ADDSUB_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Constant *Z1=nullptr, *Z2=nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1439' href='#L_ADDSUB_1439'><pre>1439</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Value *A, *B, *C=C1;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1440' href='#L_ADDSUB_1440'><pre>1440</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (<div class='tooltip'>match(A1, m_AnyZero()) && <span class='tooltip-content'>16</span></div><div class='tooltip'><span class='red'>match(B2, m_AnyZero())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1441' href='#L_ADDSUB_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z1 = dyn_cast<Constant>(A1); A = A2;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1442' href='#L_ADDSUB_1442'><pre>1442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z2 = dyn_cast<Constant>(B2); B = B1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1443' href='#L_ADDSUB_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>16</span></div><div class='tooltip'>match(B1, m_AnyZero()) && <span class='tooltip-content'>16</span></div><div class='tooltip'>match(A2, m_AnyZero())<span class='tooltip-content'>16</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1444' href='#L_ADDSUB_1444'><pre>1444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z1 = dyn_cast<Constant>(B1); B = B2;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1445' href='#L_ADDSUB_1445'><pre>1445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z2 = dyn_cast<Constant>(A2); A = A1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1446' href='#L_ADDSUB_1446'><pre>1446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1447' href='#L_ADDSUB_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1448' href='#L_ADDSUB_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (<div class='tooltip'>Z1 && <span class='tooltip-content'>16</span></div><div class='tooltip'><span class='red'>Z2</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1449' href='#L_ADDSUB_1449'><pre>1449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>(I.hasNoSignedZeros() ||</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1450' href='#L_ADDSUB_1450'><pre>1450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(Z1->isNegativeZeroValue() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Z2->isNegativeZeroValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1451' href='#L_ADDSUB_1451'><pre>1451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(C, A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1452' href='#L_ADDSUB_1452'><pre>1452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1453' href='#L_ADDSUB_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1454' href='#L_ADDSUB_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1455' href='#L_ADDSUB_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1456' href='#L_ADDSUB_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1457' href='#L_ADDSUB_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>162k</span></div><div class='tooltip'>I.hasUnsafeAlgebra()<span class='tooltip-content'>162k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1458' href='#L_ADDSUB_1458'><pre>1458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = FAddCombine(Builder).simplify(&I))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1459' href='#L_ADDSUB_1459'><pre>1459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1460' href='#L_ADDSUB_1460'><pre>1460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1461' href='#L_ADDSUB_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1462' href='#L_ADDSUB_1462'><pre>1462</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>162k</span></div><div class='tooltip'>&I<span class='tooltip-content'>453</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>162k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1463' href='#L_ADDSUB_1463'><pre>1463</pre></a></td><td class='covered-line'><pre>162k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1464' href='#L_ADDSUB_1464'><pre>1464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1465' href='#L_ADDSUB_1465'><pre>1465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Optimize pointer differences into the same array into a size. Consider:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1466' href='#L_ADDSUB_1466'><pre>1466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// &A[10] - &A[0]: we should compile this to "10". LHS/RHS are the pointer</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1467' href='#L_ADDSUB_1467'><pre>1467</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operands to the ptrtoint instructions for the LHS/RHS of the subtract.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1468' href='#L_ADDSUB_1468'><pre>1468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1469' href='#L_ADDSUB_1469'><pre>1469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::OptimizePointerDifference(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1470' href='#L_ADDSUB_1470'><pre>1470</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> Type *Ty) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1471' href='#L_ADDSUB_1471'><pre>1471</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // If LHS is a gep based on RHS or RHS is a gep based on LHS, we can optimize</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1472' href='#L_ADDSUB_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // this.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1473' href='#L_ADDSUB_1473'><pre>1473</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> bool Swapped = false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1474' href='#L_ADDSUB_1474'><pre>1474</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> GEPOperator *GEP1 = nullptr, *GEP2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1475' href='#L_ADDSUB_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1476' href='#L_ADDSUB_1476'><pre>1476</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // For now we require one side to be the base pointer "A" or a constant</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1477' href='#L_ADDSUB_1477'><pre>1477</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // GEP derived from it.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1478' href='#L_ADDSUB_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> if (GEPOperator *<div class='tooltip'>LHSGEP<span class='tooltip-content'>21.9k</span></div> = dyn_cast<GEPOperator>(LHS)) <div class='tooltip'>{<span class='tooltip-content'>15.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1479' href='#L_ADDSUB_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>15.8k</pre></td><td class='code'><pre> // (gep X, ...) - X</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1480' href='#L_ADDSUB_1480'><pre>1480</pre></a></td><td class='covered-line'><pre>15.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSGEP->getOperand(0) == RHS<span class='tooltip-content'>15.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1481' href='#L_ADDSUB_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> GEP1 = LHSGEP;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1482' href='#L_ADDSUB_1482'><pre>1482</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Swapped = false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1483' href='#L_ADDSUB_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>15.8k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (GEPOperator *<span class='tooltip-content'>15.8k</span></div><div class='tooltip'>RHSGEP<span class='tooltip-content'>15.8k</span></div> = dyn_cast<GEPOperator>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>143</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1484' href='#L_ADDSUB_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> // (gep X, ...) - (gep X, ...)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1485' href='#L_ADDSUB_1485'><pre>1485</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> if (LHSGEP->getOperand(0)->stripPointerCasts() ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1486' href='#L_ADDSUB_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> RHSGEP->getOperand(0)->stripPointerCasts()) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1487' href='#L_ADDSUB_1487'><pre>1487</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> GEP2 = RHSGEP;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1488' href='#L_ADDSUB_1488'><pre>1488</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> GEP1 = LHSGEP;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1489' href='#L_ADDSUB_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Swapped = false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1490' href='#L_ADDSUB_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1491' href='#L_ADDSUB_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1492' href='#L_ADDSUB_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>15.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1493' href='#L_ADDSUB_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1494' href='#L_ADDSUB_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> if (GEPOperator *<div class='tooltip'>RHSGEP<span class='tooltip-content'>21.9k</span></div> = dyn_cast<GEPOperator>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>850</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1495' href='#L_ADDSUB_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>850</pre></td><td class='code'><pre> // X - (gep X, ...)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1496' href='#L_ADDSUB_1496'><pre>1496</pre></a></td><td class='covered-line'><pre>850</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSGEP->getOperand(0) == LHS<span class='tooltip-content'>850</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1497' href='#L_ADDSUB_1497'><pre>1497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> GEP1 = RHSGEP;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1498' href='#L_ADDSUB_1498'><pre>1498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Swapped = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1499' href='#L_ADDSUB_1499'><pre>1499</pre></a></td><td class='covered-line'><pre>850</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (GEPOperator *<span class='tooltip-content'>850</span></div><div class='tooltip'>LHSGEP<span class='tooltip-content'>850</span></div> = dyn_cast<GEPOperator>(LHS)) <div class='tooltip'>{<span class='tooltip-content'>143</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1500' href='#L_ADDSUB_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> // (gep X, ...) - (gep X, ...)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1501' href='#L_ADDSUB_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> if (RHSGEP->getOperand(0)->stripPointerCasts() ==</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1502' href='#L_ADDSUB_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> LHSGEP->getOperand(0)->stripPointerCasts()) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1503' href='#L_ADDSUB_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> GEP2 = LHSGEP;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1504' href='#L_ADDSUB_1504'><pre>1504</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> GEP1 = RHSGEP;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1505' href='#L_ADDSUB_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Swapped = true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1506' href='#L_ADDSUB_1506'><pre>1506</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1507' href='#L_ADDSUB_1507'><pre>1507</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1508' href='#L_ADDSUB_1508'><pre>1508</pre></a></td><td class='covered-line'><pre>850</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1509' href='#L_ADDSUB_1509'><pre>1509</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1510' href='#L_ADDSUB_1510'><pre>1510</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // Avoid duplicating the arithmetic if GEP2 has non-constant indices and</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1511' href='#L_ADDSUB_1511'><pre>1511</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // multiple users.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1512' href='#L_ADDSUB_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> if (!GEP1 ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1513' href='#L_ADDSUB_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>(GEP2 && <span class='tooltip-content'>36</span></div><div class='tooltip'>!GEP2->hasAllConstantIndices()<span class='tooltip-content'>24</span></div> && <div class='tooltip'>!GEP2->hasOneUse()<span class='tooltip-content'>24</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1514' href='#L_ADDSUB_1514'><pre>1514</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1515' href='#L_ADDSUB_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1516' href='#L_ADDSUB_1516'><pre>1516</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> // Emit the offset of the GEP and an intptr_t.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1517' href='#L_ADDSUB_1517'><pre>1517</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Value *Result = EmitGEPOffset(GEP1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1518' href='#L_ADDSUB_1518'><pre>1518</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1519' href='#L_ADDSUB_1519'><pre>1519</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // If we had a constant expression GEP on the other side offsetting the</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1520' href='#L_ADDSUB_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // pointer, subtract it from the offset we have.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1521' href='#L_ADDSUB_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (<div class='tooltip'>GEP2<span class='tooltip-content'>12</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1522' href='#L_ADDSUB_1522'><pre>1522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Offset = EmitGEPOffset(GEP2);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1523' href='#L_ADDSUB_1523'><pre>1523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result = Builder->CreateSub(Result, Offset);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1524' href='#L_ADDSUB_1524'><pre>1524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1525' href='#L_ADDSUB_1525'><pre>1525</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1526' href='#L_ADDSUB_1526'><pre>1526</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // If we have p - gep(p, ...) then we have to negate the result.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1527' href='#L_ADDSUB_1527'><pre>1527</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (Swapped)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1528' href='#L_ADDSUB_1528'><pre>1528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Result = Builder->CreateNeg(Result, "diff.neg")</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1529' href='#L_ADDSUB_1529'><pre>1529</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1530' href='#L_ADDSUB_1530'><pre>1530</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return Builder->CreateIntCast(Result, Ty, true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1531' href='#L_ADDSUB_1531'><pre>1531</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1532' href='#L_ADDSUB_1532'><pre>1532</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1533' href='#L_ADDSUB_1533'><pre>1533</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSub(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1534' href='#L_ADDSUB_1534'><pre>1534</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1535' href='#L_ADDSUB_1535'><pre>1535</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1536' href='#L_ADDSUB_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1537' href='#L_ADDSUB_1537'><pre>1537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1538' href='#L_ADDSUB_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1539' href='#L_ADDSUB_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>136k</span></div><div class='tooltip'>V<span class='tooltip-content'>136k</span></div> = SimplifySubInst(Op0, Op1, I.hasNoSignedWrap(),</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1540' href='#L_ADDSUB_1540'><pre>1540</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> I.hasNoUnsignedWrap(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1541' href='#L_ADDSUB_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1542' href='#L_ADDSUB_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1543' href='#L_ADDSUB_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // (A*B)-(A*C) -> A*(B-C) etc</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1544' href='#L_ADDSUB_1544'><pre>1544</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>136k</span></div><div class='tooltip'>V<span class='tooltip-content'>136k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1545' href='#L_ADDSUB_1545'><pre>1545</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1546' href='#L_ADDSUB_1546'><pre>1546</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1547' href='#L_ADDSUB_1547'><pre>1547</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // If this is a 'B = x-(-A)', change to B = x+A.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1548' href='#L_ADDSUB_1548'><pre>1548</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>136k</span></div><div class='tooltip'>V<span class='tooltip-content'>136k</span></div> = dyn_castNegVal(Op1)) <div class='tooltip'>{<span class='tooltip-content'>3.30k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1549' href='#L_ADDSUB_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre> BinaryOperator *Res = BinaryOperator::CreateAdd(Op0, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1550' href='#L_ADDSUB_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1551' href='#L_ADDSUB_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre> if (const auto *<div class='tooltip'>BO<span class='tooltip-content'>3.30k</span></div> = dyn_cast<BinaryOperator>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1552' href='#L_ADDSUB_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> assert(BO->getOpcode() == Instruction::Sub &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1553' href='#L_ADDSUB_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> "Expected a subtraction operator!");</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1554' href='#L_ADDSUB_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>BO->hasNoSignedWrap() && <span class='tooltip-content'>2</span></div><div class='tooltip'>I.hasNoSignedWrap()<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1555' href='#L_ADDSUB_1555'><pre>1555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Res->setHasNoSignedWrap(true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1556' href='#L_ADDSUB_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>3.29k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1557' href='#L_ADDSUB_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>3.29k</pre></td><td class='code'><pre> if (<div class='tooltip'>cast<Constant>(Op1)->isNotMinSignedValue() && <span class='tooltip-content'>3.29k</span></div><div class='tooltip'>I.hasNoSignedWrap()<span class='tooltip-content'>3.29k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1558' href='#L_ADDSUB_1558'><pre>1558</pre></a></td><td class='covered-line'><pre>2.23k</pre></td><td class='code'><pre> Res->setHasNoSignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1559' href='#L_ADDSUB_1559'><pre>1559</pre></a></td><td class='covered-line'><pre>3.29k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1560' href='#L_ADDSUB_1560'><pre>1560</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1561' href='#L_ADDSUB_1561'><pre>1561</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1562' href='#L_ADDSUB_1562'><pre>1562</pre></a></td><td class='covered-line'><pre>3.30k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1563' href='#L_ADDSUB_1563'><pre>1563</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1564' href='#L_ADDSUB_1564'><pre>1564</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>133k</span></div><div class='tooltip'>I.getType()->isIntegerTy(1)<span class='tooltip-content'>133k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1565' href='#L_ADDSUB_1565'><pre>1565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(Op0, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1566' href='#L_ADDSUB_1566'><pre>1566</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1567' href='#L_ADDSUB_1567'><pre>1567</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> // Replace (-1 - A) with (~A).</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1568' href='#L_ADDSUB_1568'><pre>1568</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>133k</span></div><div class='tooltip'>match(Op0, m_AllOnes())<span class='tooltip-content'>133k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1569' href='#L_ADDSUB_1569'><pre>1569</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> return BinaryOperator::CreateNot(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1570' href='#L_ADDSUB_1570'><pre>1570</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1571' href='#L_ADDSUB_1571'><pre>1571</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>133k</span></div><div class='tooltip'>C<span class='tooltip-content'>133k</span></div> = dyn_cast<Constant>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>28.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1572' href='#L_ADDSUB_1572'><pre>1572</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> // C - ~X == X + (1+C)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1573' href='#L_ADDSUB_1573'><pre>1573</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> Value *X = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1574' href='#L_ADDSUB_1574'><pre>1574</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> if (match(Op1, m_Not(m_Value(X))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1575' href='#L_ADDSUB_1575'><pre>1575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAdd(X, AddOne(C))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1576' href='#L_ADDSUB_1576'><pre>1576</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1577' href='#L_ADDSUB_1577'><pre>1577</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> // Try to fold constant sub into select arguments.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1578' href='#L_ADDSUB_1578'><pre>1578</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>28.9k</span></div><div class='tooltip'>SI<span class='tooltip-content'>28.9k</span></div> = dyn_cast<SelectInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1579' href='#L_ADDSUB_1579'><pre>1579</pre></a></td><td class='covered-line'><pre>909</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>909</span></div><div class='tooltip'>R<span class='tooltip-content'>909</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1580' href='#L_ADDSUB_1580'><pre>1580</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1581' href='#L_ADDSUB_1581'><pre>1581</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1582' href='#L_ADDSUB_1582'><pre>1582</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> // C-(X+C2) --> (C-C2)-X</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1583' href='#L_ADDSUB_1583'><pre>1583</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> Constant *C2;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1584' href='#L_ADDSUB_1584'><pre>1584</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> if (match(Op1, m_Add(m_Value(X), m_Constant(C2))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1585' href='#L_ADDSUB_1585'><pre>1585</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(ConstantExpr::getSub(C, C2), X);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1586' href='#L_ADDSUB_1586'><pre>1586</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1587' href='#L_ADDSUB_1587'><pre>1587</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> // Fold (sub 0, (zext bool to B)) --> (sext bool to B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1588' href='#L_ADDSUB_1588'><pre>1588</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.9k</span></div><div class='tooltip'>C->isNullValue() && <span class='tooltip-content'>28.9k</span></div><div class='tooltip'>match(Op1, m_ZExt(m_Value(X)))<span class='tooltip-content'>19.8k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1589' href='#L_ADDSUB_1589'><pre>1589</pre></a></td><td class='covered-line'><pre>3.75k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.75k</span></div><div class='tooltip'>X->getType()->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>3.75k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1590' href='#L_ADDSUB_1590'><pre>1590</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> return CastInst::CreateSExtOrBitCast(X, Op1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1591' href='#L_ADDSUB_1591'><pre>1591</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1592' href='#L_ADDSUB_1592'><pre>1592</pre></a></td><td class='covered-line'><pre>28.9k</pre></td><td class='code'><pre> // Fold (sub 0, (sext bool to B)) --> (zext bool to B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1593' href='#L_ADDSUB_1593'><pre>1593</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.8k</span></div><div class='tooltip'>C->isNullValue() && <span class='tooltip-content'>28.8k</span></div><div class='tooltip'>match(Op1, m_SExt(m_Value(X)))<span class='tooltip-content'>19.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1594' href='#L_ADDSUB_1594'><pre>1594</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.16k</span></div><div class='tooltip'>X->getType()->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>1.16k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1595' href='#L_ADDSUB_1595'><pre>1595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return CastInst::CreateZExtOrBitCast(X, Op1->getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1596' href='#L_ADDSUB_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1597' href='#L_ADDSUB_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1598' href='#L_ADDSUB_1598'><pre>1598</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> const APInt *Op0C;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1599' href='#L_ADDSUB_1599'><pre>1599</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_APInt(Op0C))<span class='tooltip-content'>132k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1600' href='#L_ADDSUB_1600'><pre>1600</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> unsigned BitWidth = I.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1601' href='#L_ADDSUB_1601'><pre>1601</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1602' href='#L_ADDSUB_1602'><pre>1602</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> // -(X >>u 31) -> (X >>s 31)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1603' href='#L_ADDSUB_1603'><pre>1603</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> // -(X >>s 31) -> (X >>u 31)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1604' href='#L_ADDSUB_1604'><pre>1604</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>*Op0C == 0<span class='tooltip-content'>28.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1605' href='#L_ADDSUB_1605'><pre>1605</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1606' href='#L_ADDSUB_1606'><pre>1606</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> const APInt *ShAmt;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1607' href='#L_ADDSUB_1607'><pre>1607</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> if (match(Op1, m_LShr(m_Value(X), m_APInt(ShAmt))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1608' href='#L_ADDSUB_1608'><pre>1608</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> <div class='tooltip'>*ShAmt == BitWidth - 1<span class='tooltip-content'>17</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1609' href='#L_ADDSUB_1609'><pre>1609</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *ShAmtOp = cast<Instruction>(Op1)->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1610' href='#L_ADDSUB_1610'><pre>1610</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return BinaryOperator::CreateAShr(X, ShAmtOp);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1611' href='#L_ADDSUB_1611'><pre>1611</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1612' href='#L_ADDSUB_1612'><pre>1612</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>19.7k</span></div><div class='tooltip'>match(Op1, m_AShr(m_Value(X), m_APInt(ShAmt))) &&<span class='tooltip-content'>19.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1613' href='#L_ADDSUB_1613'><pre>1613</pre></a></td><td class='covered-line'><pre>674</pre></td><td class='code'><pre> <div class='tooltip'>*ShAmt == BitWidth - 1<span class='tooltip-content'>674</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1614' href='#L_ADDSUB_1614'><pre>1614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ShAmtOp = cast<Instruction>(Op1)->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1615' href='#L_ADDSUB_1615'><pre>1615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateLShr(X, ShAmtOp);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1616' href='#L_ADDSUB_1616'><pre>1616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1617' href='#L_ADDSUB_1617'><pre>1617</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1618' href='#L_ADDSUB_1618'><pre>1618</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1619' href='#L_ADDSUB_1619'><pre>1619</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> // Turn this into a xor if LHS is 2^n-1 and the remaining bits are known</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1620' href='#L_ADDSUB_1620'><pre>1620</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> // zero.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1621' href='#L_ADDSUB_1621'><pre>1621</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.8k</span></div><div class='tooltip'>(*Op0C + 1).isPowerOf2()<span class='tooltip-content'>28.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1622' href='#L_ADDSUB_1622'><pre>1622</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> APInt KnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1623' href='#L_ADDSUB_1623'><pre>1623</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> APInt KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1624' href='#L_ADDSUB_1624'><pre>1624</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> computeKnownBits(&I, KnownZero, KnownOne, 0, &I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1625' href='#L_ADDSUB_1625'><pre>1625</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> if ((*Op0C | KnownZero).isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1626' href='#L_ADDSUB_1626'><pre>1626</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(Op1, Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1627' href='#L_ADDSUB_1627'><pre>1627</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1628' href='#L_ADDSUB_1628'><pre>1628</pre></a></td><td class='covered-line'><pre>28.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1629' href='#L_ADDSUB_1629'><pre>1629</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1630' href='#L_ADDSUB_1630'><pre>1630</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1631' href='#L_ADDSUB_1631'><pre>1631</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> Value *Y;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1632' href='#L_ADDSUB_1632'><pre>1632</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // X-(X+Y) == -Y X-(Y+X) == -Y</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1633' href='#L_ADDSUB_1633'><pre>1633</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (match(Op1, m_Add(m_Specific(Op0), m_Value(Y))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1634' href='#L_ADDSUB_1634'><pre>1634</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> match(Op1, m_Add(m_Value(Y), m_Specific(Op0))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1635' href='#L_ADDSUB_1635'><pre>1635</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> return BinaryOperator::CreateNeg(Y);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1636' href='#L_ADDSUB_1636'><pre>1636</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1637' href='#L_ADDSUB_1637'><pre>1637</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // (X-Y)-X == -Y</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1638' href='#L_ADDSUB_1638'><pre>1638</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>132k</span></div><div class='tooltip'>match(Op0, m_Sub(m_Specific(Op1), m_Value(Y)))<span class='tooltip-content'>132k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1639' href='#L_ADDSUB_1639'><pre>1639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateNeg(Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1640' href='#L_ADDSUB_1640'><pre>1640</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1641' href='#L_ADDSUB_1641'><pre>1641</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1642' href='#L_ADDSUB_1642'><pre>1642</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // (sub (or A, B) (xor A, B)) --> (and A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1643' href='#L_ADDSUB_1643'><pre>1643</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1644' href='#L_ADDSUB_1644'><pre>1644</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1645' href='#L_ADDSUB_1645'><pre>1645</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1646' href='#L_ADDSUB_1646'><pre>1646</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> (match(Op0, m_Or(m_Specific(A), m_Specific(B))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1647' href='#L_ADDSUB_1647'><pre>1647</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> match(Op0, m_Or(m_Specific(B), m_Specific(A)))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1648' href='#L_ADDSUB_1648'><pre>1648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1649' href='#L_ADDSUB_1649'><pre>1649</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1650' href='#L_ADDSUB_1650'><pre>1650</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1651' href='#L_ADDSUB_1651'><pre>1651</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>132k</span></div><div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>132k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>61.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1652' href='#L_ADDSUB_1652'><pre>1652</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> Value *Y = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1653' href='#L_ADDSUB_1653'><pre>1653</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> // ((X | Y) - X) --> (~X & Y)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1654' href='#L_ADDSUB_1654'><pre>1654</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> if (match(Op0, m_Or(m_Value(Y), m_Specific(Op1))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1655' href='#L_ADDSUB_1655'><pre>1655</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> match(Op0, m_Or(m_Specific(Op1), m_Value(Y))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1656' href='#L_ADDSUB_1656'><pre>1656</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1657' href='#L_ADDSUB_1657'><pre>1657</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Y, Builder->CreateNot(Op1, Op1->getName() + ".not"));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1658' href='#L_ADDSUB_1658'><pre>1658</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1659' href='#L_ADDSUB_1659'><pre>1659</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1660' href='#L_ADDSUB_1660'><pre>1660</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>132k</span></div><div class='tooltip'>Op1->hasOneUse()<span class='tooltip-content'>132k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>63.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1661' href='#L_ADDSUB_1661'><pre>1661</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> Value *X = nullptr, *Y = nullptr, *Z = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1662' href='#L_ADDSUB_1662'><pre>1662</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> Constant *C = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1663' href='#L_ADDSUB_1663'><pre>1663</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> Constant *CI = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1664' href='#L_ADDSUB_1664'><pre>1664</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1665' href='#L_ADDSUB_1665'><pre>1665</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> // (X - (Y - Z)) --> (X + (Z - Y)).</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1666' href='#L_ADDSUB_1666'><pre>1666</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> if (match(Op1, m_Sub(m_Value(Y), m_Value(Z))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1667' href='#L_ADDSUB_1667'><pre>1667</pre></a></td><td class='covered-line'><pre>93</pre></td><td class='code'><pre> return BinaryOperator::CreateAdd(Op0,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1668' href='#L_ADDSUB_1668'><pre>1668</pre></a></td><td class='covered-line'><pre>93</pre></td><td class='code'><pre> Builder->CreateSub(Z, Y, Op1->getName()));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1669' href='#L_ADDSUB_1669'><pre>1669</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1670' href='#L_ADDSUB_1670'><pre>1670</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> // (X - (X & Y)) --> (X & ~Y)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1671' href='#L_ADDSUB_1671'><pre>1671</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1672' href='#L_ADDSUB_1672'><pre>1672</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op1, m_And(m_Value(Y), m_Specific(Op0))) ||<span class='tooltip-content'>63.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1673' href='#L_ADDSUB_1673'><pre>1673</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> match(Op1, m_And(m_Specific(Op0), m_Value(Y))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1674' href='#L_ADDSUB_1674'><pre>1674</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Op0,</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1675' href='#L_ADDSUB_1675'><pre>1675</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Builder->CreateNot(Y, Y->getName() + ".not"));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1676' href='#L_ADDSUB_1676'><pre>1676</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1677' href='#L_ADDSUB_1677'><pre>1677</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // 0 - (X sdiv C) -> (X sdiv -C) provided the negation doesn't overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1678' href='#L_ADDSUB_1678'><pre>1678</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op1, m_SDiv(m_Value(X), m_Constant(C))) && <span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op0, m_Zero())<span class='tooltip-content'>93</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1679' href='#L_ADDSUB_1679'><pre>1679</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> <div class='tooltip'>C->isNotMinSignedValue()<span class='tooltip-content'>27</span></div> && <div class='tooltip'>!C->isOneValue()<span class='tooltip-content'>27</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1680' href='#L_ADDSUB_1680'><pre>1680</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return BinaryOperator::CreateSDiv(X, ConstantExpr::getNeg(C));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1681' href='#L_ADDSUB_1681'><pre>1681</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1682' href='#L_ADDSUB_1682'><pre>1682</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // 0 - (X << Y) -> (-X << Y) when X is freely negatable.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1683' href='#L_ADDSUB_1683'><pre>1683</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op1, m_Shl(m_Value(X), m_Value(Y))) && <span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op0, m_Zero())<span class='tooltip-content'>846</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1684' href='#L_ADDSUB_1684'><pre>1684</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>14</span></div><div class='tooltip'>XNeg<span class='tooltip-content'>14</span></div> = dyn_castNegVal(X))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1685' href='#L_ADDSUB_1685'><pre>1685</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return BinaryOperator::CreateShl(XNeg, Y);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1686' href='#L_ADDSUB_1686'><pre>1686</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1687' href='#L_ADDSUB_1687'><pre>1687</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // Subtracting -1/0 is the same as adding 1/0:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1688' href='#L_ADDSUB_1688'><pre>1688</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // sub [nsw] Op0, sext(bool Y) -> add [nsw] Op0, zext(bool Y)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1689' href='#L_ADDSUB_1689'><pre>1689</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // 'nuw' is dropped in favor of the canonical form.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1690' href='#L_ADDSUB_1690'><pre>1690</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op1, m_SExt(m_Value(Y))) &&<span class='tooltip-content'>63.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1691' href='#L_ADDSUB_1691'><pre>1691</pre></a></td><td class='covered-line'><pre>2.30k</pre></td><td class='code'><pre> <div class='tooltip'>Y->getType()->getScalarSizeInBits() == 1<span class='tooltip-content'>2.30k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1692' href='#L_ADDSUB_1692'><pre>1692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Zext = Builder->CreateZExt(Y, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1693' href='#L_ADDSUB_1693'><pre>1693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *Add = BinaryOperator::CreateAdd(Op0, Zext);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1694' href='#L_ADDSUB_1694'><pre>1694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Add->setHasNoSignedWrap(I.hasNoSignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1695' href='#L_ADDSUB_1695'><pre>1695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Add;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1696' href='#L_ADDSUB_1696'><pre>1696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1697' href='#L_ADDSUB_1697'><pre>1697</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1698' href='#L_ADDSUB_1698'><pre>1698</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // X - A*-B -> X + A*B</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1699' href='#L_ADDSUB_1699'><pre>1699</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // X - -A*B -> X + A*B</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1700' href='#L_ADDSUB_1700'><pre>1700</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1701' href='#L_ADDSUB_1701'><pre>1701</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> if (match(Op1, m_Mul(m_Value(A), m_Neg(m_Value(B)))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1702' href='#L_ADDSUB_1702'><pre>1702</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> match(Op1, m_Mul(m_Neg(m_Value(A)), m_Value(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1703' href='#L_ADDSUB_1703'><pre>1703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAdd(Op0, Builder->CreateMul(A, B))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1704' href='#L_ADDSUB_1704'><pre>1704</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1705' href='#L_ADDSUB_1705'><pre>1705</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // X - A*CI -> X + A*-CI</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1706' href='#L_ADDSUB_1706'><pre>1706</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> // X - CI*A -> X + A*-CI</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1707' href='#L_ADDSUB_1707'><pre>1707</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.0k</span></div><div class='tooltip'>match(Op1, m_Mul(m_Value(A), m_Constant(CI))) ||<span class='tooltip-content'>63.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1708' href='#L_ADDSUB_1708'><pre>1708</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_Mul(m_Constant(CI), m_Value(A)))<span class='tooltip-content'>63.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1709' href='#L_ADDSUB_1709'><pre>1709</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Value *NewMul = Builder->CreateMul(A, ConstantExpr::getNeg(CI));</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1710' href='#L_ADDSUB_1710'><pre>1710</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return BinaryOperator::CreateAdd(Op0, NewMul);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1711' href='#L_ADDSUB_1711'><pre>1711</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1712' href='#L_ADDSUB_1712'><pre>1712</pre></a></td><td class='covered-line'><pre>63.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1713' href='#L_ADDSUB_1713'><pre>1713</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1714' href='#L_ADDSUB_1714'><pre>1714</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // Optimize pointer differences into the same array into a size. Consider:</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1715' href='#L_ADDSUB_1715'><pre>1715</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // &A[10] - &A[0]: we should compile this to "10".</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1716' href='#L_ADDSUB_1716'><pre>1716</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> Value *LHSOp, *RHSOp;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1717' href='#L_ADDSUB_1717'><pre>1717</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (match(Op0, m_PtrToInt(m_Value(LHSOp))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1718' href='#L_ADDSUB_1718'><pre>1718</pre></a></td><td class='covered-line'><pre>24.8k</pre></td><td class='code'><pre> match(Op1, m_PtrToInt(m_Value(RHSOp))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1719' href='#L_ADDSUB_1719'><pre>1719</pre></a></td><td class='covered-line'><pre>21.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>21.9k</span></div><div class='tooltip'>Res<span class='tooltip-content'>21.9k</span></div> = OptimizePointerDifference(LHSOp, RHSOp, I.getType()))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1720' href='#L_ADDSUB_1720'><pre>1720</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Res);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1721' href='#L_ADDSUB_1721'><pre>1721</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1722' href='#L_ADDSUB_1722'><pre>1722</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> // trunc(p)-trunc(q) -> trunc(p-q)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1723' href='#L_ADDSUB_1723'><pre>1723</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>132k</span></div><div class='tooltip'>match(Op0, m_Trunc(m_PtrToInt(m_Value(LHSOp)))) &&<span class='tooltip-content'>132k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1724' href='#L_ADDSUB_1724'><pre>1724</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> match(Op1, m_Trunc(m_PtrToInt(m_Value(RHSOp)))))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1725' href='#L_ADDSUB_1725'><pre>1725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Res</span><span class='tooltip-content'>0</span></div><span class='red'> = OptimizePointerDifference(LHSOp, RHSOp, I.getType()))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1726' href='#L_ADDSUB_1726'><pre>1726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Res)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1727' href='#L_ADDSUB_1727'><pre>1727</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1728' href='#L_ADDSUB_1728'><pre>1728</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> bool Changed = false;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1729' href='#L_ADDSUB_1729'><pre>1729</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I.hasNoSignedWrap() && <span class='tooltip-content'>132k</span></div><div class='tooltip'>WillNotOverflowSignedSub(Op0, Op1, I)<span class='tooltip-content'>68.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>923</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1730' href='#L_ADDSUB_1730'><pre>1730</pre></a></td><td class='covered-line'><pre>923</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1731' href='#L_ADDSUB_1731'><pre>1731</pre></a></td><td class='covered-line'><pre>923</pre></td><td class='code'><pre> I.setHasNoSignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1732' href='#L_ADDSUB_1732'><pre>1732</pre></a></td><td class='covered-line'><pre>923</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1733' href='#L_ADDSUB_1733'><pre>1733</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I.hasNoUnsignedWrap() && <span class='tooltip-content'>132k</span></div><div class='tooltip'>WillNotOverflowUnsignedSub(Op0, Op1, I)<span class='tooltip-content'>131k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1734' href='#L_ADDSUB_1734'><pre>1734</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1735' href='#L_ADDSUB_1735'><pre>1735</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> I.setHasNoUnsignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1736' href='#L_ADDSUB_1736'><pre>1736</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1737' href='#L_ADDSUB_1737'><pre>1737</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1738' href='#L_ADDSUB_1738'><pre>1738</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> return Changed ? <div class='tooltip'>&I<span class='tooltip-content'>924</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>131k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1739' href='#L_ADDSUB_1739'><pre>1739</pre></a></td><td class='covered-line'><pre>132k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1740' href='#L_ADDSUB_1740'><pre>1740</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1741' href='#L_ADDSUB_1741'><pre>1741</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFSub(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1742' href='#L_ADDSUB_1742'><pre>1742</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1743' href='#L_ADDSUB_1743'><pre>1743</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1744' href='#L_ADDSUB_1744'><pre>1744</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1745' href='#L_ADDSUB_1745'><pre>1745</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1746' href='#L_ADDSUB_1746'><pre>1746</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1747' href='#L_ADDSUB_1747'><pre>1747</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>68.2k</span></div> =</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1748' href='#L_ADDSUB_1748'><pre>1748</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> SimplifyFSubInst(Op0, Op1, I.getFastMathFlags(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1749' href='#L_ADDSUB_1749'><pre>1749</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1750' href='#L_ADDSUB_1750'><pre>1750</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1751' href='#L_ADDSUB_1751'><pre>1751</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> // fsub nsz 0, X ==> fsub nsz -0.0, X</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1752' href='#L_ADDSUB_1752'><pre>1752</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>I.getFastMathFlags().noSignedZeros() && <span class='tooltip-content'>68.2k</span></div><div class='tooltip'><span class='red'>match(Op0, m_Zero())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1753' href='#L_ADDSUB_1753'><pre>1753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Subtraction from -0.0 is the canonical form of fneg.</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1754' href='#L_ADDSUB_1754'><pre>1754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewI = BinaryOperator::CreateFNeg(Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1755' href='#L_ADDSUB_1755'><pre>1755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->copyFastMathFlags(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1756' href='#L_ADDSUB_1756'><pre>1756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1757' href='#L_ADDSUB_1757'><pre>1757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1758' href='#L_ADDSUB_1758'><pre>1758</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1759' href='#L_ADDSUB_1759'><pre>1759</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>isa<Constant>(Op0)<span class='tooltip-content'>68.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1760' href='#L_ADDSUB_1760'><pre>1760</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>15.0k</span></div><div class='tooltip'>SI<span class='tooltip-content'>15.0k</span></div> = dyn_cast<SelectInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1761' href='#L_ADDSUB_1761'><pre>1761</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>91</span></div><div class='tooltip'>NV<span class='tooltip-content'>91</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1762' href='#L_ADDSUB_1762'><pre>1762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return NV</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1763' href='#L_ADDSUB_1763'><pre>1763</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1764' href='#L_ADDSUB_1764'><pre>1764</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> // If this is a 'B = x-(-A)', change to B = x+A, potentially looking</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1765' href='#L_ADDSUB_1765'><pre>1765</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> // through FP extensions/truncations along the way.</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1766' href='#L_ADDSUB_1766'><pre>1766</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>68.2k</span></div> = dyn_castFNegVal(Op1)) <div class='tooltip'>{<span class='tooltip-content'>63</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1767' href='#L_ADDSUB_1767'><pre>1767</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> Instruction *NewI = BinaryOperator::CreateFAdd(Op0, V);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1768' href='#L_ADDSUB_1768'><pre>1768</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> NewI->copyFastMathFlags(&I);</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1769' href='#L_ADDSUB_1769'><pre>1769</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> return NewI;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1770' href='#L_ADDSUB_1770'><pre>1770</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1771' href='#L_ADDSUB_1771'><pre>1771</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (FPTruncInst *<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>FPTI<span class='tooltip-content'>68.2k</span></div> = dyn_cast<FPTruncInst>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>22</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1772' href='#L_ADDSUB_1772'><pre>1772</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>22</span></div> = dyn_castFNegVal(FPTI->getOperand(0))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1773' href='#L_ADDSUB_1773'><pre>1773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewTrunc = Builder->CreateFPTrunc(V, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1774' href='#L_ADDSUB_1774'><pre>1774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewI = BinaryOperator::CreateFAdd(Op0, NewTrunc);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1775' href='#L_ADDSUB_1775'><pre>1775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->copyFastMathFlags(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1776' href='#L_ADDSUB_1776'><pre>1776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1777' href='#L_ADDSUB_1777'><pre>1777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1778' href='#L_ADDSUB_1778'><pre>1778</pre></a></td><td class='covered-line'><pre>68.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (FPExtInst *<span class='tooltip-content'>68.1k</span></div><div class='tooltip'>FPEI<span class='tooltip-content'>68.1k</span></div> = dyn_cast<FPExtInst>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1.83k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1779' href='#L_ADDSUB_1779'><pre>1779</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>1.83k</span></div> = dyn_castFNegVal(FPEI->getOperand(0))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1780' href='#L_ADDSUB_1780'><pre>1780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewExt = Builder->CreateFPExt(V, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1781' href='#L_ADDSUB_1781'><pre>1781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewI = BinaryOperator::CreateFAdd(Op0, NewExt);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1782' href='#L_ADDSUB_1782'><pre>1782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->copyFastMathFlags(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1783' href='#L_ADDSUB_1783'><pre>1783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1784' href='#L_ADDSUB_1784'><pre>1784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1785' href='#L_ADDSUB_1785'><pre>1785</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1786' href='#L_ADDSUB_1786'><pre>1786</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1787' href='#L_ADDSUB_1787'><pre>1787</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>68.2k</span></div><div class='tooltip'>I.hasUnsafeAlgebra()<span class='tooltip-content'>68.2k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1788' href='#L_ADDSUB_1788'><pre>1788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = FAddCombine(Builder).simplify(&I))</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1789' href='#L_ADDSUB_1789'><pre>1789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1790' href='#L_ADDSUB_1790'><pre>1790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1791' href='#L_ADDSUB_1791'><pre>1791</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1792' href='#L_ADDSUB_1792'><pre>1792</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ADDSUB_1793' href='#L_ADDSUB_1793'><pre>1793</pre></a></td><td class='covered-line'><pre>68.2k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='ANDXOR' href='#ANDXOR'>lib/Transforms/InstCombine/InstCombineAndOrXor.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_ANDXOR_75'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1' href='#L_ANDXOR_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineAndOrXor.cpp --------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2' href='#L_ANDXOR_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_3' href='#L_ANDXOR_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_4' href='#L_ANDXOR_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_5' href='#L_ANDXOR_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_6' href='#L_ANDXOR_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_7' href='#L_ANDXOR_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_8' href='#L_ANDXOR_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_9' href='#L_ANDXOR_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_10' href='#L_ANDXOR_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitAnd, visitOr, and visitXor functions.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_11' href='#L_ANDXOR_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_12' href='#L_ANDXOR_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_13' href='#L_ANDXOR_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_14' href='#L_ANDXOR_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_15' href='#L_ANDXOR_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_16' href='#L_ANDXOR_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/ConstantRange.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_17' href='#L_ANDXOR_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Intrinsics.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_18' href='#L_ANDXOR_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_19' href='#L_ANDXOR_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/CmpInstAnalysis.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_20' href='#L_ANDXOR_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/Local.h"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_21' href='#L_ANDXOR_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_22' href='#L_ANDXOR_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_23' href='#L_ANDXOR_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_24' href='#L_ANDXOR_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_25' href='#L_ANDXOR_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_26' href='#L_ANDXOR_26'><pre>26</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre>static inline Value *dyn_castNotVal(Value *V) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_27' href='#L_ANDXOR_27'><pre>27</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre> // If this is not(not(x)) don't return that this is a not: we want the two</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_28' href='#L_ANDXOR_28'><pre>28</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre> // not's to be folded first.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_29' href='#L_ANDXOR_29'><pre>29</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre> if (<div class='tooltip'>BinaryOperator::isNot(V)<span class='tooltip-content'>306k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>33.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_30' href='#L_ANDXOR_30'><pre>30</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> Value *Operand = BinaryOperator::getNotArgument(V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_31' href='#L_ANDXOR_31'><pre>31</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> if (!IsFreeToInvert(Operand, Operand->hasOneUse()))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_32' href='#L_ANDXOR_32'><pre>32</pre></a></td><td class='covered-line'><pre>31.5k</pre></td><td class='code'><pre> return Operand;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_33' href='#L_ANDXOR_33'><pre>33</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_34' href='#L_ANDXOR_34'><pre>34</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_35' href='#L_ANDXOR_35'><pre>35</pre></a></td><td class='covered-line'><pre>306k</pre></td><td class='code'><pre> // Constants can be considered to be not'ed values...</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_36' href='#L_ANDXOR_36'><pre>36</pre></a></td><td class='covered-line'><pre>274k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>274k</span></div><div class='tooltip'>C<span class='tooltip-content'>274k</span></div> = dyn_cast<ConstantInt>(V))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_37' href='#L_ANDXOR_37'><pre>37</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> return ConstantInt::get(C->getType(), ~C->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_38' href='#L_ANDXOR_38'><pre>38</pre></a></td><td class='covered-line'><pre>274k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_39' href='#L_ANDXOR_39'><pre>39</pre></a></td><td class='covered-line'><pre>274k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_40' href='#L_ANDXOR_40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_41' href='#L_ANDXOR_41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Similar to getICmpCode but for FCmpInst. This encodes a fcmp predicate into</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_42' href='#L_ANDXOR_42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a four bit mask.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_43' href='#L_ANDXOR_43'><pre>43</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre>static unsigned getFCmpCode(FCmpInst::Predicate CC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_44' href='#L_ANDXOR_44'><pre>44</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> assert(FCmpInst::FCMP_FALSE <= CC && CC <= FCmpInst::FCMP_TRUE &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_45' href='#L_ANDXOR_45'><pre>45</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> "Unexpected FCmp predicate!");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_46' href='#L_ANDXOR_46'><pre>46</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // Take advantage of the bit pattern of FCmpInst::Predicate here.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_47' href='#L_ANDXOR_47'><pre>47</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // U L G E</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_48' href='#L_ANDXOR_48'><pre>48</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_FALSE == 0, ""); // 0 0 0 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_49' href='#L_ANDXOR_49'><pre>49</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_OEQ == 1, ""); // 0 0 0 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_50' href='#L_ANDXOR_50'><pre>50</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_OGT == 2, ""); // 0 0 1 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_51' href='#L_ANDXOR_51'><pre>51</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_OGE == 3, ""); // 0 0 1 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_52' href='#L_ANDXOR_52'><pre>52</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_OLT == 4, ""); // 0 1 0 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_53' href='#L_ANDXOR_53'><pre>53</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_OLE == 5, ""); // 0 1 0 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_54' href='#L_ANDXOR_54'><pre>54</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_ONE == 6, ""); // 0 1 1 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_55' href='#L_ANDXOR_55'><pre>55</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_ORD == 7, ""); // 0 1 1 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_56' href='#L_ANDXOR_56'><pre>56</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_UNO == 8, ""); // 1 0 0 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_57' href='#L_ANDXOR_57'><pre>57</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_UEQ == 9, ""); // 1 0 0 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_58' href='#L_ANDXOR_58'><pre>58</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_UGT == 10, ""); // 1 0 1 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_59' href='#L_ANDXOR_59'><pre>59</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_UGE == 11, ""); // 1 0 1 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_60' href='#L_ANDXOR_60'><pre>60</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_ULT == 12, ""); // 1 1 0 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_61' href='#L_ANDXOR_61'><pre>61</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_ULE == 13, ""); // 1 1 0 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_62' href='#L_ANDXOR_62'><pre>62</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_UNE == 14, ""); // 1 1 1 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_63' href='#L_ANDXOR_63'><pre>63</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> static_assert(FCmpInst::FCMP_TRUE == 15, ""); // 1 1 1 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_64' href='#L_ANDXOR_64'><pre>64</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return CC;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_65' href='#L_ANDXOR_65'><pre>65</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_66' href='#L_ANDXOR_66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_67' href='#L_ANDXOR_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is the complement of getICmpCode, which turns an opcode and two</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_68' href='#L_ANDXOR_68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operands into either a constant true or false, or a brand new ICmp</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_69' href='#L_ANDXOR_69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instruction. The sign is passed in to determine which kind of predicate to</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_70' href='#L_ANDXOR_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// use in the new icmp instruction.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_71' href='#L_ANDXOR_71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *getNewICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_72' href='#L_ANDXOR_72'><pre>72</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_73' href='#L_ANDXOR_73'><pre>73</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> ICmpInst::Predicate NewPred;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_74' href='#L_ANDXOR_74'><pre>74</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (Value *NewConstant = getICmpValue(Sign, Code, LHS, RHS, NewPred))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_75' href='#L_ANDXOR_75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return NewConstant</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_76' href='#L_ANDXOR_76'><pre>76</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return Builder->CreateICmp(NewPred, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_77' href='#L_ANDXOR_77'><pre>77</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_78' href='#L_ANDXOR_78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_79' href='#L_ANDXOR_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is the complement of getFCmpCode, which turns an opcode and two</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_80' href='#L_ANDXOR_80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operands into either a FCmp instruction, or a true/false constant.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_81' href='#L_ANDXOR_81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *getFCmpValue(unsigned Code, Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_82' href='#L_ANDXOR_82'><pre>82</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_83' href='#L_ANDXOR_83'><pre>83</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> const auto Pred = static_cast<FCmpInst::Predicate>(Code);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_84' href='#L_ANDXOR_84'><pre>84</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> assert(FCmpInst::FCMP_FALSE <= Pred && Pred <= FCmpInst::FCMP_TRUE &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_85' href='#L_ANDXOR_85'><pre>85</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> "Unexpected FCmp predicate!");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_86' href='#L_ANDXOR_86'><pre>86</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (Pred == FCmpInst::FCMP_FALSE)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_87' href='#L_ANDXOR_87'><pre>87</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_88' href='#L_ANDXOR_88'><pre>88</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>Pred == FCmpInst::FCMP_TRUE<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_89' href='#L_ANDXOR_89'><pre>89</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_90' href='#L_ANDXOR_90'><pre>90</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Builder->CreateFCmp(Pred, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_91' href='#L_ANDXOR_91'><pre>91</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_92' href='#L_ANDXOR_92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_93' href='#L_ANDXOR_93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Transform BITWISE_OP(BSWAP(A),BSWAP(B)) to BSWAP(BITWISE_OP(A, B))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_94' href='#L_ANDXOR_94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param I Binary operator to transform.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_95' href='#L_ANDXOR_95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \return Pointer to node that must replace the original binary operator, or</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_96' href='#L_ANDXOR_96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// null pointer if no transformation was made.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_97' href='#L_ANDXOR_97'><pre>97</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre>Value *InstCombiner::SimplifyBSwap(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_98' href='#L_ANDXOR_98'><pre>98</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> IntegerType *ITy = dyn_cast<IntegerType>(I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_99' href='#L_ANDXOR_99'><pre>99</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_100' href='#L_ANDXOR_100'><pre>100</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> // Can't do vectors.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_101' href='#L_ANDXOR_101'><pre>101</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> if (I.getType()->isVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_102' href='#L_ANDXOR_102'><pre>102</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_103' href='#L_ANDXOR_103'><pre>103</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_104' href='#L_ANDXOR_104'><pre>104</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> // Can only do bitwise ops.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_105' href='#L_ANDXOR_105'><pre>105</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>304k</span></div><div class='tooltip'>!I.isBitwiseLogicOp()<span class='tooltip-content'>304k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_106' href='#L_ANDXOR_106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_107' href='#L_ANDXOR_107'><pre>107</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_108' href='#L_ANDXOR_108'><pre>108</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> Value *OldLHS = I.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_109' href='#L_ANDXOR_109'><pre>109</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> Value *OldRHS = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_110' href='#L_ANDXOR_110'><pre>110</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> ConstantInt *ConstLHS = dyn_cast<ConstantInt>(OldLHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_111' href='#L_ANDXOR_111'><pre>111</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> ConstantInt *ConstRHS = dyn_cast<ConstantInt>(OldRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_112' href='#L_ANDXOR_112'><pre>112</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> IntrinsicInst *IntrLHS = dyn_cast<IntrinsicInst>(OldLHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_113' href='#L_ANDXOR_113'><pre>113</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> IntrinsicInst *IntrRHS = dyn_cast<IntrinsicInst>(OldRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_114' href='#L_ANDXOR_114'><pre>114</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> bool IsBswapLHS = (IntrLHS && IntrLHS->getIntrinsicID() == Intrinsic::bswap);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_115' href='#L_ANDXOR_115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool IsBswapRHS = (IntrRHS && <span class='red'>IntrRHS->getIntrinsicID() == Intrinsic::bswap</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_116' href='#L_ANDXOR_116'><pre>116</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_117' href='#L_ANDXOR_117'><pre>117</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> if (<div class='tooltip'>!IsBswapLHS && <span class='tooltip-content'>304k</span></div><div class='tooltip'>!IsBswapRHS<span class='tooltip-content'>304k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_118' href='#L_ANDXOR_118'><pre>118</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_119' href='#L_ANDXOR_119'><pre>119</pre></a></td><td class='covered-line'><pre>304k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_120' href='#L_ANDXOR_120'><pre>120</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15</span></div><div class='tooltip'>!IsBswapLHS && <span class='tooltip-content'>15</span></div><div class='tooltip'><span class='red'>!ConstLHS</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_121' href='#L_ANDXOR_121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_122' href='#L_ANDXOR_122'><pre>122</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_123' href='#L_ANDXOR_123'><pre>123</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15</span></div><div class='tooltip'>!IsBswapRHS && <span class='tooltip-content'>15</span></div><div class='tooltip'>!ConstRHS<span class='tooltip-content'>15</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_124' href='#L_ANDXOR_124'><pre>124</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_125' href='#L_ANDXOR_125'><pre>125</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_126' href='#L_ANDXOR_126'><pre>126</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> /// OP( BSWAP(x), BSWAP(y) ) -> BSWAP( OP(x, y) )</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_127' href='#L_ANDXOR_127'><pre>127</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> /// OP( BSWAP(x), CONSTANT ) -> BSWAP( OP(x, BSWAP(CONSTANT) ) )</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_128' href='#L_ANDXOR_128'><pre>128</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>Value *NewLHS = IsBswapLHS ? <span class='tooltip-content'>2</span></div><div class='tooltip'>IntrLHS->getOperand(0)<span class='tooltip-content'>2</span></div> :</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_129' href='#L_ANDXOR_129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Builder->getInt(ConstLHS->getValue().byteSwap())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_130' href='#L_ANDXOR_130'><pre>130</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_131' href='#L_ANDXOR_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *NewRHS = IsBswapRHS ? <span class='red'>IntrRHS->getOperand(0)</span> :</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_132' href='#L_ANDXOR_132'><pre>132</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Builder->getInt(ConstRHS->getValue().byteSwap());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_133' href='#L_ANDXOR_133'><pre>133</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_134' href='#L_ANDXOR_134'><pre>134</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *BinOp = Builder->CreateBinOp(I.getOpcode(), NewLHS, NewRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_135' href='#L_ANDXOR_135'><pre>135</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Function *F = Intrinsic::getDeclaration(I.getModule(), Intrinsic::bswap, ITy);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_136' href='#L_ANDXOR_136'><pre>136</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Builder->CreateCall(F, BinOp);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_137' href='#L_ANDXOR_137'><pre>137</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_138' href='#L_ANDXOR_138'><pre>138</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_139' href='#L_ANDXOR_139'><pre>139</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This handles expressions of the form ((val OP C1) & C2). Where</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_140' href='#L_ANDXOR_140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the Op parameter is 'OP', OpRHS is 'C1', and AndRHS is 'C2'. Op is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_141' href='#L_ANDXOR_141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// guaranteed to be a binary operator.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_142' href='#L_ANDXOR_142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::OptAndOp(Instruction *Op,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_143' href='#L_ANDXOR_143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *OpRHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_144' href='#L_ANDXOR_144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *AndRHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_145' href='#L_ANDXOR_145'><pre>145</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> BinaryOperator &TheAnd) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_146' href='#L_ANDXOR_146'><pre>146</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> Value *X = Op->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_147' href='#L_ANDXOR_147'><pre>147</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> Constant *Together = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_148' href='#L_ANDXOR_148'><pre>148</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> if (!Op->isShift())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_149' href='#L_ANDXOR_149'><pre>149</pre></a></td><td class='covered-line'><pre>4.71k</pre></td><td class='code'><pre> Together = ConstantExpr::getAnd(AndRHS, OpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_150' href='#L_ANDXOR_150'><pre>150</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_151' href='#L_ANDXOR_151'><pre>151</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> switch (Op->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_152' href='#L_ANDXOR_152'><pre>152</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_153' href='#L_ANDXOR_153'><pre>153</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> if (<div class='tooltip'>Op->hasOneUse()<span class='tooltip-content'>45</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_154' href='#L_ANDXOR_154'><pre>154</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_155' href='#L_ANDXOR_155'><pre>155</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(X, AndRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_156' href='#L_ANDXOR_156'><pre>156</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> And->takeName(Op);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_157' href='#L_ANDXOR_157'><pre>157</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(And, Together);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_158' href='#L_ANDXOR_158'><pre>158</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_159' href='#L_ANDXOR_159'><pre>159</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_160' href='#L_ANDXOR_160'><pre>160</pre></a></td><td class='covered-line'><pre>148</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_161' href='#L_ANDXOR_161'><pre>161</pre></a></td><td class='covered-line'><pre>148</pre></td><td class='code'><pre> if (<div class='tooltip'>Op->hasOneUse()<span class='tooltip-content'>148</span></div>)<div class='tooltip'>{<span class='tooltip-content'>65</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_162' href='#L_ANDXOR_162'><pre>162</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> if (<div class='tooltip'>Together != OpRHS<span class='tooltip-content'>65</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_163' href='#L_ANDXOR_163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X | C1) & C2 --> (X | (C1&C2)) & C2</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_164' href='#L_ANDXOR_164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Or = Builder->CreateOr(X, Together);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_165' href='#L_ANDXOR_165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Or->takeName(Op);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_166' href='#L_ANDXOR_166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(Or, AndRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_167' href='#L_ANDXOR_167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_168' href='#L_ANDXOR_168'><pre>168</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_169' href='#L_ANDXOR_169'><pre>169</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> ConstantInt *TogetherCI = dyn_cast<ConstantInt>(Together);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_170' href='#L_ANDXOR_170'><pre>170</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> if (<div class='tooltip'>TogetherCI && <span class='tooltip-content'>65</span></div><div class='tooltip'>!TogetherCI->isZero()<span class='tooltip-content'>65</span></div>)<div class='tooltip'>{<span class='tooltip-content'>65</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_171' href='#L_ANDXOR_171'><pre>171</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> // (X | C1) & C2 --> (X & (C2^(C1&C2))) | C1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_172' href='#L_ANDXOR_172'><pre>172</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> // NOTE: This reduces the number of bits set in the & mask, which</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_173' href='#L_ANDXOR_173'><pre>173</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> // can expose opportunities for store narrowing.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_174' href='#L_ANDXOR_174'><pre>174</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> Together = ConstantExpr::getXor(AndRHS, Together);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_175' href='#L_ANDXOR_175'><pre>175</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(X, Together);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_176' href='#L_ANDXOR_176'><pre>176</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> And->takeName(Op);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_177' href='#L_ANDXOR_177'><pre>177</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(And, OpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_178' href='#L_ANDXOR_178'><pre>178</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_179' href='#L_ANDXOR_179'><pre>179</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_180' href='#L_ANDXOR_180'><pre>180</pre></a></td><td class='covered-line'><pre>148</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_181' href='#L_ANDXOR_181'><pre>181</pre></a></td><td class='covered-line'><pre>83</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_182' href='#L_ANDXOR_182'><pre>182</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_183' href='#L_ANDXOR_183'><pre>183</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op->hasOneUse()<span class='tooltip-content'>4.39k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.06k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_184' href='#L_ANDXOR_184'><pre>184</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> // Adding a one to a single bit bit-field should be turned into an XOR</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_185' href='#L_ANDXOR_185'><pre>185</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> // of the bit. First thing to check is to see if this AND is with a</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_186' href='#L_ANDXOR_186'><pre>186</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> // single bit constant.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_187' href='#L_ANDXOR_187'><pre>187</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> const APInt &AndRHSV = AndRHS->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_188' href='#L_ANDXOR_188'><pre>188</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_189' href='#L_ANDXOR_189'><pre>189</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> // If there is only one bit set.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_190' href='#L_ANDXOR_190'><pre>190</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> if (<div class='tooltip'>AndRHSV.isPowerOf2()<span class='tooltip-content'>3.06k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_191' href='#L_ANDXOR_191'><pre>191</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Ok, at this point, we know that we are masking the result of the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_192' href='#L_ANDXOR_192'><pre>192</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // ADD down to exactly one bit. If the constant we are adding has</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_193' href='#L_ANDXOR_193'><pre>193</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // no bits set below this bit, then we can eliminate the ADD.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_194' href='#L_ANDXOR_194'><pre>194</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> const APInt& AddRHS = OpRHS->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_195' href='#L_ANDXOR_195'><pre>195</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_196' href='#L_ANDXOR_196'><pre>196</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Check to see if any bits below the one bit set in AndRHSV are set.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_197' href='#L_ANDXOR_197'><pre>197</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>(AddRHS & (AndRHSV-1)) == 0<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_198' href='#L_ANDXOR_198'><pre>198</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // If not, the only thing that can effect the output of the AND is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_199' href='#L_ANDXOR_199'><pre>199</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // the bit specified by AndRHSV. If that bit is set, the effect of</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_200' href='#L_ANDXOR_200'><pre>200</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // the XOR is to toggle the bit. If it is clear, then the ADD has</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_201' href='#L_ANDXOR_201'><pre>201</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // no effect.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_202' href='#L_ANDXOR_202'><pre>202</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>(AddRHS & AndRHSV) == 0<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{ // Bit is not set, noop</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_203' href='#L_ANDXOR_203'><pre>203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TheAnd.setOperand(0, X);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_204' href='#L_ANDXOR_204'><pre>204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &TheAnd;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_205' href='#L_ANDXOR_205'><pre>205</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_206' href='#L_ANDXOR_206'><pre>206</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Pull the XOR out of the AND.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_207' href='#L_ANDXOR_207'><pre>207</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(X, AndRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_208' href='#L_ANDXOR_208'><pre>208</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> NewAnd->takeName(Op);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_209' href='#L_ANDXOR_209'><pre>209</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(NewAnd, AndRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_210' href='#L_ANDXOR_210'><pre>210</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_211' href='#L_ANDXOR_211'><pre>211</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_212' href='#L_ANDXOR_212'><pre>212</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_213' href='#L_ANDXOR_213'><pre>213</pre></a></td><td class='covered-line'><pre>3.06k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_214' href='#L_ANDXOR_214'><pre>214</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_215' href='#L_ANDXOR_215'><pre>215</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_216' href='#L_ANDXOR_216'><pre>216</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> case Instruction::Shl: {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_217' href='#L_ANDXOR_217'><pre>217</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> // We know that the AND will not produce any of the bits shifted in, so if</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_218' href='#L_ANDXOR_218'><pre>218</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> // the anded constant includes them, clear them now!</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_219' href='#L_ANDXOR_219'><pre>219</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_220' href='#L_ANDXOR_220'><pre>220</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> uint32_t BitWidth = AndRHS->getType()->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_221' href='#L_ANDXOR_221'><pre>221</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> uint32_t OpRHSVal = OpRHS->getLimitedValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_222' href='#L_ANDXOR_222'><pre>222</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> APInt ShlMask(APInt::getHighBitsSet(BitWidth, BitWidth-OpRHSVal));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_223' href='#L_ANDXOR_223'><pre>223</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> ConstantInt *CI = Builder->getInt(AndRHS->getValue() & ShlMask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_224' href='#L_ANDXOR_224'><pre>224</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_225' href='#L_ANDXOR_225'><pre>225</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> if (CI->getValue() == ShlMask)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_226' href='#L_ANDXOR_226'><pre>226</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> // Masking out bits that the shift already masks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_227' href='#L_ANDXOR_227'><pre>227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(TheAnd, Op)</span>; // No need for the and.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_228' href='#L_ANDXOR_228'><pre>228</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_229' href='#L_ANDXOR_229'><pre>229</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.66k</span></div><div class='tooltip'>CI != AndRHS<span class='tooltip-content'>2.66k</span></div>) <div class='tooltip'><span class='red'>{ // Reducing bits set in and.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_230' href='#L_ANDXOR_230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TheAnd.setOperand(1, CI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_231' href='#L_ANDXOR_231'><pre>231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &TheAnd;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_232' href='#L_ANDXOR_232'><pre>232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_233' href='#L_ANDXOR_233'><pre>233</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_234' href='#L_ANDXOR_234'><pre>234</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_235' href='#L_ANDXOR_235'><pre>235</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> case Instruction::LShr: {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_236' href='#L_ANDXOR_236'><pre>236</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> // We know that the AND will not produce any of the bits shifted in, so if</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_237' href='#L_ANDXOR_237'><pre>237</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> // the anded constant includes them, clear them now! This only applies to</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_238' href='#L_ANDXOR_238'><pre>238</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> // unsigned shifts, because a signed shr may bring in set bits!</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_239' href='#L_ANDXOR_239'><pre>239</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_240' href='#L_ANDXOR_240'><pre>240</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> uint32_t BitWidth = AndRHS->getType()->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_241' href='#L_ANDXOR_241'><pre>241</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> uint32_t OpRHSVal = OpRHS->getLimitedValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_242' href='#L_ANDXOR_242'><pre>242</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> APInt ShrMask(APInt::getLowBitsSet(BitWidth, BitWidth - OpRHSVal));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_243' href='#L_ANDXOR_243'><pre>243</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> ConstantInt *CI = Builder->getInt(AndRHS->getValue() & ShrMask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_244' href='#L_ANDXOR_244'><pre>244</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_245' href='#L_ANDXOR_245'><pre>245</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> if (CI->getValue() == ShrMask)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_246' href='#L_ANDXOR_246'><pre>246</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> // Masking out bits that the shift already masks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_247' href='#L_ANDXOR_247'><pre>247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(TheAnd, Op)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_248' href='#L_ANDXOR_248'><pre>248</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_249' href='#L_ANDXOR_249'><pre>249</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.85k</span></div><div class='tooltip'>CI != AndRHS<span class='tooltip-content'>5.85k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_250' href='#L_ANDXOR_250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TheAnd.setOperand(1, CI); // Reduce bits set in and cst.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_251' href='#L_ANDXOR_251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &TheAnd;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_252' href='#L_ANDXOR_252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_253' href='#L_ANDXOR_253'><pre>253</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_254' href='#L_ANDXOR_254'><pre>254</pre></a></td><td class='covered-line'><pre>5.85k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_255' href='#L_ANDXOR_255'><pre>255</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_256' href='#L_ANDXOR_256'><pre>256</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> // Signed shr.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_257' href='#L_ANDXOR_257'><pre>257</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> // See if this is shifting in some sign extension, then masking it out</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_258' href='#L_ANDXOR_258'><pre>258</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> // with an and.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_259' href='#L_ANDXOR_259'><pre>259</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> if (<div class='tooltip'>Op->hasOneUse()<span class='tooltip-content'>118</span></div>) <div class='tooltip'>{<span class='tooltip-content'>118</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_260' href='#L_ANDXOR_260'><pre>260</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> uint32_t BitWidth = AndRHS->getType()->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_261' href='#L_ANDXOR_261'><pre>261</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> uint32_t OpRHSVal = OpRHS->getLimitedValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_262' href='#L_ANDXOR_262'><pre>262</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> APInt ShrMask(APInt::getLowBitsSet(BitWidth, BitWidth - OpRHSVal));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_263' href='#L_ANDXOR_263'><pre>263</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> Constant *C = Builder->getInt(AndRHS->getValue() & ShrMask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_264' href='#L_ANDXOR_264'><pre>264</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> if (<div class='tooltip'>C == AndRHS<span class='tooltip-content'>118</span></div>) <div class='tooltip'><span class='red'>{ // Masking out bits shifted in.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_265' href='#L_ANDXOR_265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (Val ashr C1) & C2 -> (Val lshr C1) & C2</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_266' href='#L_ANDXOR_266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Make the argument unsigned.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_267' href='#L_ANDXOR_267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ShVal = Op->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_268' href='#L_ANDXOR_268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShVal = Builder->CreateLShr(ShVal, OpRHS, Op->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_269' href='#L_ANDXOR_269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(ShVal, AndRHS, TheAnd.getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_270' href='#L_ANDXOR_270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_271' href='#L_ANDXOR_271'><pre>271</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_272' href='#L_ANDXOR_272'><pre>272</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_273' href='#L_ANDXOR_273'><pre>273</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_274' href='#L_ANDXOR_274'><pre>274</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_275' href='#L_ANDXOR_275'><pre>275</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_276' href='#L_ANDXOR_276'><pre>276</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_277' href='#L_ANDXOR_277'><pre>277</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Emit a computation of: (V >= Lo && V < Hi) if Inside is true, otherwise</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_278' href='#L_ANDXOR_278'><pre>278</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (V < Lo || V >= Hi). This method expects that Lo <= Hi. IsSigned indicates</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_279' href='#L_ANDXOR_279'><pre>279</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// whether to treat V, Lo, and Hi as signed or not.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_280' href='#L_ANDXOR_280'><pre>280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::insertRangeTest(Value *V, const APInt &Lo, const APInt &Hi,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_281' href='#L_ANDXOR_281'><pre>281</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> bool isSigned, bool Inside) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_282' href='#L_ANDXOR_282'><pre>282</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> assert((isSigned ? Lo.sle(Hi) : Lo.ule(Hi)) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_283' href='#L_ANDXOR_283'><pre>283</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> "Lo is not <= Hi in range emission code!");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_284' href='#L_ANDXOR_284'><pre>284</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_285' href='#L_ANDXOR_285'><pre>285</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> Type *Ty = V->getType();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_286' href='#L_ANDXOR_286'><pre>286</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> if (Lo == Hi)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_287' href='#L_ANDXOR_287'><pre>287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return Inside ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstantInt::getFalse(Ty)</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ConstantInt::getTrue(Ty)</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_288' href='#L_ANDXOR_288'><pre>288</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_289' href='#L_ANDXOR_289'><pre>289</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> // V >= Min && V < Hi --> V < Hi</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_290' href='#L_ANDXOR_290'><pre>290</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> // V < Min || V >= Hi --> V >= Hi</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_291' href='#L_ANDXOR_291'><pre>291</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> <div class='tooltip'>ICmpInst::Predicate Pred = Inside ? <span class='tooltip-content'>270</span></div><div class='tooltip'>ICmpInst::ICMP_ULT<span class='tooltip-content'>270</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_UGE</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_292' href='#L_ANDXOR_292'><pre>292</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> if (<div class='tooltip'>isSigned ? <span class='tooltip-content'>270</span></div><div class='tooltip'>Lo.isMinSignedValue()<span class='tooltip-content'>123</span></div> : <div class='tooltip'>Lo.isMinValue()<span class='tooltip-content'>147</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_293' href='#L_ANDXOR_293'><pre>293</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Pred = isSigned ? <div class='tooltip'><span class='red'>ICmpInst::getSignedPredicate(Pred)</span><span class='tooltip-content'>0</span></div> : <div class='tooltip'>Pred<span class='tooltip-content'>2</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_294' href='#L_ANDXOR_294'><pre>294</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Builder->CreateICmp(Pred, V, ConstantInt::get(Ty, Hi));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_295' href='#L_ANDXOR_295'><pre>295</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_296' href='#L_ANDXOR_296'><pre>296</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_297' href='#L_ANDXOR_297'><pre>297</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> // V >= Lo && V < Hi --> V - Lo u< Hi - Lo</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_298' href='#L_ANDXOR_298'><pre>298</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre> // V < Lo || V >= Hi --> V - Lo u>= Hi - Lo</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_299' href='#L_ANDXOR_299'><pre>299</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> Value *VMinusLo =</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_300' href='#L_ANDXOR_300'><pre>300</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> Builder->CreateSub(V, ConstantInt::get(Ty, Lo), V->getName() + ".off");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_301' href='#L_ANDXOR_301'><pre>301</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> Constant *HiMinusLo = ConstantInt::get(Ty, Hi - Lo);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_302' href='#L_ANDXOR_302'><pre>302</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> return Builder->CreateICmp(Pred, VMinusLo, HiMinusLo);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_303' href='#L_ANDXOR_303'><pre>303</pre></a></td><td class='covered-line'><pre>270</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_304' href='#L_ANDXOR_304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_305' href='#L_ANDXOR_305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Returns true iff Val consists of one contiguous run of 1s with any number</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_306' href='#L_ANDXOR_306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// of 0s on either side. The 1s are allowed to wrap from LSB to MSB,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_307' href='#L_ANDXOR_307'><pre>307</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. 0x0F0F0000 is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_308' href='#L_ANDXOR_308'><pre>308</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// not, since all 1s are not contiguous.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_309' href='#L_ANDXOR_309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isRunOfOnes(ConstantInt *Val, uint32_t &MB, uint32_t &ME) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_310' href='#L_ANDXOR_310'><pre>310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt& V = Val->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_311' href='#L_ANDXOR_311'><pre>311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint32_t BitWidth = Val->getType()->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_312' href='#L_ANDXOR_312'><pre>312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!APIntOps::isShiftedMask(BitWidth, V)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_313' href='#L_ANDXOR_313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_314' href='#L_ANDXOR_314'><pre>314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // look for the first zero bit after the run of ones</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_315' href='#L_ANDXOR_315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>MB = BitWidth - ((V - 1) ^ V).countLeadingZeros();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_316' href='#L_ANDXOR_316'><pre>316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // look for the first non-zero bit</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_317' href='#L_ANDXOR_317'><pre>317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ME = V.getActiveBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_318' href='#L_ANDXOR_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_319' href='#L_ANDXOR_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_320' href='#L_ANDXOR_320'><pre>320</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_321' href='#L_ANDXOR_321'><pre>321</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is part of an expression (LHS +/- RHS) & Mask, where isSub determines</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_322' href='#L_ANDXOR_322'><pre>322</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// whether the operator is a sub. If we can fold one of the following xforms:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_323' href='#L_ANDXOR_323'><pre>323</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_324' href='#L_ANDXOR_324'><pre>324</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ((A & N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == Mask</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_325' href='#L_ANDXOR_325'><pre>325</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ((A | N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_326' href='#L_ANDXOR_326'><pre>326</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ((A ^ N) +/- B) & Mask -> (A +/- B) & Mask iff N&Mask == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_327' href='#L_ANDXOR_327'><pre>327</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_328' href='#L_ANDXOR_328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// return (A +/- B).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_329' href='#L_ANDXOR_329'><pre>329</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_330' href='#L_ANDXOR_330'><pre>330</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_331' href='#L_ANDXOR_331'><pre>331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *Mask, bool isSub,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_332' href='#L_ANDXOR_332'><pre>332</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> Instruction &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_333' href='#L_ANDXOR_333'><pre>333</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> Instruction *LHSI = dyn_cast<Instruction>(LHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_334' href='#L_ANDXOR_334'><pre>334</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHSI || <span class='tooltip-content'>14.4k</span></div><div class='tooltip'>LHSI->getNumOperands() != 2<span class='tooltip-content'>8.78k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_335' href='#L_ANDXOR_335'><pre>335</pre></a></td><td class='covered-line'><pre>12.4k</pre></td><td class='code'><pre> <div class='tooltip'>!isa<ConstantInt>(LHSI->getOperand(1))<span class='tooltip-content'>5.45k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>12.4k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_336' href='#L_ANDXOR_336'><pre>336</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_337' href='#L_ANDXOR_337'><pre>337</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre> ConstantInt *N = cast<ConstantInt>(LHSI->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_338' href='#L_ANDXOR_338'><pre>338</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_339' href='#L_ANDXOR_339'><pre>339</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre> switch (LHSI->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_340' href='#L_ANDXOR_340'><pre>340</pre></a></td><td class='covered-line'><pre>1.96k</pre></td><td class='code'><pre> default: return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_341' href='#L_ANDXOR_341'><pre>341</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_342' href='#L_ANDXOR_342'><pre>342</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> if (<div class='tooltip'>ConstantExpr::getAnd(N, Mask) == Mask<span class='tooltip-content'>18</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_343' href='#L_ANDXOR_343'><pre>343</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // If the AndRHS is a power of two minus one (0+1+), this is simple.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_344' href='#L_ANDXOR_344'><pre>344</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if ((Mask->getValue().countLeadingZeros() +</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_345' href='#L_ANDXOR_345'><pre>345</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Mask->getValue().countPopulation()) ==</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_346' href='#L_ANDXOR_346'><pre>346</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Mask->getValue().getBitWidth())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_347' href='#L_ANDXOR_347'><pre>347</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_348' href='#L_ANDXOR_348'><pre>348</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_349' href='#L_ANDXOR_349'><pre>349</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Otherwise, if Mask is 0+1+0+, and if B is known to have the low 0+</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_350' href='#L_ANDXOR_350'><pre>350</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // part, we don't need any explicit masks to take them out of A. If that</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_351' href='#L_ANDXOR_351'><pre>351</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // is all N is, ignore it.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_352' href='#L_ANDXOR_352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>uint32_t MB = 0, ME = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_353' href='#L_ANDXOR_353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isRunOfOnes(Mask, MB, ME)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // begin/end bit of run, inclusive</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_354' href='#L_ANDXOR_354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint32_t BitWidth = cast<IntegerType>(RHS->getType())->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_355' href='#L_ANDXOR_355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Mask(APInt::getLowBitsSet(BitWidth, MB-1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_356' href='#L_ANDXOR_356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaskedValueIsZero(RHS, Mask, 0, &I)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_357' href='#L_ANDXOR_357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_358' href='#L_ANDXOR_358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_359' href='#L_ANDXOR_359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_360' href='#L_ANDXOR_360'><pre>360</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_361' href='#L_ANDXOR_361'><pre>361</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_362' href='#L_ANDXOR_362'><pre>362</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_363' href='#L_ANDXOR_363'><pre>363</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // If the AndRHS is a power of two minus one (0+1+), and N&Mask == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_364' href='#L_ANDXOR_364'><pre>364</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if ((Mask->getValue().countLeadingZeros() +</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_365' href='#L_ANDXOR_365'><pre>365</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Mask->getValue().countPopulation()) == Mask->getValue().getBitWidth()</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_366' href='#L_ANDXOR_366'><pre>366</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> && ConstantExpr::getAnd(N, Mask)->isNullValue())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_367' href='#L_ANDXOR_367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_368' href='#L_ANDXOR_368'><pre>368</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_369' href='#L_ANDXOR_369'><pre>369</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_370' href='#L_ANDXOR_370'><pre>370</pre></a></td><td class='covered-line'><pre>2.00k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_371' href='#L_ANDXOR_371'><pre>371</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>isSub<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_372' href='#L_ANDXOR_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->CreateSub(LHSI->getOperand(0), RHS, "fold")</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_373' href='#L_ANDXOR_373'><pre>373</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Builder->CreateAdd(LHSI->getOperand(0), RHS, "fold");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_374' href='#L_ANDXOR_374'><pre>374</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_375' href='#L_ANDXOR_375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_376' href='#L_ANDXOR_376'><pre>376</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// enum for classifying (icmp eq (A & B), C) and (icmp ne (A & B), C)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_377' href='#L_ANDXOR_377'><pre>377</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// One of A and B is considered the mask, the other the value. This is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_378' href='#L_ANDXOR_378'><pre>378</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// described as the "AMask" or "BMask" part of the enum. If the enum</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_379' href='#L_ANDXOR_379'><pre>379</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// contains only "Mask", then both A and B can be considered masks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_380' href='#L_ANDXOR_380'><pre>380</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If A is the mask, then it was proven, that (A & C) == C. This</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_381' href='#L_ANDXOR_381'><pre>381</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// is trivial if C == A, or C == 0. If both A and C are constants, this</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_382' href='#L_ANDXOR_382'><pre>382</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// proof is also easy.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_383' href='#L_ANDXOR_383'><pre>383</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For the following explanations we assume that A is the mask.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_384' href='#L_ANDXOR_384'><pre>384</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The part "AllOnes" declares, that the comparison is true only</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_385' href='#L_ANDXOR_385'><pre>385</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if (A & B) == A, or all bits of A are set in B.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_386' href='#L_ANDXOR_386'><pre>386</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example: (icmp eq (A & 3), 3) -> FoldMskICmp_AMask_AllOnes</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_387' href='#L_ANDXOR_387'><pre>387</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The part "AllZeroes" declares, that the comparison is true only</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_388' href='#L_ANDXOR_388'><pre>388</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if (A & B) == 0, or all bits of A are cleared in B.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_389' href='#L_ANDXOR_389'><pre>389</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example: (icmp eq (A & 3), 0) -> FoldMskICmp_Mask_AllZeroes</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_390' href='#L_ANDXOR_390'><pre>390</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The part "Mixed" declares, that (A & B) == C and C might or might not</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_391' href='#L_ANDXOR_391'><pre>391</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// contain any number of one bits and zero bits.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_392' href='#L_ANDXOR_392'><pre>392</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example: (icmp eq (A & 3), 1) -> FoldMskICmp_AMask_Mixed</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_393' href='#L_ANDXOR_393'><pre>393</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The Part "Not" means, that in above descriptions "==" should be replaced</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_394' href='#L_ANDXOR_394'><pre>394</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// by "!=".</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_395' href='#L_ANDXOR_395'><pre>395</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example: (icmp ne (A & 3), 3) -> FoldMskICmp_AMask_NotAllOnes</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_396' href='#L_ANDXOR_396'><pre>396</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If the mask A contains a single bit, then the following is equivalent:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_397' href='#L_ANDXOR_397'><pre>397</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp eq (A & B), A) equals (icmp ne (A & B), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_398' href='#L_ANDXOR_398'><pre>398</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp ne (A & B), A) equals (icmp eq (A & B), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_399' href='#L_ANDXOR_399'><pre>399</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>enum MaskedICmpType {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_400' href='#L_ANDXOR_400'><pre>400</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_AMask_AllOnes = 1,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_401' href='#L_ANDXOR_401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_AMask_NotAllOnes = 2,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_402' href='#L_ANDXOR_402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_BMask_AllOnes = 4,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_403' href='#L_ANDXOR_403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_BMask_NotAllOnes = 8,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_404' href='#L_ANDXOR_404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_Mask_AllZeroes = 16,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_405' href='#L_ANDXOR_405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_Mask_NotAllZeroes = 32,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_406' href='#L_ANDXOR_406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_AMask_Mixed = 64,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_407' href='#L_ANDXOR_407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_AMask_NotMixed = 128,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_408' href='#L_ANDXOR_408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_BMask_Mixed = 256,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_409' href='#L_ANDXOR_409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldMskICmp_BMask_NotMixed = 512</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_410' href='#L_ANDXOR_410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_411' href='#L_ANDXOR_411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_412' href='#L_ANDXOR_412'><pre>412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return the set of pattern classes (from MaskedICmpType)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_413' href='#L_ANDXOR_413'><pre>413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that (icmp SCC (A & B), C) satisfies.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_414' href='#L_ANDXOR_414'><pre>414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static unsigned getTypeOfMaskedICmp(Value* A, Value* B, Value* C,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_415' href='#L_ANDXOR_415'><pre>415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ICmpInst::Predicate SCC)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_416' href='#L_ANDXOR_416'><pre>416</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre>{</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_417' href='#L_ANDXOR_417'><pre>417</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> ConstantInt *ACst = dyn_cast<ConstantInt>(A);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_418' href='#L_ANDXOR_418'><pre>418</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> ConstantInt *BCst = dyn_cast<ConstantInt>(B);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_419' href='#L_ANDXOR_419'><pre>419</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> ConstantInt *CCst = dyn_cast<ConstantInt>(C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_420' href='#L_ANDXOR_420'><pre>420</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> bool icmp_eq = (SCC == ICmpInst::ICMP_EQ);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_421' href='#L_ANDXOR_421'><pre>421</pre></a></td><td class='covered-line'><pre>26.2k</pre></td><td class='code'><pre> bool icmp_abit = (ACst && !ACst->isZero() &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_422' href='#L_ANDXOR_422'><pre>422</pre></a></td><td class='covered-line'><pre>25.7k</pre></td><td class='code'><pre> ACst->getValue().isPowerOf2());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_423' href='#L_ANDXOR_423'><pre>423</pre></a></td><td class='covered-line'><pre>5.76k</pre></td><td class='code'><pre> bool icmp_bbit = (BCst && !BCst->isZero() &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_424' href='#L_ANDXOR_424'><pre>424</pre></a></td><td class='covered-line'><pre>5.45k</pre></td><td class='code'><pre> BCst->getValue().isPowerOf2());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_425' href='#L_ANDXOR_425'><pre>425</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> unsigned result = 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_426' href='#L_ANDXOR_426'><pre>426</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>CCst && <span class='tooltip-content'>31.0k</span></div><div class='tooltip'>CCst->isZero()<span class='tooltip-content'>21.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_427' href='#L_ANDXOR_427'><pre>427</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> // if C is zero, then both A and B qualify as mask</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_428' href='#L_ANDXOR_428'><pre>428</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> result |= (icmp_eq ? (FoldMskICmp_Mask_AllZeroes |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_429' href='#L_ANDXOR_429'><pre>429</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> FoldMskICmp_AMask_Mixed |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_430' href='#L_ANDXOR_430'><pre>430</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> FoldMskICmp_BMask_Mixed)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_431' href='#L_ANDXOR_431'><pre>431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>(FoldMskICmp_Mask_NotAllZeroes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_432' href='#L_ANDXOR_432'><pre>432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_AMask_NotMixed |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_433' href='#L_ANDXOR_433'><pre>433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_BMask_NotMixed)</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_434' href='#L_ANDXOR_434'><pre>434</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> if (icmp_abit)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_435' href='#L_ANDXOR_435'><pre>435</pre></a></td><td class='covered-line'><pre>256</pre></td><td class='code'><pre> <div class='tooltip'>result |= (icmp_eq ? <span class='tooltip-content'>256</span></div><div class='tooltip'>(FoldMskICmp_AMask_NotAllOnes |<span class='tooltip-content'>256</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_436' href='#L_ANDXOR_436'><pre>436</pre></a></td><td class='covered-line'><pre>256</pre></td><td class='code'><pre> FoldMskICmp_AMask_NotMixed)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_437' href='#L_ANDXOR_437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>(FoldMskICmp_AMask_AllOnes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_438' href='#L_ANDXOR_438'><pre>438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_AMask_Mixed)</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_439' href='#L_ANDXOR_439'><pre>439</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> if (icmp_bbit)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_440' href='#L_ANDXOR_440'><pre>440</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> <div class='tooltip'>result |= (icmp_eq ? <span class='tooltip-content'>234</span></div><div class='tooltip'>(FoldMskICmp_BMask_NotAllOnes |<span class='tooltip-content'>234</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_441' href='#L_ANDXOR_441'><pre>441</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> FoldMskICmp_BMask_NotMixed)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_442' href='#L_ANDXOR_442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>(FoldMskICmp_BMask_AllOnes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_443' href='#L_ANDXOR_443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_BMask_Mixed)</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_444' href='#L_ANDXOR_444'><pre>444</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> return result;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_445' href='#L_ANDXOR_445'><pre>445</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_446' href='#L_ANDXOR_446'><pre>446</pre></a></td><td class='covered-line'><pre>18.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>18.5k</span></div><div class='tooltip'>A == C<span class='tooltip-content'>18.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.26k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_447' href='#L_ANDXOR_447'><pre>447</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> result |= (icmp_eq ? (FoldMskICmp_AMask_AllOnes |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_448' href='#L_ANDXOR_448'><pre>448</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> FoldMskICmp_AMask_Mixed)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_449' href='#L_ANDXOR_449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>(FoldMskICmp_AMask_NotAllOnes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_450' href='#L_ANDXOR_450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_AMask_NotMixed)</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_451' href='#L_ANDXOR_451'><pre>451</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> if (icmp_abit)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_452' href='#L_ANDXOR_452'><pre>452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>result |= (icmp_eq ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(FoldMskICmp_Mask_NotAllZeroes |</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_453' href='#L_ANDXOR_453'><pre>453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_AMask_NotMixed)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_454' href='#L_ANDXOR_454'><pre>454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>(FoldMskICmp_Mask_AllZeroes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_455' href='#L_ANDXOR_455'><pre>455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_AMask_Mixed)</span><span class='red'>)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_456' href='#L_ANDXOR_456'><pre>456</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>17.2k</span></div><div class='tooltip'>ACst && <span class='tooltip-content'>17.2k</span></div><div class='tooltip'>CCst<span class='tooltip-content'>13.5k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_457' href='#L_ANDXOR_457'><pre>457</pre></a></td><td class='covered-line'><pre>5.50k</pre></td><td class='code'><pre> <div class='tooltip'>ConstantExpr::getAnd(ACst, CCst) == CCst<span class='tooltip-content'>5.50k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.50k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_458' href='#L_ANDXOR_458'><pre>458</pre></a></td><td class='covered-line'><pre>5.50k</pre></td><td class='code'><pre> result |= (icmp_eq ? FoldMskICmp_AMask_Mixed</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_459' href='#L_ANDXOR_459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>FoldMskICmp_AMask_NotMixed</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_460' href='#L_ANDXOR_460'><pre>460</pre></a></td><td class='covered-line'><pre>5.50k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_461' href='#L_ANDXOR_461'><pre>461</pre></a></td><td class='covered-line'><pre>18.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>B == C<span class='tooltip-content'>18.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>196</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_462' href='#L_ANDXOR_462'><pre>462</pre></a></td><td class='covered-line'><pre>196</pre></td><td class='code'><pre> result |= (icmp_eq ? (FoldMskICmp_BMask_AllOnes |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_463' href='#L_ANDXOR_463'><pre>463</pre></a></td><td class='covered-line'><pre>196</pre></td><td class='code'><pre> FoldMskICmp_BMask_Mixed)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_464' href='#L_ANDXOR_464'><pre>464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>(FoldMskICmp_BMask_NotAllOnes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_465' href='#L_ANDXOR_465'><pre>465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_BMask_NotMixed)</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_466' href='#L_ANDXOR_466'><pre>466</pre></a></td><td class='covered-line'><pre>196</pre></td><td class='code'><pre> if (icmp_bbit)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_467' href='#L_ANDXOR_467'><pre>467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>result |= (icmp_eq ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(FoldMskICmp_Mask_NotAllZeroes |</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_468' href='#L_ANDXOR_468'><pre>468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_BMask_NotMixed)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_469' href='#L_ANDXOR_469'><pre>469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>(FoldMskICmp_Mask_AllZeroes |</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_470' href='#L_ANDXOR_470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldMskICmp_BMask_Mixed)</span><span class='red'>)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_471' href='#L_ANDXOR_471'><pre>471</pre></a></td><td class='covered-line'><pre>18.3k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>18.3k</span></div><div class='tooltip'>BCst && <span class='tooltip-content'>18.3k</span></div><div class='tooltip'>CCst<span class='tooltip-content'>4.57k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_472' href='#L_ANDXOR_472'><pre>472</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> <div class='tooltip'>ConstantExpr::getAnd(BCst, CCst) == CCst<span class='tooltip-content'>1.60k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.60k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_473' href='#L_ANDXOR_473'><pre>473</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> result |= (icmp_eq ? FoldMskICmp_BMask_Mixed</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_474' href='#L_ANDXOR_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>FoldMskICmp_BMask_NotMixed</span>);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_475' href='#L_ANDXOR_475'><pre>475</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_476' href='#L_ANDXOR_476'><pre>476</pre></a></td><td class='covered-line'><pre>18.5k</pre></td><td class='code'><pre> return result;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_477' href='#L_ANDXOR_477'><pre>477</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_478' href='#L_ANDXOR_478'><pre>478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_479' href='#L_ANDXOR_479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Convert an analysis of a masked ICmp into its equivalent if all boolean</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_480' href='#L_ANDXOR_480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operations had the opposite sense. Since each "NotXXX" flag (recording !=)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_481' href='#L_ANDXOR_481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// is adjacent to the corresponding normal flag (recording ==), this just</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_482' href='#L_ANDXOR_482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// involves swapping those bits over.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_483' href='#L_ANDXOR_483'><pre>483</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre>static unsigned conjugateICmpMask(unsigned Mask) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_484' href='#L_ANDXOR_484'><pre>484</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> unsigned NewMask;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_485' href='#L_ANDXOR_485'><pre>485</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> NewMask = (Mask & (FoldMskICmp_AMask_AllOnes | FoldMskICmp_BMask_AllOnes |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_486' href='#L_ANDXOR_486'><pre>486</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> FoldMskICmp_Mask_AllZeroes | FoldMskICmp_AMask_Mixed |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_487' href='#L_ANDXOR_487'><pre>487</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> FoldMskICmp_BMask_Mixed))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_488' href='#L_ANDXOR_488'><pre>488</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> << 1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_489' href='#L_ANDXOR_489'><pre>489</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_490' href='#L_ANDXOR_490'><pre>490</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> NewMask |=</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_491' href='#L_ANDXOR_491'><pre>491</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> (Mask & (FoldMskICmp_AMask_NotAllOnes | FoldMskICmp_BMask_NotAllOnes |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_492' href='#L_ANDXOR_492'><pre>492</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> FoldMskICmp_Mask_NotAllZeroes | FoldMskICmp_AMask_NotMixed |</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_493' href='#L_ANDXOR_493'><pre>493</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> FoldMskICmp_BMask_NotMixed))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_494' href='#L_ANDXOR_494'><pre>494</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> >> 1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_495' href='#L_ANDXOR_495'><pre>495</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_496' href='#L_ANDXOR_496'><pre>496</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> return NewMask;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_497' href='#L_ANDXOR_497'><pre>497</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_498' href='#L_ANDXOR_498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_499' href='#L_ANDXOR_499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Handle (icmp(A & B) ==/!= C) &/| (icmp(A & D) ==/!= E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_500' href='#L_ANDXOR_500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return the set of pattern classes (from MaskedICmpType)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_501' href='#L_ANDXOR_501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that both LHS and RHS satisfy.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_502' href='#L_ANDXOR_502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static unsigned foldLogOpOfMaskedICmpsHelper(Value*& A,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_503' href='#L_ANDXOR_503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value*& B, Value*& C,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_504' href='#L_ANDXOR_504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value*& D, Value*& E,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_505' href='#L_ANDXOR_505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ICmpInst *LHS, ICmpInst *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_506' href='#L_ANDXOR_506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ICmpInst::Predicate &LHSCC,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_507' href='#L_ANDXOR_507'><pre>507</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> ICmpInst::Predicate &RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_508' href='#L_ANDXOR_508'><pre>508</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType()<span class='tooltip-content'>58.1k</span></div>) <div class='tooltip'>return 0<span class='tooltip-content'>19.8k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_509' href='#L_ANDXOR_509'><pre>509</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> // vectors are not (yet?) supported</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_510' href='#L_ANDXOR_510'><pre>510</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>38.2k</span></div><div class='tooltip'>LHS->getOperand(0)->getType()->isVectorTy()<span class='tooltip-content'>38.2k</span></div>) <div class='tooltip'><span class='red'>return 0</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_511' href='#L_ANDXOR_511'><pre>511</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_512' href='#L_ANDXOR_512'><pre>512</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // Here comes the tricky part:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_513' href='#L_ANDXOR_513'><pre>513</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // LHS might be of the form L11 & L12 == X, X == L21 & L22,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_514' href='#L_ANDXOR_514'><pre>514</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // and L11 & L12 == L21 & L22. The same goes for RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_515' href='#L_ANDXOR_515'><pre>515</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // Now we must find those components L** and R**, that are equal, so</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_516' href='#L_ANDXOR_516'><pre>516</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // that we can extract the parameters A, B, C, D, and E for the canonical</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_517' href='#L_ANDXOR_517'><pre>517</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // above.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_518' href='#L_ANDXOR_518'><pre>518</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> Value *L1 = LHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_519' href='#L_ANDXOR_519'><pre>519</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> Value *L2 = LHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_520' href='#L_ANDXOR_520'><pre>520</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> Value *L11,*L12,*L21,*L22;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_521' href='#L_ANDXOR_521'><pre>521</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // Check whether the icmp can be decomposed into a bit test.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_522' href='#L_ANDXOR_522'><pre>522</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>decomposeBitTestICmp(LHS, LHSCC, L11, L12, L2)<span class='tooltip-content'>38.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_523' href='#L_ANDXOR_523'><pre>523</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> L21 = L22 = L1 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_524' href='#L_ANDXOR_524'><pre>524</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_525' href='#L_ANDXOR_525'><pre>525</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre> // Look for ANDs in the LHS icmp.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_526' href='#L_ANDXOR_526'><pre>526</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!L1->getType()->isIntegerTy()<span class='tooltip-content'>36.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.65k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_527' href='#L_ANDXOR_527'><pre>527</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // You can icmp pointers, for example. They really aren't masks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_528' href='#L_ANDXOR_528'><pre>528</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> L11 = L12 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_529' href='#L_ANDXOR_529'><pre>529</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>26.4k</span></div><div class='tooltip'>!match(L1, m_And(m_Value(L11), m_Value(L12)))<span class='tooltip-content'>26.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>25.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_530' href='#L_ANDXOR_530'><pre>530</pre></a></td><td class='covered-line'><pre>25.5k</pre></td><td class='code'><pre> // Any icmp can be viewed as being trivially masked; if it allows us to</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_531' href='#L_ANDXOR_531'><pre>531</pre></a></td><td class='covered-line'><pre>25.5k</pre></td><td class='code'><pre> // remove one, it's worth it.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_532' href='#L_ANDXOR_532'><pre>532</pre></a></td><td class='covered-line'><pre>25.5k</pre></td><td class='code'><pre> L11 = L1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_533' href='#L_ANDXOR_533'><pre>533</pre></a></td><td class='covered-line'><pre>25.5k</pre></td><td class='code'><pre> L12 = Constant::getAllOnesValue(L1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_534' href='#L_ANDXOR_534'><pre>534</pre></a></td><td class='covered-line'><pre>25.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_535' href='#L_ANDXOR_535'><pre>535</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_536' href='#L_ANDXOR_536'><pre>536</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!L2->getType()->isIntegerTy()<span class='tooltip-content'>36.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.65k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_537' href='#L_ANDXOR_537'><pre>537</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // You can icmp pointers, for example. They really aren't masks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_538' href='#L_ANDXOR_538'><pre>538</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> L21 = L22 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_539' href='#L_ANDXOR_539'><pre>539</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>26.4k</span></div><div class='tooltip'>!match(L2, m_And(m_Value(L21), m_Value(L22)))<span class='tooltip-content'>26.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>26.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_540' href='#L_ANDXOR_540'><pre>540</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> L21 = L2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_541' href='#L_ANDXOR_541'><pre>541</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> L22 = Constant::getAllOnesValue(L2->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_542' href='#L_ANDXOR_542'><pre>542</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_543' href='#L_ANDXOR_543'><pre>543</pre></a></td><td class='covered-line'><pre>36.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_544' href='#L_ANDXOR_544'><pre>544</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_545' href='#L_ANDXOR_545'><pre>545</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> // Bail if LHS was a icmp that can't be decomposed into an equality.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_546' href='#L_ANDXOR_546'><pre>546</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> if (!ICmpInst::isEquality(LHSCC))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_547' href='#L_ANDXOR_547'><pre>547</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_548' href='#L_ANDXOR_548'><pre>548</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_549' href='#L_ANDXOR_549'><pre>549</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> Value *R1 = RHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_550' href='#L_ANDXOR_550'><pre>550</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> Value *R2 = RHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_551' href='#L_ANDXOR_551'><pre>551</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> Value *R11,*R12;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_552' href='#L_ANDXOR_552'><pre>552</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> bool ok = false;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_553' href='#L_ANDXOR_553'><pre>553</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>decomposeBitTestICmp(RHS, RHSCC, R11, R12, R2)<span class='tooltip-content'>26.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>386</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_554' href='#L_ANDXOR_554'><pre>554</pre></a></td><td class='covered-line'><pre>386</pre></td><td class='code'><pre> if (<div class='tooltip'>R11 == L11 || <span class='tooltip-content'>386</span></div><div class='tooltip'>R11 == L12<span class='tooltip-content'>330</span></div> || <div class='tooltip'>R11 == L21<span class='tooltip-content'>325</span></div> || <div class='tooltip'>R11 == L22<span class='tooltip-content'>325</span></div>) <div class='tooltip'>{<span class='tooltip-content'>61</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_555' href='#L_ANDXOR_555'><pre>555</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> A = R11; D = R12;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_556' href='#L_ANDXOR_556'><pre>556</pre></a></td><td class='covered-line'><pre>325</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>325</span></div><div class='tooltip'>R12 == L11 || <span class='tooltip-content'>325</span></div><div class='tooltip'>R12 == L12<span class='tooltip-content'>325</span></div> || <div class='tooltip'>R12 == L21<span class='tooltip-content'>262</span></div> || <div class='tooltip'>R12 == L22<span class='tooltip-content'>262</span></div>) <div class='tooltip'>{<span class='tooltip-content'>63</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_557' href='#L_ANDXOR_557'><pre>557</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> A = R12; D = R11;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_558' href='#L_ANDXOR_558'><pre>558</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_559' href='#L_ANDXOR_559'><pre>559</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_560' href='#L_ANDXOR_560'><pre>560</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_561' href='#L_ANDXOR_561'><pre>561</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> E = R2; R1 = nullptr; ok = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_562' href='#L_ANDXOR_562'><pre>562</pre></a></td><td class='covered-line'><pre>26.5k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>26.5k</span></div><div class='tooltip'>R1->getType()->isIntegerTy()<span class='tooltip-content'>26.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_563' href='#L_ANDXOR_563'><pre>563</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>!match(R1, m_And(m_Value(R11), m_Value(R12)))<span class='tooltip-content'>19.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_564' href='#L_ANDXOR_564'><pre>564</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // As before, model no mask as a trivial mask if it'll let us do an</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_565' href='#L_ANDXOR_565'><pre>565</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // optimization.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_566' href='#L_ANDXOR_566'><pre>566</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> R11 = R1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_567' href='#L_ANDXOR_567'><pre>567</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> R12 = Constant::getAllOnesValue(R1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_568' href='#L_ANDXOR_568'><pre>568</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_569' href='#L_ANDXOR_569'><pre>569</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_570' href='#L_ANDXOR_570'><pre>570</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>R11 == L11 || <span class='tooltip-content'>19.6k</span></div><div class='tooltip'>R11 == L12<span class='tooltip-content'>16.8k</span></div> || <div class='tooltip'>R11 == L21<span class='tooltip-content'>16.8k</span></div> || <div class='tooltip'>R11 == L22<span class='tooltip-content'>16.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.93k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_571' href='#L_ANDXOR_571'><pre>571</pre></a></td><td class='covered-line'><pre>2.93k</pre></td><td class='code'><pre> A = R11; D = R12; E = R2; ok = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_572' href='#L_ANDXOR_572'><pre>572</pre></a></td><td class='covered-line'><pre>16.6k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>16.6k</span></div><div class='tooltip'>R12 == L11 || <span class='tooltip-content'>16.6k</span></div><div class='tooltip'>R12 == L12<span class='tooltip-content'>16.6k</span></div> || <div class='tooltip'>R12 == L21<span class='tooltip-content'>2.37k</span></div> || <div class='tooltip'>R12 == L22<span class='tooltip-content'>2.37k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>14.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_573' href='#L_ANDXOR_573'><pre>573</pre></a></td><td class='covered-line'><pre>14.6k</pre></td><td class='code'><pre> A = R12; D = R11; E = R2; ok = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_574' href='#L_ANDXOR_574'><pre>574</pre></a></td><td class='covered-line'><pre>14.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_575' href='#L_ANDXOR_575'><pre>575</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_576' href='#L_ANDXOR_576'><pre>576</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_577' href='#L_ANDXOR_577'><pre>577</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> // Bail if RHS was a icmp that can't be decomposed into an equality.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_578' href='#L_ANDXOR_578'><pre>578</pre></a></td><td class='covered-line'><pre>26.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>26.7k</span></div><div class='tooltip'>!ICmpInst::isEquality(RHSCC)<span class='tooltip-content'>26.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_579' href='#L_ANDXOR_579'><pre>579</pre></a></td><td class='covered-line'><pre>3.85k</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_580' href='#L_ANDXOR_580'><pre>580</pre></a></td><td class='covered-line'><pre>26.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_581' href='#L_ANDXOR_581'><pre>581</pre></a></td><td class='covered-line'><pre>26.7k</pre></td><td class='code'><pre> // Look for ANDs on the right side of the RHS icmp.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_582' href='#L_ANDXOR_582'><pre>582</pre></a></td><td class='covered-line'><pre>22.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>22.8k</span></div><div class='tooltip'>!ok && <span class='tooltip-content'>22.8k</span></div><div class='tooltip'>R2->getType()->isIntegerTy()<span class='tooltip-content'>7.75k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>784</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_583' href='#L_ANDXOR_583'><pre>583</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> if (<div class='tooltip'>!match(R2, m_And(m_Value(R11), m_Value(R12)))<span class='tooltip-content'>784</span></div>) <div class='tooltip'>{<span class='tooltip-content'>784</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_584' href='#L_ANDXOR_584'><pre>584</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> R11 = R2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_585' href='#L_ANDXOR_585'><pre>585</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> R12 = Constant::getAllOnesValue(R2->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_586' href='#L_ANDXOR_586'><pre>586</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_587' href='#L_ANDXOR_587'><pre>587</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_588' href='#L_ANDXOR_588'><pre>588</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> if (<div class='tooltip'>R11 == L11 || <span class='tooltip-content'>784</span></div><div class='tooltip'>R11 == L12<span class='tooltip-content'>776</span></div> || <div class='tooltip'>R11 == L21<span class='tooltip-content'>776</span></div> || <div class='tooltip'>R11 == L22<span class='tooltip-content'>519</span></div>) <div class='tooltip'>{<span class='tooltip-content'>265</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_589' href='#L_ANDXOR_589'><pre>589</pre></a></td><td class='covered-line'><pre>265</pre></td><td class='code'><pre> A = R11; D = R12; E = R1; ok = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_590' href='#L_ANDXOR_590'><pre>590</pre></a></td><td class='covered-line'><pre>519</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>519</span></div><div class='tooltip'>R12 == L11 || <span class='tooltip-content'>519</span></div><div class='tooltip'>R12 == L12<span class='tooltip-content'>519</span></div> || <div class='tooltip'>R12 == L21<span class='tooltip-content'>344</span></div> || <div class='tooltip'>R12 == L22<span class='tooltip-content'>344</span></div>) <div class='tooltip'>{<span class='tooltip-content'>175</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_591' href='#L_ANDXOR_591'><pre>591</pre></a></td><td class='covered-line'><pre>175</pre></td><td class='code'><pre> A = R12; D = R11; E = R1; ok = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_592' href='#L_ANDXOR_592'><pre>592</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_593' href='#L_ANDXOR_593'><pre>593</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_594' href='#L_ANDXOR_594'><pre>594</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_595' href='#L_ANDXOR_595'><pre>595</pre></a></td><td class='covered-line'><pre>784</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_596' href='#L_ANDXOR_596'><pre>596</pre></a></td><td class='covered-line'><pre>22.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>22.5k</span></div><div class='tooltip'>!ok<span class='tooltip-content'>22.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_597' href='#L_ANDXOR_597'><pre>597</pre></a></td><td class='covered-line'><pre>6.97k</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_598' href='#L_ANDXOR_598'><pre>598</pre></a></td><td class='covered-line'><pre>22.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_599' href='#L_ANDXOR_599'><pre>599</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.5k</span></div><div class='tooltip'>L11 == A<span class='tooltip-content'>15.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.26k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_600' href='#L_ANDXOR_600'><pre>600</pre></a></td><td class='covered-line'><pre>2.26k</pre></td><td class='code'><pre> B = L12; C = L2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_601' href='#L_ANDXOR_601'><pre>601</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>13.2k</span></div><div class='tooltip'>L12 == A<span class='tooltip-content'>13.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_602' href='#L_ANDXOR_602'><pre>602</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> B = L11; C = L2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_603' href='#L_ANDXOR_603'><pre>603</pre></a></td><td class='covered-line'><pre>735</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>735</span></div><div class='tooltip'>L21 == A<span class='tooltip-content'>735</span></div>) <div class='tooltip'>{<span class='tooltip-content'>405</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_604' href='#L_ANDXOR_604'><pre>604</pre></a></td><td class='covered-line'><pre>405</pre></td><td class='code'><pre> B = L22; C = L1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_605' href='#L_ANDXOR_605'><pre>605</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>330</span></div><div class='tooltip'>L22 == A<span class='tooltip-content'>330</span></div>) <div class='tooltip'>{<span class='tooltip-content'>330</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_606' href='#L_ANDXOR_606'><pre>606</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> B = L21; C = L1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_607' href='#L_ANDXOR_607'><pre>607</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_608' href='#L_ANDXOR_608'><pre>608</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_609' href='#L_ANDXOR_609'><pre>609</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> unsigned LeftType = getTypeOfMaskedICmp(A, B, C, LHSCC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_610' href='#L_ANDXOR_610'><pre>610</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> unsigned RightType = getTypeOfMaskedICmp(A, D, E, RHSCC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_611' href='#L_ANDXOR_611'><pre>611</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> return LeftType & RightType;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_612' href='#L_ANDXOR_612'><pre>612</pre></a></td><td class='covered-line'><pre>22.5k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_613' href='#L_ANDXOR_613'><pre>613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_614' href='#L_ANDXOR_614'><pre>614</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold (icmp(A & B) ==/!= C) &/| (icmp(A & D) ==/!= E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_615' href='#L_ANDXOR_615'><pre>615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into a single (icmp(A & X) ==/!= Y).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_616' href='#L_ANDXOR_616'><pre>616</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_617' href='#L_ANDXOR_617'><pre>617</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> llvm::InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_618' href='#L_ANDXOR_618'><pre>618</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr, *C = nullptr, *D = nullptr, *E = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_619' href='#L_ANDXOR_619'><pre>619</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_620' href='#L_ANDXOR_620'><pre>620</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> unsigned Mask = foldLogOpOfMaskedICmpsHelper(A, B, C, D, E, LHS, RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_621' href='#L_ANDXOR_621'><pre>621</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> LHSCC, RHSCC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_622' href='#L_ANDXOR_622'><pre>622</pre></a></td><td class='covered-line'><pre>58.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask == 0<span class='tooltip-content'>58.1k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>51.6k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_623' href='#L_ANDXOR_623'><pre>623</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> assert(ICmpInst::isEquality(LHSCC) && ICmpInst::isEquality(RHSCC) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_624' href='#L_ANDXOR_624'><pre>624</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> "foldLogOpOfMaskedICmpsHelper must return an equality predicate.");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_625' href='#L_ANDXOR_625'><pre>625</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_626' href='#L_ANDXOR_626'><pre>626</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // In full generality:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_627' href='#L_ANDXOR_627'><pre>627</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // (icmp (A & B) Op C) | (icmp (A & D) Op E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_628' href='#L_ANDXOR_628'><pre>628</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // == ![ (icmp (A & B) !Op C) & (icmp (A & D) !Op E) ]</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_629' href='#L_ANDXOR_629'><pre>629</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_630' href='#L_ANDXOR_630'><pre>630</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // If the latter can be converted into (icmp (A & X) Op Y) then the former is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_631' href='#L_ANDXOR_631'><pre>631</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // equivalent to (icmp (A & X) !Op Y).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_632' href='#L_ANDXOR_632'><pre>632</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_633' href='#L_ANDXOR_633'><pre>633</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // Therefore, we can pretend for the rest of this function that we're dealing</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_634' href='#L_ANDXOR_634'><pre>634</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // with the conjunction, provided we flip the sense of any comparisons (both</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_635' href='#L_ANDXOR_635'><pre>635</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // input and output).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_636' href='#L_ANDXOR_636'><pre>636</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_637' href='#L_ANDXOR_637'><pre>637</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> // In most cases we're going to produce an EQ for the "&&" case.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_638' href='#L_ANDXOR_638'><pre>638</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> ICmpInst::Predicate NewCC = IsAnd ? <div class='tooltip'>ICmpInst::ICMP_EQ<span class='tooltip-content'>6.46k</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_NE</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_639' href='#L_ANDXOR_639'><pre>639</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> if (<div class='tooltip'>!IsAnd<span class='tooltip-content'>6.46k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.94k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_640' href='#L_ANDXOR_640'><pre>640</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> // Convert the masking analysis into its equivalent with negated</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_641' href='#L_ANDXOR_641'><pre>641</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> // comparisons.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_642' href='#L_ANDXOR_642'><pre>642</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> Mask = conjugateICmpMask(Mask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_643' href='#L_ANDXOR_643'><pre>643</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_644' href='#L_ANDXOR_644'><pre>644</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_645' href='#L_ANDXOR_645'><pre>645</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask & FoldMskICmp_Mask_AllZeroes<span class='tooltip-content'>6.46k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>197</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_646' href='#L_ANDXOR_646'><pre>646</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // (icmp eq (A & B), 0) & (icmp eq (A & D), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_647' href='#L_ANDXOR_647'><pre>647</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // -> (icmp eq (A & (B|D)), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_648' href='#L_ANDXOR_648'><pre>648</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> Value *NewOr = Builder->CreateOr(B, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_649' href='#L_ANDXOR_649'><pre>649</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(A, NewOr);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_650' href='#L_ANDXOR_650'><pre>650</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // We can't use C as zero because we might actually handle</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_651' href='#L_ANDXOR_651'><pre>651</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // (icmp ne (A & B), B) & (icmp ne (A & D), D)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_652' href='#L_ANDXOR_652'><pre>652</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // with B and D, having a single bit set.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_653' href='#L_ANDXOR_653'><pre>653</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> Value *Zero = Constant::getNullValue(A->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_654' href='#L_ANDXOR_654'><pre>654</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> return Builder->CreateICmp(NewCC, NewAnd, Zero);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_655' href='#L_ANDXOR_655'><pre>655</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_656' href='#L_ANDXOR_656'><pre>656</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.26k</span></div><div class='tooltip'>Mask & FoldMskICmp_BMask_AllOnes<span class='tooltip-content'>6.26k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_657' href='#L_ANDXOR_657'><pre>657</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // (icmp eq (A & B), B) & (icmp eq (A & D), D)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_658' href='#L_ANDXOR_658'><pre>658</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // -> (icmp eq (A & (B|D)), (B|D))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_659' href='#L_ANDXOR_659'><pre>659</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *NewOr = Builder->CreateOr(B, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_660' href='#L_ANDXOR_660'><pre>660</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(A, NewOr);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_661' href='#L_ANDXOR_661'><pre>661</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Builder->CreateICmp(NewCC, NewAnd, NewOr);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_662' href='#L_ANDXOR_662'><pre>662</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_663' href='#L_ANDXOR_663'><pre>663</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.26k</span></div><div class='tooltip'>Mask & FoldMskICmp_AMask_AllOnes<span class='tooltip-content'>6.26k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_664' href='#L_ANDXOR_664'><pre>664</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // (icmp eq (A & B), A) & (icmp eq (A & D), A)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_665' href='#L_ANDXOR_665'><pre>665</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // -> (icmp eq (A & (B&D)), A)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_666' href='#L_ANDXOR_666'><pre>666</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *NewAnd1 = Builder->CreateAnd(B, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_667' href='#L_ANDXOR_667'><pre>667</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *NewAnd2 = Builder->CreateAnd(A, NewAnd1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_668' href='#L_ANDXOR_668'><pre>668</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return Builder->CreateICmp(NewCC, NewAnd2, A);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_669' href='#L_ANDXOR_669'><pre>669</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_670' href='#L_ANDXOR_670'><pre>670</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_671' href='#L_ANDXOR_671'><pre>671</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> // Remaining cases assume at least that B and D are constant, and depend on</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_672' href='#L_ANDXOR_672'><pre>672</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> // their actual values. This isn't strictly necessary, just a "handle the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_673' href='#L_ANDXOR_673'><pre>673</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> // easy cases for now" decision.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_674' href='#L_ANDXOR_674'><pre>674</pre></a></td><td class='covered-line'><pre>6.25k</pre></td><td class='code'><pre> ConstantInt *BCst = dyn_cast<ConstantInt>(B);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_675' href='#L_ANDXOR_675'><pre>675</pre></a></td><td class='covered-line'><pre>6.25k</pre></td><td class='code'><pre> if (<div class='tooltip'>!BCst<span class='tooltip-content'>6.25k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>5.23k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_676' href='#L_ANDXOR_676'><pre>676</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> ConstantInt *DCst = dyn_cast<ConstantInt>(D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_677' href='#L_ANDXOR_677'><pre>677</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> if (<div class='tooltip'>!DCst<span class='tooltip-content'>1.02k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_678' href='#L_ANDXOR_678'><pre>678</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_679' href='#L_ANDXOR_679'><pre>679</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.02k</span></div><div class='tooltip'>Mask & (FoldMskICmp_Mask_NotAllZeroes | FoldMskICmp_BMask_NotAllOnes)<span class='tooltip-content'>1.02k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>52</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_680' href='#L_ANDXOR_680'><pre>680</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // (icmp ne (A & B), 0) & (icmp ne (A & D), 0) and</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_681' href='#L_ANDXOR_681'><pre>681</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // (icmp ne (A & B), B) & (icmp ne (A & D), D)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_682' href='#L_ANDXOR_682'><pre>682</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // -> (icmp ne (A & B), 0) or (icmp ne (A & D), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_683' href='#L_ANDXOR_683'><pre>683</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // Only valid if one of the masks is a superset of the other (check "B&D" is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_684' href='#L_ANDXOR_684'><pre>684</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // the same as either B or D).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_685' href='#L_ANDXOR_685'><pre>685</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> APInt NewMask = BCst->getValue() & DCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_686' href='#L_ANDXOR_686'><pre>686</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_687' href='#L_ANDXOR_687'><pre>687</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> if (NewMask == BCst->getValue())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_688' href='#L_ANDXOR_688'><pre>688</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_689' href='#L_ANDXOR_689'><pre>689</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>51</span></div><div class='tooltip'>NewMask == DCst->getValue()<span class='tooltip-content'>51</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_690' href='#L_ANDXOR_690'><pre>690</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_691' href='#L_ANDXOR_691'><pre>691</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_692' href='#L_ANDXOR_692'><pre>692</pre></a></td><td class='covered-line'><pre>998</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>998</span></div><div class='tooltip'>Mask & FoldMskICmp_AMask_NotAllOnes<span class='tooltip-content'>998</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_693' href='#L_ANDXOR_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (icmp ne (A & B), B) & (icmp ne (A & D), D)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_694' href='#L_ANDXOR_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> (icmp ne (A & B), A) or (icmp ne (A & D), A)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_695' href='#L_ANDXOR_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only valid if one of the masks is a superset of the other (check "B|D" is</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_696' href='#L_ANDXOR_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the same as either B or D).</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_697' href='#L_ANDXOR_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt NewMask = BCst->getValue() | DCst->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_698' href='#L_ANDXOR_698'><pre>698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_699' href='#L_ANDXOR_699'><pre>699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NewMask == BCst->getValue()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_700' href='#L_ANDXOR_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return LHS</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_701' href='#L_ANDXOR_701'><pre>701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>NewMask == DCst->getValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_702' href='#L_ANDXOR_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return RHS</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_703' href='#L_ANDXOR_703'><pre>703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_704' href='#L_ANDXOR_704'><pre>704</pre></a></td><td class='covered-line'><pre>998</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>998</span></div><div class='tooltip'>Mask & FoldMskICmp_BMask_Mixed<span class='tooltip-content'>998</span></div>) <div class='tooltip'>{<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_705' href='#L_ANDXOR_705'><pre>705</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // (icmp eq (A & B), C) & (icmp eq (A & D), E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_706' href='#L_ANDXOR_706'><pre>706</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // We already know that B & C == C && D & E == E.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_707' href='#L_ANDXOR_707'><pre>707</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // If we can prove that (B & D) & (C ^ E) == 0, that is, the bits of</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_708' href='#L_ANDXOR_708'><pre>708</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // C and E, which are shared by both the mask B and the mask D, don't</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_709' href='#L_ANDXOR_709'><pre>709</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // contradict, then we can transform to</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_710' href='#L_ANDXOR_710'><pre>710</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // -> (icmp eq (A & (B|D)), (C|E))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_711' href='#L_ANDXOR_711'><pre>711</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // Currently, we only handle the case of B, C, D, and E being constant.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_712' href='#L_ANDXOR_712'><pre>712</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // We can't simply use C and E because we might actually handle</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_713' href='#L_ANDXOR_713'><pre>713</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // (icmp ne (A & B), B) & (icmp eq (A & D), D)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_714' href='#L_ANDXOR_714'><pre>714</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // with B and D, having a single bit set.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_715' href='#L_ANDXOR_715'><pre>715</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> ConstantInt *CCst = dyn_cast<ConstantInt>(C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_716' href='#L_ANDXOR_716'><pre>716</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> if (<div class='tooltip'>!CCst<span class='tooltip-content'>21</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_717' href='#L_ANDXOR_717'><pre>717</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> ConstantInt *ECst = dyn_cast<ConstantInt>(E);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_718' href='#L_ANDXOR_718'><pre>718</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> if (<div class='tooltip'>!ECst<span class='tooltip-content'>21</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_719' href='#L_ANDXOR_719'><pre>719</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21</span></div><div class='tooltip'>LHSCC != NewCC<span class='tooltip-content'>21</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_720' href='#L_ANDXOR_720'><pre>720</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> CCst = cast<ConstantInt>(ConstantExpr::getXor(BCst, CCst));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_721' href='#L_ANDXOR_721'><pre>721</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> if (RHSCC != NewCC)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_722' href='#L_ANDXOR_722'><pre>722</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ECst = cast<ConstantInt>(ConstantExpr::getXor(DCst, ECst));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_723' href='#L_ANDXOR_723'><pre>723</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // If there is a conflict, we should actually return a false for the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_724' href='#L_ANDXOR_724'><pre>724</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // whole construct.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_725' href='#L_ANDXOR_725'><pre>725</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> if (((BCst->getValue() & DCst->getValue()) &</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_726' href='#L_ANDXOR_726'><pre>726</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> (CCst->getValue() ^ ECst->getValue())) != 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_727' href='#L_ANDXOR_727'><pre>727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return ConstantInt::get(LHS->getType(), !IsAnd)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_728' href='#L_ANDXOR_728'><pre>728</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Value *NewOr1 = Builder->CreateOr(B, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_729' href='#L_ANDXOR_729'><pre>729</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Value *NewOr2 = ConstantExpr::getOr(CCst, ECst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_730' href='#L_ANDXOR_730'><pre>730</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(A, NewOr1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_731' href='#L_ANDXOR_731'><pre>731</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return Builder->CreateICmp(NewCC, NewAnd, NewOr2);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_732' href='#L_ANDXOR_732'><pre>732</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_733' href='#L_ANDXOR_733'><pre>733</pre></a></td><td class='covered-line'><pre>977</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_734' href='#L_ANDXOR_734'><pre>734</pre></a></td><td class='covered-line'><pre>998</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_735' href='#L_ANDXOR_735'><pre>735</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_736' href='#L_ANDXOR_736'><pre>736</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold a signed range checked with lower bound 0 to an unsigned icmp.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_737' href='#L_ANDXOR_737'><pre>737</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example: (icmp sge x, 0) & (icmp slt x, n) --> icmp ult x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_738' href='#L_ANDXOR_738'><pre>738</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If \p Inverted is true then the check is for the inverted range, e.g.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_739' href='#L_ANDXOR_739'><pre>739</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp slt x, 0) | (icmp sgt x, n) --> icmp ugt x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_740' href='#L_ANDXOR_740'><pre>740</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_741' href='#L_ANDXOR_741'><pre>741</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre> bool Inverted) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_742' href='#L_ANDXOR_742'><pre>742</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre> // Check the lower range comparison, e.g. x >= 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_743' href='#L_ANDXOR_743'><pre>743</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre> // InstCombine already ensured that if there is a constant it's on the RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_744' href='#L_ANDXOR_744'><pre>744</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre> ConstantInt *RangeStart = dyn_cast<ConstantInt>(Cmp0->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_745' href='#L_ANDXOR_745'><pre>745</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre> if (!RangeStart)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_746' href='#L_ANDXOR_746'><pre>746</pre></a></td><td class='covered-line'><pre>56.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_747' href='#L_ANDXOR_747'><pre>747</pre></a></td><td class='covered-line'><pre>115k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_748' href='#L_ANDXOR_748'><pre>748</pre></a></td><td class='covered-line'><pre>59.3k</pre></td><td class='code'><pre> <div class='tooltip'>ICmpInst::Predicate Pred0 = (Inverted ? <span class='tooltip-content'>59.3k</span></div><div class='tooltip'>Cmp0->getInversePredicate()<span class='tooltip-content'>24.0k</span></div> :</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_749' href='#L_ANDXOR_749'><pre>749</pre></a></td><td class='covered-line'><pre>35.3k</pre></td><td class='code'><pre> Cmp0->getPredicate());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_750' href='#L_ANDXOR_750'><pre>750</pre></a></td><td class='covered-line'><pre>59.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_751' href='#L_ANDXOR_751'><pre>751</pre></a></td><td class='covered-line'><pre>59.3k</pre></td><td class='code'><pre> // Accept x > -1 or x >= 0 (after potentially inverting the predicate).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_752' href='#L_ANDXOR_752'><pre>752</pre></a></td><td class='covered-line'><pre>59.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>!((Pred0 == ICmpInst::ICMP_SGT && <span class='tooltip-content'>59.3k</span></div><div class='tooltip'>RangeStart->isMinusOne()<span class='tooltip-content'>5.29k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_753' href='#L_ANDXOR_753'><pre>753</pre></a></td><td class='covered-line'><pre>57.4k</pre></td><td class='code'><pre> <div class='tooltip'>(Pred0 == ICmpInst::ICMP_SGE && <span class='tooltip-content'>57.4k</span></div><div class='tooltip'>RangeStart->isZero()<span class='tooltip-content'>2.68k</span></div>)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_754' href='#L_ANDXOR_754'><pre>754</pre></a></td><td class='covered-line'><pre>56.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_755' href='#L_ANDXOR_755'><pre>755</pre></a></td><td class='covered-line'><pre>59.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_756' href='#L_ANDXOR_756'><pre>756</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> <div class='tooltip'>ICmpInst::Predicate Pred1 = (Inverted ? <span class='tooltip-content'>2.72k</span></div><div class='tooltip'>Cmp1->getInversePredicate()<span class='tooltip-content'>757</span></div> :</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_757' href='#L_ANDXOR_757'><pre>757</pre></a></td><td class='covered-line'><pre>1.96k</pre></td><td class='code'><pre> Cmp1->getPredicate());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_758' href='#L_ANDXOR_758'><pre>758</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_759' href='#L_ANDXOR_759'><pre>759</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> Value *Input = Cmp0->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_760' href='#L_ANDXOR_760'><pre>760</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> Value *RangeEnd;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_761' href='#L_ANDXOR_761'><pre>761</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp1->getOperand(0) == Input<span class='tooltip-content'>2.72k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>435</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_762' href='#L_ANDXOR_762'><pre>762</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> // For the upper range compare we have: icmp x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_763' href='#L_ANDXOR_763'><pre>763</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> RangeEnd = Cmp1->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_764' href='#L_ANDXOR_764'><pre>764</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>2.28k</span></div><div class='tooltip'>Cmp1->getOperand(1) == Input<span class='tooltip-content'>2.28k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>959</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_765' href='#L_ANDXOR_765'><pre>765</pre></a></td><td class='covered-line'><pre>959</pre></td><td class='code'><pre> // For the upper range compare we have: icmp n, x</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_766' href='#L_ANDXOR_766'><pre>766</pre></a></td><td class='covered-line'><pre>959</pre></td><td class='code'><pre> RangeEnd = Cmp1->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_767' href='#L_ANDXOR_767'><pre>767</pre></a></td><td class='covered-line'><pre>959</pre></td><td class='code'><pre> Pred1 = ICmpInst::getSwappedPredicate(Pred1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_768' href='#L_ANDXOR_768'><pre>768</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_769' href='#L_ANDXOR_769'><pre>769</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_770' href='#L_ANDXOR_770'><pre>770</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_771' href='#L_ANDXOR_771'><pre>771</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_772' href='#L_ANDXOR_772'><pre>772</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> // Check the upper range comparison, e.g. x < n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_773' href='#L_ANDXOR_773'><pre>773</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> ICmpInst::Predicate NewPred;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_774' href='#L_ANDXOR_774'><pre>774</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> switch (Pred1) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_775' href='#L_ANDXOR_775'><pre>775</pre></a></td><td class='covered-line'><pre>983</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: NewPred = ICmpInst::ICMP_ULT; break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_776' href='#L_ANDXOR_776'><pre>776</pre></a></td><td class='covered-line'><pre>130</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLE: NewPred = ICmpInst::ICMP_ULE; break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_777' href='#L_ANDXOR_777'><pre>777</pre></a></td><td class='covered-line'><pre>281</pre></td><td class='code'><pre> default: return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_778' href='#L_ANDXOR_778'><pre>778</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_779' href='#L_ANDXOR_779'><pre>779</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_780' href='#L_ANDXOR_780'><pre>780</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> // This simplification is only valid if the upper range is not negative.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_781' href='#L_ANDXOR_781'><pre>781</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> bool IsNegative, IsNotNegative;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_782' href='#L_ANDXOR_782'><pre>782</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> ComputeSignBit(RangeEnd, IsNotNegative, IsNegative, /*Depth=*/0, Cmp1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_783' href='#L_ANDXOR_783'><pre>783</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> if (!IsNotNegative)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_784' href='#L_ANDXOR_784'><pre>784</pre></a></td><td class='covered-line'><pre>1.06k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_785' href='#L_ANDXOR_785'><pre>785</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_786' href='#L_ANDXOR_786'><pre>786</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>50</span></div><div class='tooltip'>Inverted<span class='tooltip-content'>50</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_787' href='#L_ANDXOR_787'><pre>787</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> NewPred = ICmpInst::getInversePredicate(NewPred);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_788' href='#L_ANDXOR_788'><pre>788</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_789' href='#L_ANDXOR_789'><pre>789</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre> return Builder->CreateICmp(NewPred, Input, RangeEnd);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_790' href='#L_ANDXOR_790'><pre>790</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_791' href='#L_ANDXOR_791'><pre>791</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_792' href='#L_ANDXOR_792'><pre>792</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold (icmp)&(icmp) if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_793' href='#L_ANDXOR_793'><pre>793</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre>Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_794' href='#L_ANDXOR_794'><pre>794</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_795' href='#L_ANDXOR_795'><pre>795</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_796' href='#L_ANDXOR_796'><pre>796</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_797' href='#L_ANDXOR_797'><pre>797</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>PredicatesFoldable(LHSCC, RHSCC)<span class='tooltip-content'>28.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_798' href='#L_ANDXOR_798'><pre>798</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(1) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_799' href='#L_ANDXOR_799'><pre>799</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> LHS->getOperand(1) == RHS->getOperand(0))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_800' href='#L_ANDXOR_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHS->swapOperands()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_801' href='#L_ANDXOR_801'><pre>801</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(0) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_802' href='#L_ANDXOR_802'><pre>802</pre></a></td><td class='covered-line'><pre>3.75k</pre></td><td class='code'><pre> <div class='tooltip'>LHS->getOperand(1) == RHS->getOperand(1)<span class='tooltip-content'>3.75k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_803' href='#L_ANDXOR_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_804' href='#L_ANDXOR_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Code = getICmpCode(LHS) & getICmpCode(RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_805' href='#L_ANDXOR_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool isSigned = LHS->isSigned() || </span><span class='red'>RHS->isSigned()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_806' href='#L_ANDXOR_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return getNewICmpValue(isSigned, Code, Op0, Op1, Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_807' href='#L_ANDXOR_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_808' href='#L_ANDXOR_808'><pre>808</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_809' href='#L_ANDXOR_809'><pre>809</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_810' href='#L_ANDXOR_810'><pre>810</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // handle (roughly): (icmp eq (A & B), C) & (icmp eq (A & D), E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_811' href='#L_ANDXOR_811'><pre>811</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>28.3k</span></div><div class='tooltip'>V<span class='tooltip-content'>28.3k</span></div> = foldLogOpOfMaskedICmps(LHS, RHS, true, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_812' href='#L_ANDXOR_812'><pre>812</pre></a></td><td class='covered-line'><pre>178</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_813' href='#L_ANDXOR_813'><pre>813</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_814' href='#L_ANDXOR_814'><pre>814</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // E.g. (icmp sge x, 0) & (icmp slt x, n) --> icmp ult x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_815' href='#L_ANDXOR_815'><pre>815</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>28.1k</span></div><div class='tooltip'>V<span class='tooltip-content'>28.1k</span></div> = simplifyRangeCheck(LHS, RHS, /*Inverted=*/false))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_816' href='#L_ANDXOR_816'><pre>816</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_817' href='#L_ANDXOR_817'><pre>817</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_818' href='#L_ANDXOR_818'><pre>818</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // E.g. (icmp slt x, n) & (icmp sge x, 0) --> icmp ult x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_819' href='#L_ANDXOR_819'><pre>819</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>28.1k</span></div><div class='tooltip'>V<span class='tooltip-content'>28.1k</span></div> = simplifyRangeCheck(RHS, LHS, /*Inverted=*/false))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_820' href='#L_ANDXOR_820'><pre>820</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_821' href='#L_ANDXOR_821'><pre>821</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_822' href='#L_ANDXOR_822'><pre>822</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // This only handles icmp of constants: (icmp1 A, C1) & (icmp2 B, C2).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_823' href='#L_ANDXOR_823'><pre>823</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_824' href='#L_ANDXOR_824'><pre>824</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_825' href='#L_ANDXOR_825'><pre>825</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> ConstantInt *RHSCst = dyn_cast<ConstantInt>(RHS->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_826' href='#L_ANDXOR_826'><pre>826</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHSCst || <span class='tooltip-content'>28.1k</span></div><div class='tooltip'>!RHSCst<span class='tooltip-content'>18.5k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>14.6k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_827' href='#L_ANDXOR_827'><pre>827</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_828' href='#L_ANDXOR_828'><pre>828</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>13.5k</span></div><div class='tooltip'>LHSCst == RHSCst && <span class='tooltip-content'>13.5k</span></div><div class='tooltip'>LHSCC == RHSCC<span class='tooltip-content'>4.90k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_829' href='#L_ANDXOR_829'><pre>829</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> // (icmp ult A, C) & (icmp ult B, C) --> (icmp ult (A|B), C)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_830' href='#L_ANDXOR_830'><pre>830</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> // where C is a power of 2 or</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_831' href='#L_ANDXOR_831'><pre>831</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> // (icmp eq A, 0) & (icmp eq B, 0) --> (icmp eq (A|B), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_832' href='#L_ANDXOR_832'><pre>832</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> if (<div class='tooltip'>(LHSCC == ICmpInst::ICMP_ULT && <span class='tooltip-content'>3.12k</span></div><div class='tooltip'>LHSCst->getValue().isPowerOf2()<span class='tooltip-content'>87</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_833' href='#L_ANDXOR_833'><pre>833</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> <div class='tooltip'>(LHSCC == ICmpInst::ICMP_EQ && <span class='tooltip-content'>3.12k</span></div><div class='tooltip'>LHSCst->isZero()<span class='tooltip-content'>454</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_834' href='#L_ANDXOR_834'><pre>834</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *NewOr = Builder->CreateOr(Val, Val2);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_835' href='#L_ANDXOR_835'><pre>835</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Builder->CreateICmp(LHSCC, NewOr, LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_836' href='#L_ANDXOR_836'><pre>836</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_837' href='#L_ANDXOR_837'><pre>837</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_838' href='#L_ANDXOR_838'><pre>838</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_839' href='#L_ANDXOR_839'><pre>839</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // (trunc x) == C1 & (and x, CA) == C2 -> (and x, CA|CMAX) == C1|C2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_840' href='#L_ANDXOR_840'><pre>840</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // where CMAX is the all ones value for the truncated type,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_841' href='#L_ANDXOR_841'><pre>841</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // iff the lower bits of C2 and CA are zero.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_842' href='#L_ANDXOR_842'><pre>842</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>13.5k</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_EQ && <span class='tooltip-content'>13.5k</span></div><div class='tooltip'>LHSCC == RHSCC<span class='tooltip-content'>4.64k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_843' href='#L_ANDXOR_843'><pre>843</pre></a></td><td class='covered-line'><pre>2.23k</pre></td><td class='code'><pre> <div class='tooltip'>LHS->hasOneUse()<span class='tooltip-content'>2.23k</span></div> && <div class='tooltip'>RHS->hasOneUse()<span class='tooltip-content'>1.69k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.53k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_844' href='#L_ANDXOR_844'><pre>844</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> Value *V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_845' href='#L_ANDXOR_845'><pre>845</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> ConstantInt *AndCst, *SmallCst = nullptr, *BigCst = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_846' href='#L_ANDXOR_846'><pre>846</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_847' href='#L_ANDXOR_847'><pre>847</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> // (trunc x) == C1 & (and x, CA) == C2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_848' href='#L_ANDXOR_848'><pre>848</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> // (and x, CA) == C2 & (trunc x) == C1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_849' href='#L_ANDXOR_849'><pre>849</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> if (match(Val2, m_Trunc(m_Value(V))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_850' href='#L_ANDXOR_850'><pre>850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(Val, m_And(m_Specific(V), m_ConstantInt(AndCst)))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_851' href='#L_ANDXOR_851'><pre>851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallCst = RHSCst;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_852' href='#L_ANDXOR_852'><pre>852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BigCst = LHSCst;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_853' href='#L_ANDXOR_853'><pre>853</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>1.53k</span></div><div class='tooltip'>match(Val, m_Trunc(m_Value(V))) &&<span class='tooltip-content'>1.53k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_854' href='#L_ANDXOR_854'><pre>854</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> <div class='tooltip'>match(Val2, m_And(m_Specific(V), m_ConstantInt(AndCst)))<span class='tooltip-content'>9</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_855' href='#L_ANDXOR_855'><pre>855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallCst = LHSCst;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_856' href='#L_ANDXOR_856'><pre>856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BigCst = RHSCst;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_857' href='#L_ANDXOR_857'><pre>857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_858' href='#L_ANDXOR_858'><pre>858</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_859' href='#L_ANDXOR_859'><pre>859</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> if (<div class='tooltip'>SmallCst && <span class='tooltip-content'>1.53k</span></div><div class='tooltip'><span class='red'>BigCst</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_860' href='#L_ANDXOR_860'><pre>860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned BigBitSize = BigCst->getType()->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_861' href='#L_ANDXOR_861'><pre>861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SmallBitSize = SmallCst->getType()->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_862' href='#L_ANDXOR_862'><pre>862</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_863' href='#L_ANDXOR_863'><pre>863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that the low bits are zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_864' href='#L_ANDXOR_864'><pre>864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Low = APInt::getLowBitsSet(BigBitSize, SmallBitSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_865' href='#L_ANDXOR_865'><pre>865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(Low & AndCst->getValue()) == 0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Low & BigCst->getValue()) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_866' href='#L_ANDXOR_866'><pre>866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAnd = Builder->CreateAnd(V, Low | AndCst->getValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_867' href='#L_ANDXOR_867'><pre>867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt N = SmallCst->getValue().zext(BigBitSize) | BigCst->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_868' href='#L_ANDXOR_868'><pre>868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewVal = ConstantInt::get(AndCst->getType()->getContext(), N);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_869' href='#L_ANDXOR_869'><pre>869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateICmp(LHSCC, NewAnd, NewVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_870' href='#L_ANDXOR_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_871' href='#L_ANDXOR_871'><pre>871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_872' href='#L_ANDXOR_872'><pre>872</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_873' href='#L_ANDXOR_873'><pre>873</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_874' href='#L_ANDXOR_874'><pre>874</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // From here on, we only handle:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_875' href='#L_ANDXOR_875'><pre>875</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // (icmp1 A, C1) & (icmp2 A, C2) --> something simpler.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_876' href='#L_ANDXOR_876'><pre>876</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>13.5k</span></div><div class='tooltip'>Val != Val2<span class='tooltip-content'>13.5k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>13.0k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_877' href='#L_ANDXOR_877'><pre>877</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_878' href='#L_ANDXOR_878'><pre>878</pre></a></td><td class='covered-line'><pre>13.5k</pre></td><td class='code'><pre> // ICMP_[US][GL]E X, CST is folded to ICMP_[US][GL]T elsewhere.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_879' href='#L_ANDXOR_879'><pre>879</pre></a></td><td class='covered-line'><pre>448</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>448</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_UGE || <span class='tooltip-content'>448</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_ULE<span class='tooltip-content'>447</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_880' href='#L_ANDXOR_880'><pre>880</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre> <div class='tooltip'>RHSCC == ICmpInst::ICMP_UGE<span class='tooltip-content'>447</span></div> || <div class='tooltip'>RHSCC == ICmpInst::ICMP_ULE<span class='tooltip-content'>447</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_881' href='#L_ANDXOR_881'><pre>881</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre> <div class='tooltip'>LHSCC == ICmpInst::ICMP_SGE<span class='tooltip-content'>447</span></div> || <div class='tooltip'>LHSCC == ICmpInst::ICMP_SLE<span class='tooltip-content'>447</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_882' href='#L_ANDXOR_882'><pre>882</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre> <div class='tooltip'>RHSCC == ICmpInst::ICMP_SGE<span class='tooltip-content'>447</span></div> || <div class='tooltip'>RHSCC == ICmpInst::ICMP_SLE<span class='tooltip-content'>447</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_883' href='#L_ANDXOR_883'><pre>883</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_884' href='#L_ANDXOR_884'><pre>884</pre></a></td><td class='covered-line'><pre>448</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_885' href='#L_ANDXOR_885'><pre>885</pre></a></td><td class='covered-line'><pre>448</pre></td><td class='code'><pre> // We can't fold (ugt x, C) & (sgt x, C2).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_886' href='#L_ANDXOR_886'><pre>886</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>447</span></div><div class='tooltip'>!PredicatesFoldable(LHSCC, RHSCC)<span class='tooltip-content'>447</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_887' href='#L_ANDXOR_887'><pre>887</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_888' href='#L_ANDXOR_888'><pre>888</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_889' href='#L_ANDXOR_889'><pre>889</pre></a></td><td class='covered-line'><pre>447</pre></td><td class='code'><pre> // Ensure that the larger constant is on the RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_890' href='#L_ANDXOR_890'><pre>890</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> bool ShouldSwap;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_891' href='#L_ANDXOR_891'><pre>891</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> if (CmpInst::isSigned(LHSCC) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_892' href='#L_ANDXOR_892'><pre>892</pre></a></td><td class='covered-line'><pre>317</pre></td><td class='code'><pre> (ICmpInst::isEquality(LHSCC) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_893' href='#L_ANDXOR_893'><pre>893</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> CmpInst::isSigned(RHSCC)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_894' href='#L_ANDXOR_894'><pre>894</pre></a></td><td class='covered-line'><pre>115</pre></td><td class='code'><pre> ShouldSwap = LHSCst->getValue().sgt(RHSCst->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_895' href='#L_ANDXOR_895'><pre>895</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_896' href='#L_ANDXOR_896'><pre>896</pre></a></td><td class='covered-line'><pre>316</pre></td><td class='code'><pre> ShouldSwap = LHSCst->getValue().ugt(RHSCst->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_897' href='#L_ANDXOR_897'><pre>897</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_898' href='#L_ANDXOR_898'><pre>898</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> if (<div class='tooltip'>ShouldSwap<span class='tooltip-content'>431</span></div>) <div class='tooltip'>{<span class='tooltip-content'>101</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_899' href='#L_ANDXOR_899'><pre>899</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> std::swap(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_900' href='#L_ANDXOR_900'><pre>900</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> std::swap(LHSCst, RHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_901' href='#L_ANDXOR_901'><pre>901</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> std::swap(LHSCC, RHSCC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_902' href='#L_ANDXOR_902'><pre>902</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_903' href='#L_ANDXOR_903'><pre>903</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_904' href='#L_ANDXOR_904'><pre>904</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // At this point, we know we have two icmp instructions</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_905' href='#L_ANDXOR_905'><pre>905</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // comparing a value against two constants and and'ing the result</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_906' href='#L_ANDXOR_906'><pre>906</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // together. Because of the above check, we know that we only have</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_907' href='#L_ANDXOR_907'><pre>907</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_908' href='#L_ANDXOR_908'><pre>908</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // (from the icmp folding check above), that the two constants</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_909' href='#L_ANDXOR_909'><pre>909</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // are not equal and that the larger constant is on the RHS</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_910' href='#L_ANDXOR_910'><pre>910</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> assert(LHSCst != RHSCst && "Compares not folded above?");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_911' href='#L_ANDXOR_911'><pre>911</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_912' href='#L_ANDXOR_912'><pre>912</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> switch (LHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_913' href='#L_ANDXOR_913'><pre>913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_914' href='#L_ANDXOR_914'><pre>914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_915' href='#L_ANDXOR_915'><pre>915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (RHSCC) {</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_916' href='#L_ANDXOR_916'><pre>916</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_917' href='#L_ANDXOR_917'><pre>917</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE: // (X == 13 & X != 15) -> X == 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_918' href='#L_ANDXOR_918'><pre>918</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT: // (X == 13 & X < 15) -> X == 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_919' href='#L_ANDXOR_919'><pre>919</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT: // (X == 13 & X < 15) -> X == 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_920' href='#L_ANDXOR_920'><pre>920</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LHS</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_921' href='#L_ANDXOR_921'><pre>921</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_922' href='#L_ANDXOR_922'><pre>922</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_NE:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_923' href='#L_ANDXOR_923'><pre>923</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_924' href='#L_ANDXOR_924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_925' href='#L_ANDXOR_925'><pre>925</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_ULT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_926' href='#L_ANDXOR_926'><pre>926</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (LHSCst == SubOne(RHSCst)) // (X != 13 & X u< 14) -> X < 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_927' href='#L_ANDXOR_927'><pre>927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->CreateICmpULT(Val, LHSCst)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_928' href='#L_ANDXOR_928'><pre>928</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5</span></div><div class='tooltip'>LHSCst->isNullValue()<span class='tooltip-content'>5</span></div>) // (X != 0 & X u< 14) -> X-1 u< 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_929' href='#L_ANDXOR_929'><pre>929</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return insertRangeTest(Val, LHSCst->getValue() + 1, RHSCst->getValue(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_930' href='#L_ANDXOR_930'><pre>930</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> false, true);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_931' href='#L_ANDXOR_931'><pre>931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>; // (X != 13 & X u< 15) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_932' href='#L_ANDXOR_932'><pre>932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SLT:</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_933' href='#L_ANDXOR_933'><pre>933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>LHSCst == SubOne(RHSCst)</span><span class='red'>) // (X != 13 & X s< 14) -> X < 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_934' href='#L_ANDXOR_934'><pre>934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder->CreateICmpSLT(Val, LHSCst)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_935' href='#L_ANDXOR_935'><pre>935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // (X != 13 & X s< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_936' href='#L_ANDXOR_936'><pre>936</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X != 13 & X == 15) -> X == 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_937' href='#L_ANDXOR_937'><pre>937</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT: // (X != 13 & X u> 15) -> X u> 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_938' href='#L_ANDXOR_938'><pre>938</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT: // (X != 13 & X s> 15) -> X s> 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_939' href='#L_ANDXOR_939'><pre>939</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_940' href='#L_ANDXOR_940'><pre>940</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_941' href='#L_ANDXOR_941'><pre>941</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // Special case to get the ordering right when the values wrap around</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_942' href='#L_ANDXOR_942'><pre>942</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // zero.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_943' href='#L_ANDXOR_943'><pre>943</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSCst->getValue() == 0 && <span class='tooltip-content'>177</span></div><div class='tooltip'>RHSCst->getValue().isAllOnesValue()<span class='tooltip-content'>59</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_944' href='#L_ANDXOR_944'><pre>944</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> std::swap(LHSCst, RHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_945' href='#L_ANDXOR_945'><pre>945</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSCst == SubOne(RHSCst)<span class='tooltip-content'>177</span></div>)<div class='tooltip'>{// (X != 13 & X != 14) -> X-13 >u 1<span class='tooltip-content'>28</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_946' href='#L_ANDXOR_946'><pre>946</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> Constant *AddCST = ConstantExpr::getNeg(LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_947' href='#L_ANDXOR_947'><pre>947</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_948' href='#L_ANDXOR_948'><pre>948</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return Builder->CreateICmpUGT(Add, ConstantInt::get(Add->getType(), 1),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_949' href='#L_ANDXOR_949'><pre>949</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> Val->getName()+".cmp");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_950' href='#L_ANDXOR_950'><pre>950</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_951' href='#L_ANDXOR_951'><pre>951</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> break; // (X != 13 & X != 15) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_952' href='#L_ANDXOR_952'><pre>952</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_953' href='#L_ANDXOR_953'><pre>953</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_954' href='#L_ANDXOR_954'><pre>954</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_955' href='#L_ANDXOR_955'><pre>955</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_956' href='#L_ANDXOR_956'><pre>956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_957' href='#L_ANDXOR_957'><pre>957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ: // (X u< 13 & X == 15) -> false</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_958' href='#L_ANDXOR_958'><pre>958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT: // (X u< 13 & X u> 15) -> false</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_959' href='#L_ANDXOR_959'><pre>959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_960' href='#L_ANDXOR_960'><pre>960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT: // (X u< 13 & X s> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_961' href='#L_ANDXOR_961'><pre>961</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_962' href='#L_ANDXOR_962'><pre>962</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_NE: // (X u< 13 & X != 15) -> X u< 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_963' href='#L_ANDXOR_963'><pre>963</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: // (X u< 13 & X u< 15) -> X u< 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_964' href='#L_ANDXOR_964'><pre>964</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_965' href='#L_ANDXOR_965'><pre>965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SLT: // (X u< 13 & X s< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_966' href='#L_ANDXOR_966'><pre>966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_967' href='#L_ANDXOR_967'><pre>967</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_968' href='#L_ANDXOR_968'><pre>968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_969' href='#L_ANDXOR_969'><pre>969</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_970' href='#L_ANDXOR_970'><pre>970</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_971' href='#L_ANDXOR_971'><pre>971</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_972' href='#L_ANDXOR_972'><pre>972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT: // (X s< 13 & X u> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_973' href='#L_ANDXOR_973'><pre>973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_974' href='#L_ANDXOR_974'><pre>974</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_NE: // (X s< 13 & X != 15) -> X < 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_975' href='#L_ANDXOR_975'><pre>975</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: // (X s< 13 & X s< 15) -> X < 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_976' href='#L_ANDXOR_976'><pre>976</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_977' href='#L_ANDXOR_977'><pre>977</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_ULT: // (X s< 13 & X u< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_978' href='#L_ANDXOR_978'><pre>978</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_979' href='#L_ANDXOR_979'><pre>979</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_980' href='#L_ANDXOR_980'><pre>980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_981' href='#L_ANDXOR_981'><pre>981</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_982' href='#L_ANDXOR_982'><pre>982</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_983' href='#L_ANDXOR_983'><pre>983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_984' href='#L_ANDXOR_984'><pre>984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ: // (X u> 13 & X == 15) -> X == 15</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_985' href='#L_ANDXOR_985'><pre>985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT: // (X u> 13 & X u> 15) -> X u> 15</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_986' href='#L_ANDXOR_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RHS</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_987' href='#L_ANDXOR_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT: // (X u> 13 & X s> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_988' href='#L_ANDXOR_988'><pre>988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_989' href='#L_ANDXOR_989'><pre>989</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_NE:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_990' href='#L_ANDXOR_990'><pre>990</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (RHSCst == AddOne(LHSCst)) // (X u> 13 & X != 14) -> X u> 14</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_991' href='#L_ANDXOR_991'><pre>991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->CreateICmp(LHSCC, Val, RHSCst)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_992' href='#L_ANDXOR_992'><pre>992</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> break; // (X u> 13 & X != 15) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_993' href='#L_ANDXOR_993'><pre>993</pre></a></td><td class='covered-line'><pre>122</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: // (X u> 13 & X u< 15) -> (X-14) <u 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_994' href='#L_ANDXOR_994'><pre>994</pre></a></td><td class='covered-line'><pre>122</pre></td><td class='code'><pre> return insertRangeTest(Val, LHSCst->getValue() + 1, RHSCst->getValue(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_995' href='#L_ANDXOR_995'><pre>995</pre></a></td><td class='covered-line'><pre>122</pre></td><td class='code'><pre> false, true);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_996' href='#L_ANDXOR_996'><pre>996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SLT: // (X u> 13 & X s< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_997' href='#L_ANDXOR_997'><pre>997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_998' href='#L_ANDXOR_998'><pre>998</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_999' href='#L_ANDXOR_999'><pre>999</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1000' href='#L_ANDXOR_1000'><pre>1000</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1001' href='#L_ANDXOR_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1002' href='#L_ANDXOR_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1003' href='#L_ANDXOR_1003'><pre>1003</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X s> 13 & X == 15) -> X == 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1004' href='#L_ANDXOR_1004'><pre>1004</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT: // (X s> 13 & X s> 15) -> X s> 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1005' href='#L_ANDXOR_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1006' href='#L_ANDXOR_1006'><pre>1006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_UGT: // (X s> 13 & X u> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1007' href='#L_ANDXOR_1007'><pre>1007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1008' href='#L_ANDXOR_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1009' href='#L_ANDXOR_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> if (RHSCst == AddOne(LHSCst)) // (X s> 13 & X != 14) -> X s> 14</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1010' href='#L_ANDXOR_1010'><pre>1010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->CreateICmp(LHSCC, Val, RHSCst)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1011' href='#L_ANDXOR_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> break; // (X s> 13 & X != 15) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1012' href='#L_ANDXOR_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: // (X s> 13 & X s< 15) -> (X-14) s< 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1013' href='#L_ANDXOR_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> return insertRangeTest(Val, LHSCst->getValue() + 1, RHSCst->getValue(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1014' href='#L_ANDXOR_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> true, true);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1015' href='#L_ANDXOR_1015'><pre>1015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_ULT: // (X s> 13 & X u< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1016' href='#L_ANDXOR_1016'><pre>1016</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1017' href='#L_ANDXOR_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1018' href='#L_ANDXOR_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1019' href='#L_ANDXOR_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1020' href='#L_ANDXOR_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1021' href='#L_ANDXOR_1021'><pre>1021</pre></a></td><td class='covered-line'><pre>165</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1022' href='#L_ANDXOR_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1023' href='#L_ANDXOR_1023'><pre>1023</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1024' href='#L_ANDXOR_1024'><pre>1024</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Optimize (fcmp)&(fcmp). NOTE: Unlike the rest of instcombine, this returns</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1025' href='#L_ANDXOR_1025'><pre>1025</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a Value which should already be inserted into the function.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1026' href='#L_ANDXOR_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre>Value *InstCombiner::FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1027' href='#L_ANDXOR_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1028' href='#L_ANDXOR_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> Value *Op1LHS = RHS->getOperand(0), *Op1RHS = RHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1029' href='#L_ANDXOR_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1030' href='#L_ANDXOR_1030'><pre>1030</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1031' href='#L_ANDXOR_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0LHS == Op1RHS && <span class='tooltip-content'>486</span></div><div class='tooltip'>Op0RHS == Op1LHS<span class='tooltip-content'>14</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1032' href='#L_ANDXOR_1032'><pre>1032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Swap RHS operands to match LHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1033' href='#L_ANDXOR_1033'><pre>1033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1CC = FCmpInst::getSwappedPredicate(Op1CC);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1034' href='#L_ANDXOR_1034'><pre>1034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op1LHS, Op1RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1035' href='#L_ANDXOR_1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1036' href='#L_ANDXOR_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1037' href='#L_ANDXOR_1037'><pre>1037</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // Simplify (fcmp cc0 x, y) & (fcmp cc1 x, y).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1038' href='#L_ANDXOR_1038'><pre>1038</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // Suppose the relation between x and y is R, where R is one of</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1039' href='#L_ANDXOR_1039'><pre>1039</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // U(1000), L(0100), G(0010) or E(0001), and CC0 and CC1 are the bitmasks for</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1040' href='#L_ANDXOR_1040'><pre>1040</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // testing the desired relations.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1041' href='#L_ANDXOR_1041'><pre>1041</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1042' href='#L_ANDXOR_1042'><pre>1042</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // Since (R & CC0) and (R & CC1) are either R or 0, we actually have this:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1043' href='#L_ANDXOR_1043'><pre>1043</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // bool(R & CC0) && bool(R & CC1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1044' href='#L_ANDXOR_1044'><pre>1044</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // = bool((R & CC0) & (R & CC1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1045' href='#L_ANDXOR_1045'><pre>1045</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> // = bool(R & (CC0 & CC1)) <= by re-association, commutation, and idempotency</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1046' href='#L_ANDXOR_1046'><pre>1046</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0LHS == Op1LHS && <span class='tooltip-content'>486</span></div><div class='tooltip'>Op0RHS == Op1RHS<span class='tooltip-content'>159</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1047' href='#L_ANDXOR_1047'><pre>1047</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return getFCmpValue(getFCmpCode(Op0CC) & getFCmpCode(Op1CC), Op0LHS, Op0RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1048' href='#L_ANDXOR_1048'><pre>1048</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Builder);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1049' href='#L_ANDXOR_1049'><pre>1049</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1050' href='#L_ANDXOR_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>485</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>485</span></div><div class='tooltip'>LHS->getPredicate() == FCmpInst::FCMP_ORD &&<span class='tooltip-content'>485</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1051' href='#L_ANDXOR_1051'><pre>1051</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>RHS->getPredicate() == FCmpInst::FCMP_ORD<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1052' href='#L_ANDXOR_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (LHS->getOperand(0)->getType() != RHS->getOperand(0)->getType())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1053' href='#L_ANDXOR_1053'><pre>1053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1054' href='#L_ANDXOR_1054'><pre>1054</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1055' href='#L_ANDXOR_1055'><pre>1055</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // (fcmp ord x, c) & (fcmp ord y, c) -> (fcmp ord x, y)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1056' href='#L_ANDXOR_1056'><pre>1056</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantFP *<span class='tooltip-content'>7</span></div><div class='tooltip'>LHSC<span class='tooltip-content'>7</span></div> = dyn_cast<ConstantFP>(LHS->getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1057' href='#L_ANDXOR_1057'><pre>1057</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantFP *<span class='tooltip-content'>1</span></div><div class='tooltip'>RHSC<span class='tooltip-content'>1</span></div> = dyn_cast<ConstantFP>(RHS->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1058' href='#L_ANDXOR_1058'><pre>1058</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // If either of the constants are nans, then the whole thing returns</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1059' href='#L_ANDXOR_1059'><pre>1059</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // false.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1060' href='#L_ANDXOR_1060'><pre>1060</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSC->getValueAPF().isNaN() || <span class='tooltip-content'>1</span></div><div class='tooltip'>RHSC->getValueAPF().isNaN()<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1061' href='#L_ANDXOR_1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->getFalse()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1062' href='#L_ANDXOR_1062'><pre>1062</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1063' href='#L_ANDXOR_1063'><pre>1063</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1064' href='#L_ANDXOR_1064'><pre>1064</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1065' href='#L_ANDXOR_1065'><pre>1065</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Handle vector zeros. This occurs because the canonical form of</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1066' href='#L_ANDXOR_1066'><pre>1066</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // "fcmp ord x,x" is "fcmp ord x, 0".</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1067' href='#L_ANDXOR_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6</span></div><div class='tooltip'>isa<ConstantAggregateZero>(LHS->getOperand(1)) &&<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1068' href='#L_ANDXOR_1068'><pre>1068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>isa<ConstantAggregateZero>(RHS->getOperand(1))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1069' href='#L_ANDXOR_1069'><pre>1069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1070' href='#L_ANDXOR_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1071' href='#L_ANDXOR_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1072' href='#L_ANDXOR_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>485</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1073' href='#L_ANDXOR_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1074' href='#L_ANDXOR_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>485</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1075' href='#L_ANDXOR_1075'><pre>1075</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1076' href='#L_ANDXOR_1076'><pre>1076</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Match De Morgan's Laws:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1077' href='#L_ANDXOR_1077'><pre>1077</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (~A & ~B) == (~(A | B))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1078' href='#L_ANDXOR_1078'><pre>1078</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (~A | ~B) == (~(A & B))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1079' href='#L_ANDXOR_1079'><pre>1079</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *matchDeMorgansLaws(BinaryOperator &I,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1080' href='#L_ANDXOR_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1081' href='#L_ANDXOR_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> auto Opcode = I.getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1082' href='#L_ANDXOR_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> assert((Opcode == Instruction::And || Opcode == Instruction::Or) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1083' href='#L_ANDXOR_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> "Trying to match De Morgan's Laws with something other than and/or");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1084' href='#L_ANDXOR_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // Flip the logic operation.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1085' href='#L_ANDXOR_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (Opcode == Instruction::And)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1086' href='#L_ANDXOR_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> Opcode = Instruction::Or;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1087' href='#L_ANDXOR_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1088' href='#L_ANDXOR_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> Opcode = Instruction::And;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1089' href='#L_ANDXOR_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1090' href='#L_ANDXOR_1090'><pre>1090</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1091' href='#L_ANDXOR_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> Value *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1092' href='#L_ANDXOR_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // TODO: Use pattern matchers instead of dyn_cast.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1093' href='#L_ANDXOR_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (Value *Op0NotVal = dyn_castNotVal(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1094' href='#L_ANDXOR_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>318</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>318</span></div><div class='tooltip'>Op1NotVal<span class='tooltip-content'>318</span></div> = dyn_castNotVal(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1095' href='#L_ANDXOR_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>273</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>273</span></div><div class='tooltip'>Op0->hasOneUse() && <span class='tooltip-content'>273</span></div><div class='tooltip'>Op1->hasOneUse()<span class='tooltip-content'>145</span></div>) <div class='tooltip'>{<span class='tooltip-content'>143</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1096' href='#L_ANDXOR_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> Value *LogicOp = Builder->CreateBinOp(Opcode, Op0NotVal, Op1NotVal,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1097' href='#L_ANDXOR_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> I.getName() + ".demorgan");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1098' href='#L_ANDXOR_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> return BinaryOperator::CreateNot(LogicOp);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1099' href='#L_ANDXOR_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1100' href='#L_ANDXOR_1100'><pre>1100</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1101' href='#L_ANDXOR_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1102' href='#L_ANDXOR_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1103' href='#L_ANDXOR_1103'><pre>1103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1104' href='#L_ANDXOR_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre>bool InstCombiner::shouldOptimizeCast(CastInst *CI) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1105' href='#L_ANDXOR_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> Value *CastSrc = CI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1106' href='#L_ANDXOR_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1107' href='#L_ANDXOR_1107'><pre>1107</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> // Noop casts and casts of constants should be eliminated trivially.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1108' href='#L_ANDXOR_1108'><pre>1108</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> if (<div class='tooltip'>CI->getSrcTy() == CI->getDestTy() || <span class='tooltip-content'>320</span></div><div class='tooltip'>isa<Constant>(CastSrc)<span class='tooltip-content'>320</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1109' href='#L_ANDXOR_1109'><pre>1109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1110' href='#L_ANDXOR_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1111' href='#L_ANDXOR_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> // If this cast is paired with another cast that can be eliminated, we prefer</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1112' href='#L_ANDXOR_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> // to have it eliminated.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1113' href='#L_ANDXOR_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> <div class='tooltip'>if (const auto *<span class='tooltip-content'>320</span></div><div class='tooltip'>PrecedingCI<span class='tooltip-content'>320</span></div> = dyn_cast<CastInst>(CastSrc))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1114' href='#L_ANDXOR_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3</span></div><div class='tooltip'>isEliminableCastPair(PrecedingCI, CI)<span class='tooltip-content'>3</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1115' href='#L_ANDXOR_1115'><pre>1115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1116' href='#L_ANDXOR_1116'><pre>1116</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1117' href='#L_ANDXOR_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> // If this is a vector sext from a compare, then we don't want to break the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1118' href='#L_ANDXOR_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> // idiom where each element of the extended vector is either zero or all ones.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1119' href='#L_ANDXOR_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>320</span></div><div class='tooltip'>CI->getOpcode() == Instruction::SExt &&<span class='tooltip-content'>320</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1120' href='#L_ANDXOR_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>74</pre></td><td class='code'><pre> <div class='tooltip'>isa<CmpInst>(CastSrc)<span class='tooltip-content'>74</span></div> && <div class='tooltip'><span class='red'>CI->getDestTy()->isVectorTy()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1121' href='#L_ANDXOR_1121'><pre>1121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1122' href='#L_ANDXOR_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1123' href='#L_ANDXOR_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1124' href='#L_ANDXOR_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>320</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1125' href='#L_ANDXOR_1125'><pre>1125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1126' href='#L_ANDXOR_1126'><pre>1126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold {and,or,xor} (cast X), C.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1127' href='#L_ANDXOR_1127'><pre>1127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1128' href='#L_ANDXOR_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1129' href='#L_ANDXOR_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre> Constant *C;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1130' href='#L_ANDXOR_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre> if (!match(Logic.getOperand(1), m_Constant(C)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1131' href='#L_ANDXOR_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1132' href='#L_ANDXOR_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1133' href='#L_ANDXOR_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> auto LogicOpc = Logic.getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1134' href='#L_ANDXOR_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> Type *DestTy = Logic.getType();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1135' href='#L_ANDXOR_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> Type *SrcTy = Cast->getSrcTy();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1136' href='#L_ANDXOR_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1137' href='#L_ANDXOR_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // If the first operand is bitcast, move the logic operation ahead of the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1138' href='#L_ANDXOR_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // bitcast (do the logic operation in the original type). This can eliminate</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1139' href='#L_ANDXOR_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // bitcasts and allow combines that would otherwise be impeded by the bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1140' href='#L_ANDXOR_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1141' href='#L_ANDXOR_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Cast, m_BitCast(m_Value(X)))<span class='tooltip-content'>6.86k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1142' href='#L_ANDXOR_1142'><pre>1142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewConstant = ConstantExpr::getBitCast(C, SrcTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1143' href='#L_ANDXOR_1143'><pre>1143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOp = Builder->CreateBinOp(LogicOpc, X, NewConstant);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1144' href='#L_ANDXOR_1144'><pre>1144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::CreateBitOrPointerCast(NewOp, DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1145' href='#L_ANDXOR_1145'><pre>1145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1146' href='#L_ANDXOR_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1147' href='#L_ANDXOR_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // Similarly, move the logic operation ahead of a zext if the constant is</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1148' href='#L_ANDXOR_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // unchanged in the smaller source type. Performing the logic in a smaller</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1149' href='#L_ANDXOR_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // type may provide more information to later folds, and the smaller logic</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1150' href='#L_ANDXOR_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> // instruction may be cheaper (particularly in the case of vectors).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1151' href='#L_ANDXOR_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.86k</span></div><div class='tooltip'>match(Cast, m_OneUse(m_ZExt(m_Value(X))))<span class='tooltip-content'>6.86k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>826</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1152' href='#L_ANDXOR_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>826</pre></td><td class='code'><pre> Constant *TruncC = ConstantExpr::getTrunc(C, SrcTy);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1153' href='#L_ANDXOR_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>826</pre></td><td class='code'><pre> Constant *ZextTruncC = ConstantExpr::getZExt(TruncC, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1154' href='#L_ANDXOR_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>826</pre></td><td class='code'><pre> if (<div class='tooltip'>ZextTruncC == C<span class='tooltip-content'>826</span></div>) <div class='tooltip'>{<span class='tooltip-content'>604</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1155' href='#L_ANDXOR_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> // LogicOpc (zext X), C --> zext (LogicOpc X, C)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1156' href='#L_ANDXOR_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> Value *NewOp = Builder->CreateBinOp(LogicOpc, X, TruncC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1157' href='#L_ANDXOR_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> return new ZExtInst(NewOp, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1158' href='#L_ANDXOR_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1159' href='#L_ANDXOR_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>826</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1160' href='#L_ANDXOR_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1161' href='#L_ANDXOR_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>6.26k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1162' href='#L_ANDXOR_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>6.86k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1163' href='#L_ANDXOR_1163'><pre>1163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1164' href='#L_ANDXOR_1164'><pre>1164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold {and,or,xor} (cast X), Y.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1165' href='#L_ANDXOR_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre>Instruction *InstCombiner::foldCastedBitwiseLogic(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1166' href='#L_ANDXOR_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> auto LogicOpc = I.getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1167' href='#L_ANDXOR_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> assert(I.isBitwiseLogicOp() && "Unexpected opcode for bitwise logic folding");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1168' href='#L_ANDXOR_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1169' href='#L_ANDXOR_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1170' href='#L_ANDXOR_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> CastInst *Cast0 = dyn_cast<CastInst>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1171' href='#L_ANDXOR_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> if (!Cast0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1172' href='#L_ANDXOR_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1173' href='#L_ANDXOR_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1174' href='#L_ANDXOR_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> // This must be a cast from an integer or integer vector source type to allow</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1175' href='#L_ANDXOR_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>300k</pre></td><td class='code'><pre> // transformation of the logic operation to the source type.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1176' href='#L_ANDXOR_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>9.08k</pre></td><td class='code'><pre> Type *DestTy = I.getType();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1177' href='#L_ANDXOR_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>9.08k</pre></td><td class='code'><pre> Type *SrcTy = Cast0->getSrcTy();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1178' href='#L_ANDXOR_1178'><pre>1178</pre></a></td><td class='covered-line'><pre>9.08k</pre></td><td class='code'><pre> if (!SrcTy->isIntOrIntVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1179' href='#L_ANDXOR_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1180' href='#L_ANDXOR_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>9.08k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1181' href='#L_ANDXOR_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>7.99k</span></div><div class='tooltip'>Ret<span class='tooltip-content'>7.99k</span></div> = foldLogicCastConstant(I, Cast0, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1182' href='#L_ANDXOR_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> return Ret;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1183' href='#L_ANDXOR_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>7.99k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1184' href='#L_ANDXOR_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> CastInst *Cast1 = dyn_cast<CastInst>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1185' href='#L_ANDXOR_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> if (!Cast1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1186' href='#L_ANDXOR_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>7.03k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1187' href='#L_ANDXOR_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1188' href='#L_ANDXOR_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> // Both operands of the logic operation are casts. The casts must be of the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1189' href='#L_ANDXOR_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> // same type for reduction.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1190' href='#L_ANDXOR_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>356</pre></td><td class='code'><pre> auto CastOpcode = Cast0->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1191' href='#L_ANDXOR_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>356</pre></td><td class='code'><pre> if (<div class='tooltip'>CastOpcode != Cast1->getOpcode() || <span class='tooltip-content'>356</span></div><div class='tooltip'>SrcTy != Cast1->getSrcTy()<span class='tooltip-content'>253</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1192' href='#L_ANDXOR_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>196</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1193' href='#L_ANDXOR_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>356</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1194' href='#L_ANDXOR_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> Value *Cast0Src = Cast0->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1195' href='#L_ANDXOR_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> Value *Cast1Src = Cast1->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1196' href='#L_ANDXOR_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1197' href='#L_ANDXOR_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> // fold logic(cast(A), cast(B)) -> cast(logic(A, B))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1198' href='#L_ANDXOR_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> if (<div class='tooltip'>shouldOptimizeCast(Cast0) && <span class='tooltip-content'>160</span></div><div class='tooltip'>shouldOptimizeCast(Cast1)<span class='tooltip-content'>160</span></div>) <div class='tooltip'>{<span class='tooltip-content'>160</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1199' href='#L_ANDXOR_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> Value *NewOp = Builder->CreateBinOp(LogicOpc, Cast0Src, Cast1Src,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1200' href='#L_ANDXOR_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1201' href='#L_ANDXOR_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> return CastInst::Create(CastOpcode, NewOp, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1202' href='#L_ANDXOR_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1203' href='#L_ANDXOR_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1204' href='#L_ANDXOR_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> // For now, only 'and'/'or' have optimizations after this.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1205' href='#L_ANDXOR_1205'><pre>1205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LogicOpc == Instruction::Xor</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1206' href='#L_ANDXOR_1206'><pre>1206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1207' href='#L_ANDXOR_1207'><pre>1207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1208' href='#L_ANDXOR_1208'><pre>1208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If this is logic(cast(icmp), cast(icmp)), try to fold this even if the</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1209' href='#L_ANDXOR_1209'><pre>1209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cast is otherwise not optimizable. This happens for vector sexts.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1210' href='#L_ANDXOR_1210'><pre>1210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ICmpInst *ICmp0 = dyn_cast<ICmpInst>(Cast0Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1211' href='#L_ANDXOR_1211'><pre>1211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ICmpInst *ICmp1 = dyn_cast<ICmpInst>(Cast1Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1212' href='#L_ANDXOR_1212'><pre>1212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ICmp0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ICmp1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1213' href='#L_ANDXOR_1213'><pre>1213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Res = LogicOpc == Instruction::And ? </span><span class='red'>FoldAndOfICmps(ICmp0, ICmp1)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1214' href='#L_ANDXOR_1214'><pre>1214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>FoldOrOfICmps(ICmp0, ICmp1, &I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1215' href='#L_ANDXOR_1215'><pre>1215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Res</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1216' href='#L_ANDXOR_1216'><pre>1216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return CastInst::Create(CastOpcode, Res, DestTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1217' href='#L_ANDXOR_1217'><pre>1217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1218' href='#L_ANDXOR_1218'><pre>1218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1219' href='#L_ANDXOR_1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1220' href='#L_ANDXOR_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If this is logic(cast(fcmp), cast(fcmp)), try to fold this even if the</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1221' href='#L_ANDXOR_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cast is otherwise not optimizable. This happens for vector sexts.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1222' href='#L_ANDXOR_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>FCmpInst *FCmp0 = dyn_cast<FCmpInst>(Cast0Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1223' href='#L_ANDXOR_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FCmpInst *FCmp1 = dyn_cast<FCmpInst>(Cast1Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1224' href='#L_ANDXOR_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>FCmp0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>FCmp1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1225' href='#L_ANDXOR_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Res = LogicOpc == Instruction::And ? </span><span class='red'>FoldAndOfFCmps(FCmp0, FCmp1)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1226' href='#L_ANDXOR_1226'><pre>1226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>FoldOrOfFCmps(FCmp0, FCmp1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1227' href='#L_ANDXOR_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Res</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1228' href='#L_ANDXOR_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return CastInst::Create(CastOpcode, Res, DestTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1229' href='#L_ANDXOR_1229'><pre>1229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1230' href='#L_ANDXOR_1230'><pre>1230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1231' href='#L_ANDXOR_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1232' href='#L_ANDXOR_1232'><pre>1232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1233' href='#L_ANDXOR_1233'><pre>1233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1234' href='#L_ANDXOR_1234'><pre>1234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1235' href='#L_ANDXOR_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre>static Instruction *foldBoolSextMaskToSelect(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1236' href='#L_ANDXOR_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1237' href='#L_ANDXOR_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1238' href='#L_ANDXOR_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> // Canonicalize SExt or Not to the LHS</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1239' href='#L_ANDXOR_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_SExt(m_Value())) || <span class='tooltip-content'>154k</span></div><div class='tooltip'>match(Op1, m_Not(m_Value()))<span class='tooltip-content'>154k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.37k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1240' href='#L_ANDXOR_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1241' href='#L_ANDXOR_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1242' href='#L_ANDXOR_1242'><pre>1242</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1243' href='#L_ANDXOR_1243'><pre>1243</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> // Fold (and (sext bool to A), B) --> (select bool, B, 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1244' href='#L_ANDXOR_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> Value *X = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1245' href='#L_ANDXOR_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> if (match(Op0, m_SExt(m_Value(X))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1246' href='#L_ANDXOR_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>404</pre></td><td class='code'><pre> <div class='tooltip'>X->getType()->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>404</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1247' href='#L_ANDXOR_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> Value *Zero = Constant::getNullValue(Op1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1248' href='#L_ANDXOR_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return SelectInst::Create(X, Op1, Zero);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1249' href='#L_ANDXOR_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1250' href='#L_ANDXOR_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1251' href='#L_ANDXOR_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> // Fold (and ~(sext bool to A), B) --> (select bool, 0, B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1252' href='#L_ANDXOR_1252'><pre>1252</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>154k</span></div><div class='tooltip'>match(Op0, m_Not(m_SExt(m_Value(X)))) &&<span class='tooltip-content'>154k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1253' href='#L_ANDXOR_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>X->getType()->getScalarType()->isIntegerTy(1)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1254' href='#L_ANDXOR_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Zero = Constant::getNullValue(Op0->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1255' href='#L_ANDXOR_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(X, Zero, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1256' href='#L_ANDXOR_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1257' href='#L_ANDXOR_1257'><pre>1257</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1258' href='#L_ANDXOR_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1259' href='#L_ANDXOR_1259'><pre>1259</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1260' href='#L_ANDXOR_1260'><pre>1260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1261' href='#L_ANDXOR_1261'><pre>1261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// FIXME: We use commutative matchers (m_c_*) for some, but not all, matches</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1262' href='#L_ANDXOR_1262'><pre>1262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// here. We should standardize that construct where it is needed or choose some</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1263' href='#L_ANDXOR_1263'><pre>1263</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// other way to ensure that commutated variants of patterns are not missed.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1264' href='#L_ANDXOR_1264'><pre>1264</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitAnd(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1265' href='#L_ANDXOR_1265'><pre>1265</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1266' href='#L_ANDXOR_1266'><pre>1266</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1267' href='#L_ANDXOR_1267'><pre>1267</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1268' href='#L_ANDXOR_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1269' href='#L_ANDXOR_1269'><pre>1269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1270' href='#L_ANDXOR_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1271' href='#L_ANDXOR_1271'><pre>1271</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>157k</span></div><div class='tooltip'>V<span class='tooltip-content'>157k</span></div> = SimplifyAndInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1272' href='#L_ANDXOR_1272'><pre>1272</pre></a></td><td class='covered-line'><pre>540</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1273' href='#L_ANDXOR_1273'><pre>1273</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1274' href='#L_ANDXOR_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>157k</pre></td><td class='code'><pre> // (A|B)&(A|C) -> A|(B&C) etc</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1275' href='#L_ANDXOR_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>156k</span></div><div class='tooltip'>V<span class='tooltip-content'>156k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1276' href='#L_ANDXOR_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1277' href='#L_ANDXOR_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1278' href='#L_ANDXOR_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> // See if we can simplify any instructions used by the instruction whose sole</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1279' href='#L_ANDXOR_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> // purpose is to compute bits we don't care about.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1280' href='#L_ANDXOR_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>156k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(I)<span class='tooltip-content'>156k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1281' href='#L_ANDXOR_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>937</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1282' href='#L_ANDXOR_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1283' href='#L_ANDXOR_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>155k</span></div><div class='tooltip'>V<span class='tooltip-content'>155k</span></div> = SimplifyBSwap(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1284' href='#L_ANDXOR_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1285' href='#L_ANDXOR_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1286' href='#L_ANDXOR_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>155k</span></div><div class='tooltip'>AndRHS<span class='tooltip-content'>155k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>111k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1287' href='#L_ANDXOR_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> const APInt &AndRHSMask = AndRHS->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1288' href='#L_ANDXOR_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1289' href='#L_ANDXOR_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> // Optimize a variety of ((val OP C1) & C2) combinations...</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1290' href='#L_ANDXOR_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> if (BinaryOperator *<div class='tooltip'>Op0I<span class='tooltip-content'>111k</span></div> = dyn_cast<BinaryOperator>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>27.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1291' href='#L_ANDXOR_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> Value *Op0LHS = Op0I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1292' href='#L_ANDXOR_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> Value *Op0RHS = Op0I->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1293' href='#L_ANDXOR_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> switch (Op0I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1294' href='#L_ANDXOR_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>394</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1295' href='#L_ANDXOR_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1296' href='#L_ANDXOR_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> case Instruction::Or: {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1297' href='#L_ANDXOR_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> // If the mask is only needed on one incoming arm, push it up.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1298' href='#L_ANDXOR_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Op0I->hasOneUse()<span class='tooltip-content'>8.49k</span></div>) <div class='tooltip'>break<span class='tooltip-content'>8.07k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1299' href='#L_ANDXOR_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1300' href='#L_ANDXOR_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>415</pre></td><td class='code'><pre> APInt NotAndRHS(~AndRHSMask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1301' href='#L_ANDXOR_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>415</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskedValueIsZero(Op0LHS, NotAndRHS, 0, &I)<span class='tooltip-content'>415</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1302' href='#L_ANDXOR_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // Not masking anything out for the LHS, move to RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1303' href='#L_ANDXOR_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *NewRHS = Builder->CreateAnd(Op0RHS, AndRHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1304' href='#L_ANDXOR_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Op0RHS->getName()+".masked");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1305' href='#L_ANDXOR_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return BinaryOperator::Create(Op0I->getOpcode(), Op0LHS, NewRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1306' href='#L_ANDXOR_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1307' href='#L_ANDXOR_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>402</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>402</span></div><div class='tooltip'>!isa<Constant>(Op0RHS) &&<span class='tooltip-content'>402</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1308' href='#L_ANDXOR_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0RHS, NotAndRHS, 0, &I)<span class='tooltip-content'>331</span></div>) <div class='tooltip'>{<span class='tooltip-content'>25</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1309' href='#L_ANDXOR_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> // Not masking anything out for the RHS, move to LHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1310' href='#L_ANDXOR_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Value *NewLHS = Builder->CreateAnd(Op0LHS, AndRHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1311' href='#L_ANDXOR_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Op0LHS->getName()+".masked");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1312' href='#L_ANDXOR_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return BinaryOperator::Create(Op0I->getOpcode(), NewLHS, Op0RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1313' href='#L_ANDXOR_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1314' href='#L_ANDXOR_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>402</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1315' href='#L_ANDXOR_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>377</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1316' href='#L_ANDXOR_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>402</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1317' href='#L_ANDXOR_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1318' href='#L_ANDXOR_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> // ((A & N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == AndRHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1319' href='#L_ANDXOR_1319'><pre>1319</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> // ((A | N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1320' href='#L_ANDXOR_1320'><pre>1320</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> // ((A ^ N) + B) & AndRHS -> (A + B) & AndRHS iff N&AndRHS == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1321' href='#L_ANDXOR_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> if (Value *V = FoldLogicalPlusAnd(Op0LHS, Op0RHS, AndRHS, false, I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1322' href='#L_ANDXOR_1322'><pre>1322</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(V, AndRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1323' href='#L_ANDXOR_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>6.58k</span></div><div class='tooltip'>V<span class='tooltip-content'>6.58k</span></div> = FoldLogicalPlusAnd(Op0RHS, Op0LHS, AndRHS, false, I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1324' href='#L_ANDXOR_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(V, AndRHS); // Add commutes</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1325' href='#L_ANDXOR_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1326' href='#L_ANDXOR_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>6.58k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1327' href='#L_ANDXOR_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1328' href='#L_ANDXOR_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // ((A & N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == AndRHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1329' href='#L_ANDXOR_1329'><pre>1329</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // ((A | N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1330' href='#L_ANDXOR_1330'><pre>1330</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // ((A ^ N) - B) & AndRHS -> (A - B) & AndRHS iff N&AndRHS == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1331' href='#L_ANDXOR_1331'><pre>1331</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> if (Value *V = FoldLogicalPlusAnd(Op0LHS, Op0RHS, AndRHS, true, I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1332' href='#L_ANDXOR_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(V, AndRHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1333' href='#L_ANDXOR_1333'><pre>1333</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1334' href='#L_ANDXOR_1334'><pre>1334</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // -x & 1 -> x & 1</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1335' href='#L_ANDXOR_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.29k</span></div><div class='tooltip'>AndRHSMask == 1 && <span class='tooltip-content'>1.29k</span></div><div class='tooltip'>match(Op0LHS, m_Zero())<span class='tooltip-content'>27</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1336' href='#L_ANDXOR_1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(Op0RHS, AndRHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1337' href='#L_ANDXOR_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1338' href='#L_ANDXOR_1338'><pre>1338</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // (A - N) & AndRHS -> -N & AndRHS iff A&AndRHS==0 and AndRHS</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1339' href='#L_ANDXOR_1339'><pre>1339</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> // has 1's for all bits that the subtraction with A might affect.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1340' href='#L_ANDXOR_1340'><pre>1340</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.29k</span></div><div class='tooltip'>Op0I->hasOneUse() && <span class='tooltip-content'>1.29k</span></div><div class='tooltip'>!match(Op0LHS, m_Zero())<span class='tooltip-content'>799</span></div>) <div class='tooltip'>{<span class='tooltip-content'>293</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1341' href='#L_ANDXOR_1341'><pre>1341</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre> uint32_t BitWidth = AndRHSMask.getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1342' href='#L_ANDXOR_1342'><pre>1342</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre> uint32_t Zeros = AndRHSMask.countLeadingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1343' href='#L_ANDXOR_1343'><pre>1343</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre> APInt Mask = APInt::getLowBitsSet(BitWidth, BitWidth - Zeros);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1344' href='#L_ANDXOR_1344'><pre>1344</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1345' href='#L_ANDXOR_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskedValueIsZero(Op0LHS, Mask, 0, &I)<span class='tooltip-content'>293</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1346' href='#L_ANDXOR_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *NewNeg = Builder->CreateNeg(Op0RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1347' href='#L_ANDXOR_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NewNeg, AndRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1348' href='#L_ANDXOR_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1349' href='#L_ANDXOR_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>293</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1350' href='#L_ANDXOR_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1351' href='#L_ANDXOR_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>1.29k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1352' href='#L_ANDXOR_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1353' href='#L_ANDXOR_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1354' href='#L_ANDXOR_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> // (1 << x) & 1 --> zext(x == 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1355' href='#L_ANDXOR_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> // (1 >> x) & 1 --> zext(x == 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1356' href='#L_ANDXOR_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>AndRHSMask == 1 && <span class='tooltip-content'>10.3k</span></div><div class='tooltip'>Op0LHS == AndRHS<span class='tooltip-content'>3.23k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1357' href='#L_ANDXOR_1357'><pre>1357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewICmp =</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1358' href='#L_ANDXOR_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateICmpEQ(Op0RHS, Constant::getNullValue(I.getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1359' href='#L_ANDXOR_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ZExtInst(NewICmp, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1360' href='#L_ANDXOR_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1361' href='#L_ANDXOR_1361'><pre>1361</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1362' href='#L_ANDXOR_1362'><pre>1362</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1363' href='#L_ANDXOR_1363'><pre>1363</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1364' href='#L_ANDXOR_1364'><pre>1364</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> // ((C1 OP zext(X)) & C2) -> zext((C1-X) & C2) if C2 fits in the bitwidth</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1365' href='#L_ANDXOR_1365'><pre>1365</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> // of X and OP behaves well when given trunc(C1) and X.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1366' href='#L_ANDXOR_1366'><pre>1366</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> switch (Op0I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1367' href='#L_ANDXOR_1367'><pre>1367</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1368' href='#L_ANDXOR_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1369' href='#L_ANDXOR_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1370' href='#L_ANDXOR_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1371' href='#L_ANDXOR_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1372' href='#L_ANDXOR_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1373' href='#L_ANDXOR_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1374' href='#L_ANDXOR_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1375' href='#L_ANDXOR_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1376' href='#L_ANDXOR_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> if (match(Op0I, m_BinOp(m_ZExt(m_Value(X)), m_ConstantInt(C1))) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1377' href='#L_ANDXOR_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op0I, m_BinOp(m_ConstantInt(C1), m_ZExt(m_Value(X))))<span class='tooltip-content'>16.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>45</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1378' href='#L_ANDXOR_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> if (<div class='tooltip'>AndRHSMask.isIntN(X->getType()->getScalarSizeInBits())<span class='tooltip-content'>45</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1379' href='#L_ANDXOR_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto *TruncC1 = ConstantExpr::getTrunc(C1, X->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1380' href='#L_ANDXOR_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *BinOp;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1381' href='#L_ANDXOR_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (isa<ZExtInst>(Op0LHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1382' href='#L_ANDXOR_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> BinOp = Builder->CreateBinOp(Op0I->getOpcode(), X, TruncC1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1383' href='#L_ANDXOR_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1384' href='#L_ANDXOR_1384'><pre>1384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BinOp = Builder->CreateBinOp(Op0I->getOpcode(), TruncC1, X)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1385' href='#L_ANDXOR_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto *TruncC2 = ConstantExpr::getTrunc(AndRHS, X->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1386' href='#L_ANDXOR_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto *And = Builder->CreateAnd(BinOp, TruncC2);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1387' href='#L_ANDXOR_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return new ZExtInst(And, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1388' href='#L_ANDXOR_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1389' href='#L_ANDXOR_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1390' href='#L_ANDXOR_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1391' href='#L_ANDXOR_1391'><pre>1391</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1392' href='#L_ANDXOR_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>27.0k</span></div><div class='tooltip'>Op0CI<span class='tooltip-content'>27.0k</span></div> = dyn_cast<ConstantInt>(Op0I->getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1393' href='#L_ANDXOR_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>13.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>13.3k</span></div><div class='tooltip'>Res<span class='tooltip-content'>13.3k</span></div> = OptAndOp(Op0I, Op0CI, AndRHS, I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1394' href='#L_ANDXOR_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>71</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1395' href='#L_ANDXOR_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>27.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1396' href='#L_ANDXOR_1396'><pre>1396</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1397' href='#L_ANDXOR_1397'><pre>1397</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> // If this is an integer truncation, and if the source is an 'and' with</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1398' href='#L_ANDXOR_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> // immediate, transform it. This frequently occurs for bitfield accesses.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1399' href='#L_ANDXOR_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1400' href='#L_ANDXOR_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> Value *X = nullptr; ConstantInt *YC = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1401' href='#L_ANDXOR_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Trunc(m_And(m_Value(X), m_ConstantInt(YC))))<span class='tooltip-content'>111k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1402' href='#L_ANDXOR_1402'><pre>1402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Change: and (trunc (and X, YC) to T), C2</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1403' href='#L_ANDXOR_1403'><pre>1403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // into : and (trunc X to T), trunc(YC) & C2</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1404' href='#L_ANDXOR_1404'><pre>1404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This will fold the two constants together, which may allow</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1405' href='#L_ANDXOR_1405'><pre>1405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // other simplifications.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1406' href='#L_ANDXOR_1406'><pre>1406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewCast = Builder->CreateTrunc(X, I.getType(), "and.shrunk");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1407' href='#L_ANDXOR_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C3 = ConstantExpr::getTrunc(YC, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1408' href='#L_ANDXOR_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C3 = ConstantExpr::getAnd(C3, AndRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1409' href='#L_ANDXOR_1409'><pre>1409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(NewCast, C3);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1410' href='#L_ANDXOR_1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1411' href='#L_ANDXOR_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1412' href='#L_ANDXOR_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1413' href='#L_ANDXOR_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>111k</span></div><div class='tooltip'>FoldedLogic<span class='tooltip-content'>111k</span></div> = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1414' href='#L_ANDXOR_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return FoldedLogic;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1415' href='#L_ANDXOR_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>111k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1416' href='#L_ANDXOR_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1417' href='#L_ANDXOR_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>155k</span></div><div class='tooltip'>DeMorgan<span class='tooltip-content'>155k</span></div> = matchDeMorgansLaws(I, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1418' href='#L_ANDXOR_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> return DeMorgan;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1419' href='#L_ANDXOR_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1420' href='#L_ANDXOR_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1421' href='#L_ANDXOR_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr, *C = nullptr, *D = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1422' href='#L_ANDXOR_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // (A|B) & ~(A&B) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1423' href='#L_ANDXOR_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> if (match(Op0, m_Or(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1424' href='#L_ANDXOR_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>8.18k</pre></td><td class='code'><pre> match(Op1, m_Not(m_And(m_Value(C), m_Value(D)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1425' href='#L_ANDXOR_1425'><pre>1425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>((A == C && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == D</span><span class='tooltip-content'>0</span></div><span class='red'>) || </span><div class='tooltip'><span class='red'>(A == D && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1426' href='#L_ANDXOR_1426'><pre>1426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1427' href='#L_ANDXOR_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1428' href='#L_ANDXOR_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // ~(A&B) & (A|B) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1429' href='#L_ANDXOR_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op1, m_Or(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1430' href='#L_ANDXOR_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>326</pre></td><td class='code'><pre> match(Op0, m_Not(m_And(m_Value(C), m_Value(D)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1431' href='#L_ANDXOR_1431'><pre>1431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>((A == C && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == D</span><span class='tooltip-content'>0</span></div><span class='red'>) || </span><div class='tooltip'><span class='red'>(A == D && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1432' href='#L_ANDXOR_1432'><pre>1432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1433' href='#L_ANDXOR_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1434' href='#L_ANDXOR_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // A&(A^B) => A & ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1435' href='#L_ANDXOR_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1436' href='#L_ANDXOR_1436'><pre>1436</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> Value *tmpOp0 = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1437' href='#L_ANDXOR_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> Value *tmpOp1 = Op1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1438' href='#L_ANDXOR_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_OneUse(m_Xor(m_Value(A), m_Value(B))))<span class='tooltip-content'>155k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>951</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1439' href='#L_ANDXOR_1439'><pre>1439</pre></a></td><td class='covered-line'><pre>951</pre></td><td class='code'><pre> if (<div class='tooltip'>A == Op1 || <span class='tooltip-content'>951</span></div><div class='tooltip'>B == Op1<span class='tooltip-content'>951</span></div> ) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1440' href='#L_ANDXOR_1440'><pre>1440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> tmpOp1 = Op0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1441' href='#L_ANDXOR_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> tmpOp0 = Op1;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1442' href='#L_ANDXOR_1442'><pre>1442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplify below</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1443' href='#L_ANDXOR_1443'><pre>1443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1444' href='#L_ANDXOR_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>951</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1445' href='#L_ANDXOR_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1446' href='#L_ANDXOR_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(tmpOp1, m_OneUse(m_Xor(m_Value(A), m_Value(B))))<span class='tooltip-content'>155k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.82k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1447' href='#L_ANDXOR_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> if (<div class='tooltip'>B == tmpOp0<span class='tooltip-content'>2.82k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1448' href='#L_ANDXOR_1448'><pre>1448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1449' href='#L_ANDXOR_1449'><pre>1449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1450' href='#L_ANDXOR_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> // Notice that the pattern (A&(~B)) is actually (A&(-1^B)), so if</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1451' href='#L_ANDXOR_1451'><pre>1451</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> // A is originally -1 (or a vector of -1 and undefs), then we enter</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1452' href='#L_ANDXOR_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> // an endless loop. By checking that A is non-constant we ensure that</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1453' href='#L_ANDXOR_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> // we will never get to the loop.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1454' href='#L_ANDXOR_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> if (<div class='tooltip'>A == tmpOp0 && <span class='tooltip-content'>2.82k</span></div><div class='tooltip'><span class='red'>!isa<Constant>(A)</span><span class='tooltip-content'>0</span></div>) // A&(A^B) -> A & ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1455' href='#L_ANDXOR_1455'><pre>1455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, Builder->CreateNot(B))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1456' href='#L_ANDXOR_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>2.82k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1457' href='#L_ANDXOR_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1458' href='#L_ANDXOR_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1459' href='#L_ANDXOR_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // (A&((~A)|B)) -> A&B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1460' href='#L_ANDXOR_1460'><pre>1460</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op0, m_Or(m_Not(m_Specific(Op1)), m_Value(A))) ||<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1461' href='#L_ANDXOR_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> match(Op0, m_Or(m_Value(A), m_Not(m_Specific(Op1)))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1462' href='#L_ANDXOR_1462'><pre>1462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1463' href='#L_ANDXOR_1463'><pre>1463</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op1, m_Or(m_Not(m_Specific(Op0)), m_Value(A))) ||<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1464' href='#L_ANDXOR_1464'><pre>1464</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> match(Op1, m_Or(m_Value(A), m_Not(m_Specific(Op0)))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1465' href='#L_ANDXOR_1465'><pre>1465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, Op0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1466' href='#L_ANDXOR_1466'><pre>1466</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1467' href='#L_ANDXOR_1467'><pre>1467</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // (A ^ B) & ((B ^ C) ^ A) -> (A ^ B) & ~C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1468' href='#L_ANDXOR_1468'><pre>1468</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Value(A), m_Value(B)))<span class='tooltip-content'>155k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1469' href='#L_ANDXOR_1469'><pre>1469</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.93k</span></div><div class='tooltip'>match(Op1, m_Xor(m_Xor(m_Specific(B), m_Value(C)), m_Specific(A)))<span class='tooltip-content'>1.93k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1470' href='#L_ANDXOR_1470'><pre>1470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op1->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cast<BinaryOperator>(Op1)->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1471' href='#L_ANDXOR_1471'><pre>1471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateAnd(Op0, Builder->CreateNot(C))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1472' href='#L_ANDXOR_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1473' href='#L_ANDXOR_1473'><pre>1473</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // ((A ^ C) ^ B) & (B ^ A) -> (B ^ A) & ~C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1474' href='#L_ANDXOR_1474'><pre>1474</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Xor(m_Value(A), m_Value(C)), m_Value(B)))<span class='tooltip-content'>155k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1475' href='#L_ANDXOR_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>376</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>376</span></div><div class='tooltip'>match(Op1, m_Xor(m_Specific(B), m_Specific(A)))<span class='tooltip-content'>376</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1476' href='#L_ANDXOR_1476'><pre>1476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op0->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cast<BinaryOperator>(Op0)->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1477' href='#L_ANDXOR_1477'><pre>1477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateAnd(Op1, Builder->CreateNot(C))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1478' href='#L_ANDXOR_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1479' href='#L_ANDXOR_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // (A | B) & ((~A) ^ B) -> (A & B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1480' href='#L_ANDXOR_1480'><pre>1480</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op0, m_Or(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1481' href='#L_ANDXOR_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>8.18k</pre></td><td class='code'><pre> match(Op1, m_Xor(m_Not(m_Specific(A)), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1482' href='#L_ANDXOR_1482'><pre>1482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1483' href='#L_ANDXOR_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1484' href='#L_ANDXOR_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // ((~A) ^ B) & (A | B) -> (A & B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1485' href='#L_ANDXOR_1485'><pre>1485</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // ((~A) ^ B) & (B | A) -> (A & B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1486' href='#L_ANDXOR_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Not(m_Value(A)), m_Value(B))) &&<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1487' href='#L_ANDXOR_1487'><pre>1487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(Op1, m_c_Or(m_Specific(A), m_Specific(B)))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1488' href='#L_ANDXOR_1488'><pre>1488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1489' href='#L_ANDXOR_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1490' href='#L_ANDXOR_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1491' href='#L_ANDXOR_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1492' href='#L_ANDXOR_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1493' href='#L_ANDXOR_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1494' href='#L_ANDXOR_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS && <span class='tooltip-content'>155k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>27.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1495' href='#L_ANDXOR_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>24.4k</span></div><div class='tooltip'>Res<span class='tooltip-content'>24.4k</span></div> = FoldAndOfICmps(LHS, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1496' href='#L_ANDXOR_1496'><pre>1496</pre></a></td><td class='covered-line'><pre>426</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Res);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1497' href='#L_ANDXOR_1497'><pre>1497</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1498' href='#L_ANDXOR_1498'><pre>1498</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // TODO: Make this recursive; it's a little tricky because an arbitrary</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1499' href='#L_ANDXOR_1499'><pre>1499</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // number of 'and' instructions might have to be created.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1500' href='#L_ANDXOR_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> Value *X, *Y;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1501' href='#L_ANDXOR_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS && <span class='tooltip-content'>154k</span></div><div class='tooltip'>match(Op1, m_OneUse(m_And(m_Value(X), m_Value(Y))))<span class='tooltip-content'>26.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>787</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1502' href='#L_ANDXOR_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>787</pre></td><td class='code'><pre> if (auto *Cmp = dyn_cast<ICmpInst>(X))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1503' href='#L_ANDXOR_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>730</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>730</span></div><div class='tooltip'>Res<span class='tooltip-content'>730</span></div> = FoldAndOfICmps(LHS, Cmp))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1504' href='#L_ANDXOR_1504'><pre>1504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, Builder->CreateAnd(Res, Y))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1505' href='#L_ANDXOR_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>787</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>787</span></div><div class='tooltip'>Cmp<span class='tooltip-content'>787</span></div> = dyn_cast<ICmpInst>(Y))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1506' href='#L_ANDXOR_1506'><pre>1506</pre></a></td><td class='covered-line'><pre>657</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>657</span></div><div class='tooltip'>Res<span class='tooltip-content'>657</span></div> = FoldAndOfICmps(LHS, Cmp))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1507' href='#L_ANDXOR_1507'><pre>1507</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateAnd(Res, X));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1508' href='#L_ANDXOR_1508'><pre>1508</pre></a></td><td class='covered-line'><pre>787</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1509' href='#L_ANDXOR_1509'><pre>1509</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>154k</span></div><div class='tooltip'>RHS && <span class='tooltip-content'>154k</span></div><div class='tooltip'>match(Op0, m_OneUse(m_And(m_Value(X), m_Value(Y))))<span class='tooltip-content'>26.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.52k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1510' href='#L_ANDXOR_1510'><pre>1510</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> if (auto *Cmp = dyn_cast<ICmpInst>(X))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1511' href='#L_ANDXOR_1511'><pre>1511</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>1.08k</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.08k</span></div> = FoldAndOfICmps(Cmp, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1512' href='#L_ANDXOR_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateAnd(Res, Y));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1513' href='#L_ANDXOR_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>1.51k</span></div><div class='tooltip'>Cmp<span class='tooltip-content'>1.51k</span></div> = dyn_cast<ICmpInst>(Y))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1514' href='#L_ANDXOR_1514'><pre>1514</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>1.47k</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.47k</span></div> = FoldAndOfICmps(Cmp, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1515' href='#L_ANDXOR_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateAnd(Res, X));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1516' href='#L_ANDXOR_1516'><pre>1516</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1517' href='#L_ANDXOR_1517'><pre>1517</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1518' href='#L_ANDXOR_1518'><pre>1518</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1519' href='#L_ANDXOR_1519'><pre>1519</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> // If and'ing two fcmp, try combine them into one.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1520' href='#L_ANDXOR_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>if (FCmpInst *<span class='tooltip-content'>154k</span></div><div class='tooltip'>LHS<span class='tooltip-content'>154k</span></div> = dyn_cast<FCmpInst>(I.getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1521' href='#L_ANDXOR_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>815</pre></td><td class='code'><pre> <div class='tooltip'>if (FCmpInst *<span class='tooltip-content'>815</span></div><div class='tooltip'>RHS<span class='tooltip-content'>815</span></div> = dyn_cast<FCmpInst>(I.getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1522' href='#L_ANDXOR_1522'><pre>1522</pre></a></td><td class='covered-line'><pre>486</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>486</span></div><div class='tooltip'>Res<span class='tooltip-content'>486</span></div> = FoldAndOfFCmps(LHS, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1523' href='#L_ANDXOR_1523'><pre>1523</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Res);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1524' href='#L_ANDXOR_1524'><pre>1524</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1525' href='#L_ANDXOR_1525'><pre>1525</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>154k</span></div><div class='tooltip'>CastedAnd<span class='tooltip-content'>154k</span></div> = foldCastedBitwiseLogic(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1526' href='#L_ANDXOR_1526'><pre>1526</pre></a></td><td class='covered-line'><pre>541</pre></td><td class='code'><pre> return CastedAnd;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1527' href='#L_ANDXOR_1527'><pre>1527</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1528' href='#L_ANDXOR_1528'><pre>1528</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>154k</span></div><div class='tooltip'>Select<span class='tooltip-content'>154k</span></div> = foldBoolSextMaskToSelect(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1529' href='#L_ANDXOR_1529'><pre>1529</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return Select;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1530' href='#L_ANDXOR_1530'><pre>1530</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1531' href='#L_ANDXOR_1531'><pre>1531</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>154k</span></div><div class='tooltip'>&I<span class='tooltip-content'>1.40k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>152k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1532' href='#L_ANDXOR_1532'><pre>1532</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1533' href='#L_ANDXOR_1533'><pre>1533</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1534' href='#L_ANDXOR_1534'><pre>1534</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given an OR instruction, check to see if this is a bswap idiom. If so,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1535' href='#L_ANDXOR_1535'><pre>1535</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// insert the new intrinsic and return it.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1536' href='#L_ANDXOR_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre>Instruction *InstCombiner::MatchBSwap(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1537' href='#L_ANDXOR_1537'><pre>1537</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1538' href='#L_ANDXOR_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1539' href='#L_ANDXOR_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Look through zero extends.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1540' href='#L_ANDXOR_1540'><pre>1540</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (Instruction *Ext = dyn_cast<ZExtInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1541' href='#L_ANDXOR_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>621</pre></td><td class='code'><pre> Op0 = Ext->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1542' href='#L_ANDXOR_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1543' href='#L_ANDXOR_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (Instruction *Ext = dyn_cast<ZExtInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1544' href='#L_ANDXOR_1544'><pre>1544</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> Op1 = Ext->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1545' href='#L_ANDXOR_1545'><pre>1545</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1546' href='#L_ANDXOR_1546'><pre>1546</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A | B) | C and A | (B | C) -> bswap if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1547' href='#L_ANDXOR_1547'><pre>1547</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> bool OrOfOrs = match(Op0, m_Or(m_Value(), m_Value())) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1548' href='#L_ANDXOR_1548'><pre>1548</pre></a></td><td class='covered-line'><pre>94.7k</pre></td><td class='code'><pre> match(Op1, m_Or(m_Value(), m_Value()));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1549' href='#L_ANDXOR_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1550' href='#L_ANDXOR_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A >> B) | (C << D) and (A << B) | (B >> C) -> bswap if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1551' href='#L_ANDXOR_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> bool OrOfShifts = match(Op0, m_LogicalShift(m_Value(), m_Value())) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1552' href='#L_ANDXOR_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> match(Op1, m_LogicalShift(m_Value(), m_Value()));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1553' href='#L_ANDXOR_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1554' href='#L_ANDXOR_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & B) | (C & D) -> bswap if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1555' href='#L_ANDXOR_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> bool OrOfAnds = match(Op0, m_And(m_Value(), m_Value())) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1556' href='#L_ANDXOR_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>23.5k</pre></td><td class='code'><pre> match(Op1, m_And(m_Value(), m_Value()));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1557' href='#L_ANDXOR_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1558' href='#L_ANDXOR_1558'><pre>1558</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (<div class='tooltip'>!OrOfOrs && <span class='tooltip-content'>100k</span></div><div class='tooltip'>!OrOfShifts<span class='tooltip-content'>93.5k</span></div> && <div class='tooltip'>!OrOfAnds<span class='tooltip-content'>86.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1559' href='#L_ANDXOR_1559'><pre>1559</pre></a></td><td class='covered-line'><pre>71.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1560' href='#L_ANDXOR_1560'><pre>1560</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1561' href='#L_ANDXOR_1561'><pre>1561</pre></a></td><td class='covered-line'><pre>29.3k</pre></td><td class='code'><pre> SmallVector<Instruction*, 4> Insts;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1562' href='#L_ANDXOR_1562'><pre>1562</pre></a></td><td class='covered-line'><pre>29.3k</pre></td><td class='code'><pre> if (!recognizeBSwapOrBitReverseIdiom(&I, true, false, Insts))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1563' href='#L_ANDXOR_1563'><pre>1563</pre></a></td><td class='covered-line'><pre>29.3k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1564' href='#L_ANDXOR_1564'><pre>1564</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Instruction *LastInst = Insts.pop_back_val();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1565' href='#L_ANDXOR_1565'><pre>1565</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> LastInst->removeFromParent();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1566' href='#L_ANDXOR_1566'><pre>1566</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1567' href='#L_ANDXOR_1567'><pre>1567</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> for (auto *Inst : Insts)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1568' href='#L_ANDXOR_1568'><pre>1568</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Worklist.Add(Inst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1569' href='#L_ANDXOR_1569'><pre>1569</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return LastInst;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1570' href='#L_ANDXOR_1570'><pre>1570</pre></a></td><td class='covered-line'><pre>29.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1571' href='#L_ANDXOR_1571'><pre>1571</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1572' href='#L_ANDXOR_1572'><pre>1572</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If all elements of two constant vectors are 0/-1 and inverses, return true.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1573' href='#L_ANDXOR_1573'><pre>1573</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre>static bool areInverseVectorBitmasks(Constant *C1, Constant *C2) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1574' href='#L_ANDXOR_1574'><pre>1574</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> unsigned NumElts = C1->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1575' href='#L_ANDXOR_1575'><pre>1575</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i != NumElts<span class='tooltip-content'>16</span></div>; <div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1576' href='#L_ANDXOR_1576'><pre>1576</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Constant *EltC1 = C1->getAggregateElement(i);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1577' href='#L_ANDXOR_1577'><pre>1577</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Constant *EltC2 = C2->getAggregateElement(i);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1578' href='#L_ANDXOR_1578'><pre>1578</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (<div class='tooltip'>!EltC1 || <span class='tooltip-content'>16</span></div><div class='tooltip'>!EltC2<span class='tooltip-content'>16</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1579' href='#L_ANDXOR_1579'><pre>1579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1580' href='#L_ANDXOR_1580'><pre>1580</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1581' href='#L_ANDXOR_1581'><pre>1581</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // One element must be all ones, and the other must be all zeros.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1582' href='#L_ANDXOR_1582'><pre>1582</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // FIXME: Allow undef elements.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1583' href='#L_ANDXOR_1583'><pre>1583</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16</span></div><div class='tooltip'>!((match(EltC1, m_Zero()) && <span class='tooltip-content'>16</span></div><div class='tooltip'><span class='red'>match(EltC2, m_AllOnes())</span><span class='tooltip-content'>0</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1584' href='#L_ANDXOR_1584'><pre>1584</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>(match(EltC2, m_Zero()) && <span class='tooltip-content'>16</span></div><div class='tooltip'><span class='red'>match(EltC1, m_AllOnes())</span><span class='tooltip-content'>0</span></div>)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1585' href='#L_ANDXOR_1585'><pre>1585</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1586' href='#L_ANDXOR_1586'><pre>1586</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1587' href='#L_ANDXOR_1587'><pre>1587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1588' href='#L_ANDXOR_1588'><pre>1588</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1589' href='#L_ANDXOR_1589'><pre>1589</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1590' href='#L_ANDXOR_1590'><pre>1590</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We have an expression of the form (A & C) | (B & D). If A is a scalar or</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1591' href='#L_ANDXOR_1591'><pre>1591</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// vector composed of all-zeros or all-ones values and is the bitwise 'not' of</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1592' href='#L_ANDXOR_1592'><pre>1592</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// B, it can be used as the condition operand of a select instruction.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1593' href='#L_ANDXOR_1593'><pre>1593</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *getSelectCondition(Value *A, Value *B,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1594' href='#L_ANDXOR_1594'><pre>1594</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1595' href='#L_ANDXOR_1595'><pre>1595</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // If these are scalars or vectors of i1, A can be used directly.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1596' href='#L_ANDXOR_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> Type *Ty = A->getType();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1597' href='#L_ANDXOR_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(A, m_Not(m_Specific(B))) && <span class='tooltip-content'>122k</span></div><div class='tooltip'>Ty->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>25</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1598' href='#L_ANDXOR_1598'><pre>1598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return A</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1599' href='#L_ANDXOR_1599'><pre>1599</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1600' href='#L_ANDXOR_1600'><pre>1600</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // If A and B are sign-extended, look through the sexts to find the booleans.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1601' href='#L_ANDXOR_1601'><pre>1601</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> Value *Cond;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1602' href='#L_ANDXOR_1602'><pre>1602</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> if (match(A, m_SExt(m_Value(Cond))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1603' href='#L_ANDXOR_1603'><pre>1603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Cond->getType()->getScalarType()->isIntegerTy(1)</span> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1604' href='#L_ANDXOR_1604'><pre>1604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(B, m_CombineOr(m_Not(m_SExt(m_Specific(Cond))),</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1605' href='#L_ANDXOR_1605'><pre>1605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> m_SExt(m_Not(m_Specific(Cond)))))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1606' href='#L_ANDXOR_1606'><pre>1606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Cond</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1607' href='#L_ANDXOR_1607'><pre>1607</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1608' href='#L_ANDXOR_1608'><pre>1608</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // All scalar (and most vector) possibilities should be handled now.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1609' href='#L_ANDXOR_1609'><pre>1609</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // Try more matches that only apply to non-splat constant vectors.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1610' href='#L_ANDXOR_1610'><pre>1610</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>122k</span></div><div class='tooltip'>!Ty->isVectorTy()<span class='tooltip-content'>122k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1611' href='#L_ANDXOR_1611'><pre>1611</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1612' href='#L_ANDXOR_1612'><pre>1612</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1613' href='#L_ANDXOR_1613'><pre>1613</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // If both operands are constants, see if the constants are inverse bitmasks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1614' href='#L_ANDXOR_1614'><pre>1614</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Constant *AC, *BC;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1615' href='#L_ANDXOR_1615'><pre>1615</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> if (<div class='tooltip'>match(A, m_Constant(AC)) && <span class='tooltip-content'>64</span></div><div class='tooltip'>match(B, m_Constant(BC))<span class='tooltip-content'>32</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1616' href='#L_ANDXOR_1616'><pre>1616</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> areInverseVectorBitmasks(AC, BC))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1617' href='#L_ANDXOR_1617'><pre>1617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return ConstantExpr::getTrunc(AC, CmpInst::makeCmpResultType(Ty))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1618' href='#L_ANDXOR_1618'><pre>1618</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1619' href='#L_ANDXOR_1619'><pre>1619</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // If both operands are xor'd with constants using the same sexted boolean</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1620' href='#L_ANDXOR_1620'><pre>1620</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // operand, see if the constants are inverse bitmasks.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1621' href='#L_ANDXOR_1621'><pre>1621</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>64</span></div><div class='tooltip'>match(A, (m_Xor(m_SExt(m_Value(Cond)), m_Constant(AC)))) &&<span class='tooltip-content'>64</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1622' href='#L_ANDXOR_1622'><pre>1622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(B, (m_Xor(m_SExt(m_Specific(Cond)), m_Constant(BC))))</span> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1623' href='#L_ANDXOR_1623'><pre>1623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Cond->getType()->getScalarType()->isIntegerTy(1)</span> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1624' href='#L_ANDXOR_1624'><pre>1624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>areInverseVectorBitmasks(AC, BC)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1625' href='#L_ANDXOR_1625'><pre>1625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AC = ConstantExpr::getTrunc(AC, CmpInst::makeCmpResultType(Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1626' href='#L_ANDXOR_1626'><pre>1626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateXor(Cond, AC);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1627' href='#L_ANDXOR_1627'><pre>1627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1628' href='#L_ANDXOR_1628'><pre>1628</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1629' href='#L_ANDXOR_1629'><pre>1629</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1630' href='#L_ANDXOR_1630'><pre>1630</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1631' href='#L_ANDXOR_1631'><pre>1631</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We have an expression of the form (A & C) | (B & D). Try to simplify this</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1632' href='#L_ANDXOR_1632'><pre>1632</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to "A' ? C : D", where A' is a boolean or vector of booleans.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1633' href='#L_ANDXOR_1633'><pre>1633</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *matchSelectFromAndOr(Value *A, Value *C, Value *B, Value *D,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1634' href='#L_ANDXOR_1634'><pre>1634</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1635' href='#L_ANDXOR_1635'><pre>1635</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // The potential condition of the select may be bitcasted. In that case, look</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1636' href='#L_ANDXOR_1636'><pre>1636</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> // through its bitcast and the corresponding bitcast of the 'not' condition.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1637' href='#L_ANDXOR_1637'><pre>1637</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> Type *OrigType = A->getType();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1638' href='#L_ANDXOR_1638'><pre>1638</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> Value *SrcA, *SrcB;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1639' href='#L_ANDXOR_1639'><pre>1639</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> if (match(A, m_OneUse(m_BitCast(m_Value(SrcA)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1640' href='#L_ANDXOR_1640'><pre>1640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(B, m_OneUse(m_BitCast(m_Value(SrcB))))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1641' href='#L_ANDXOR_1641'><pre>1641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> A = SrcA;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1642' href='#L_ANDXOR_1642'><pre>1642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B = SrcB;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1643' href='#L_ANDXOR_1643'><pre>1643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1644' href='#L_ANDXOR_1644'><pre>1644</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1645' href='#L_ANDXOR_1645'><pre>1645</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>Cond<span class='tooltip-content'>122k</span></div> = getSelectCondition(A, B, Builder)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1646' href='#L_ANDXOR_1646'><pre>1646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((bc Cond) & C) | ((bc ~Cond) & D) --> bc (select Cond, (bc C), (bc D))</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1647' href='#L_ANDXOR_1647'><pre>1647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The bitcasts will either all exist or all not exist. The builder will</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1648' href='#L_ANDXOR_1648'><pre>1648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // not create unnecessary casts if the types already match.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1649' href='#L_ANDXOR_1649'><pre>1649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *BitcastC = Builder.CreateBitCast(C, A->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1650' href='#L_ANDXOR_1650'><pre>1650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *BitcastD = Builder.CreateBitCast(D, A->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1651' href='#L_ANDXOR_1651'><pre>1651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Select = Builder.CreateSelect(Cond, BitcastC, BitcastD);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1652' href='#L_ANDXOR_1652'><pre>1652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateBitCast(Select, OrigType);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1653' href='#L_ANDXOR_1653'><pre>1653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1654' href='#L_ANDXOR_1654'><pre>1654</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1655' href='#L_ANDXOR_1655'><pre>1655</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1656' href='#L_ANDXOR_1656'><pre>1656</pre></a></td><td class='covered-line'><pre>122k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1657' href='#L_ANDXOR_1657'><pre>1657</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1658' href='#L_ANDXOR_1658'><pre>1658</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold (icmp)|(icmp) if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1659' href='#L_ANDXOR_1659'><pre>1659</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1660' href='#L_ANDXOR_1660'><pre>1660</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1661' href='#L_ANDXOR_1661'><pre>1661</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1662' href='#L_ANDXOR_1662'><pre>1662</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1663' href='#L_ANDXOR_1663'><pre>1663</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // Fold (iszero(A & K1) | iszero(A & K2)) -> (A & (K1 | K2)) != (K1 | K2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1664' href='#L_ANDXOR_1664'><pre>1664</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // if K1 and K2 are a one-bit mask.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1665' href='#L_ANDXOR_1665'><pre>1665</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> ConstantInt *LHSCst = dyn_cast<ConstantInt>(LHS->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1666' href='#L_ANDXOR_1666'><pre>1666</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> ConstantInt *RHSCst = dyn_cast<ConstantInt>(RHS->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1667' href='#L_ANDXOR_1667'><pre>1667</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1668' href='#L_ANDXOR_1668'><pre>1668</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS->getPredicate() == ICmpInst::ICMP_EQ && <span class='tooltip-content'>29.7k</span></div><div class='tooltip'>LHSCst<span class='tooltip-content'>20.8k</span></div> && <div class='tooltip'>LHSCst->isZero()<span class='tooltip-content'>5.52k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1669' href='#L_ANDXOR_1669'><pre>1669</pre></a></td><td class='covered-line'><pre>2.88k</pre></td><td class='code'><pre> <div class='tooltip'>RHS->getPredicate() == ICmpInst::ICMP_EQ<span class='tooltip-content'>2.88k</span></div> && <div class='tooltip'>RHSCst<span class='tooltip-content'>1.67k</span></div> && <div class='tooltip'>RHSCst->isZero()<span class='tooltip-content'>812</span></div>) <div class='tooltip'>{<span class='tooltip-content'>551</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1670' href='#L_ANDXOR_1670'><pre>1670</pre></a></td><td class='covered-line'><pre>551</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1671' href='#L_ANDXOR_1671'><pre>1671</pre></a></td><td class='covered-line'><pre>551</pre></td><td class='code'><pre> BinaryOperator *LAnd = dyn_cast<BinaryOperator>(LHS->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1672' href='#L_ANDXOR_1672'><pre>1672</pre></a></td><td class='covered-line'><pre>551</pre></td><td class='code'><pre> BinaryOperator *RAnd = dyn_cast<BinaryOperator>(RHS->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1673' href='#L_ANDXOR_1673'><pre>1673</pre></a></td><td class='covered-line'><pre>551</pre></td><td class='code'><pre> if (<div class='tooltip'>LAnd && <span class='tooltip-content'>551</span></div><div class='tooltip'>RAnd<span class='tooltip-content'>98</span></div> && <div class='tooltip'>LAnd->hasOneUse()<span class='tooltip-content'>52</span></div> && <div class='tooltip'>RHS->hasOneUse()<span class='tooltip-content'>5</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1674' href='#L_ANDXOR_1674'><pre>1674</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> LAnd->getOpcode() == Instruction::And &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1675' href='#L_ANDXOR_1675'><pre>1675</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>RAnd->getOpcode() == Instruction::And<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1676' href='#L_ANDXOR_1676'><pre>1676</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1677' href='#L_ANDXOR_1677'><pre>1677</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *Mask = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1678' href='#L_ANDXOR_1678'><pre>1678</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *Masked = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1679' href='#L_ANDXOR_1679'><pre>1679</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (LAnd->getOperand(0) == RAnd->getOperand(0) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1680' href='#L_ANDXOR_1680'><pre>1680</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> isKnownToBeAPowerOfTwo(LAnd->getOperand(1), DL, false, 0, &AC, CxtI,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1681' href='#L_ANDXOR_1681'><pre>1681</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> &DT) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1682' href='#L_ANDXOR_1682'><pre>1682</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> isKnownToBeAPowerOfTwo(RAnd->getOperand(1), DL, false, 0, &AC, CxtI,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1683' href='#L_ANDXOR_1683'><pre>1683</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> &DT)) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1684' href='#L_ANDXOR_1684'><pre>1684</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Mask = Builder->CreateOr(LAnd->getOperand(1), RAnd->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1685' href='#L_ANDXOR_1685'><pre>1685</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Masked = Builder->CreateAnd(LAnd->getOperand(0), Mask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1686' href='#L_ANDXOR_1686'><pre>1686</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>LAnd->getOperand(1) == RAnd->getOperand(1) &&<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1687' href='#L_ANDXOR_1687'><pre>1687</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> isKnownToBeAPowerOfTwo(LAnd->getOperand(0), DL, false, 0, &AC,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1688' href='#L_ANDXOR_1688'><pre>1688</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> CxtI, &DT) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1689' href='#L_ANDXOR_1689'><pre>1689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>isKnownToBeAPowerOfTwo(RAnd->getOperand(0), DL, false, 0, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1690' href='#L_ANDXOR_1690'><pre>1690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CxtI, &DT)</span>) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1691' href='#L_ANDXOR_1691'><pre>1691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask = Builder->CreateOr(LAnd->getOperand(0), RAnd->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1692' href='#L_ANDXOR_1692'><pre>1692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Masked = Builder->CreateAnd(LAnd->getOperand(1), Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1693' href='#L_ANDXOR_1693'><pre>1693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1694' href='#L_ANDXOR_1694'><pre>1694</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1695' href='#L_ANDXOR_1695'><pre>1695</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (Masked)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1696' href='#L_ANDXOR_1696'><pre>1696</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return Builder->CreateICmp(ICmpInst::ICMP_NE, Masked, Mask);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1697' href='#L_ANDXOR_1697'><pre>1697</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1698' href='#L_ANDXOR_1698'><pre>1698</pre></a></td><td class='covered-line'><pre>551</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1699' href='#L_ANDXOR_1699'><pre>1699</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1700' href='#L_ANDXOR_1700'><pre>1700</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // Fold (icmp ult/ule (A + C1), C3) | (icmp ult/ule (A + C2), C3)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1701' href='#L_ANDXOR_1701'><pre>1701</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // --> (icmp ult/ule ((A & ~(C1 ^ C2)) + max(C1, C2)), C3)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1702' href='#L_ANDXOR_1702'><pre>1702</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // The original condition actually refers to the following two ranges:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1703' href='#L_ANDXOR_1703'><pre>1703</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // [MAX_UINT-C1+1, MAX_UINT-C1+1+C3] and [MAX_UINT-C2+1, MAX_UINT-C2+1+C3]</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1704' href='#L_ANDXOR_1704'><pre>1704</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // We can fold these two ranges if:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1705' href='#L_ANDXOR_1705'><pre>1705</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // 1) C1 and C2 is unsigned greater than C3.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1706' href='#L_ANDXOR_1706'><pre>1706</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // 2) The two ranges are separated.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1707' href='#L_ANDXOR_1707'><pre>1707</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // 3) C1 ^ C2 is one-bit mask.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1708' href='#L_ANDXOR_1708'><pre>1708</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // 4) LowRange1 ^ LowRange2 and HighRange1 ^ HighRange2 are one-bit mask.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1709' href='#L_ANDXOR_1709'><pre>1709</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // This implies all values in the two ranges differ by exactly one bit.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1710' href='#L_ANDXOR_1710'><pre>1710</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1711' href='#L_ANDXOR_1711'><pre>1711</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>29.7k</span></div><div class='tooltip'>(LHSCC == ICmpInst::ICMP_ULT || <span class='tooltip-content'>29.7k</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_ULE<span class='tooltip-content'>28.7k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1712' href='#L_ANDXOR_1712'><pre>1712</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> <div class='tooltip'>LHSCC == RHSCC<span class='tooltip-content'>1.11k</span></div> && <div class='tooltip'>LHSCst<span class='tooltip-content'>236</span></div> && <div class='tooltip'>RHSCst<span class='tooltip-content'>178</span></div> && <div class='tooltip'>LHS->hasOneUse()<span class='tooltip-content'>50</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1713' href='#L_ANDXOR_1713'><pre>1713</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> <div class='tooltip'>RHS->hasOneUse()<span class='tooltip-content'>49</span></div> && <div class='tooltip'>LHSCst->getType() == RHSCst->getType()<span class='tooltip-content'>49</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1714' href='#L_ANDXOR_1714'><pre>1714</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> <div class='tooltip'>LHSCst->getValue() == (RHSCst->getValue())<span class='tooltip-content'>49</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1715' href='#L_ANDXOR_1715'><pre>1715</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1716' href='#L_ANDXOR_1716'><pre>1716</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *LAdd = LHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1717' href='#L_ANDXOR_1717'><pre>1717</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *RAdd = RHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1718' href='#L_ANDXOR_1718'><pre>1718</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1719' href='#L_ANDXOR_1719'><pre>1719</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *LAddOpnd, *RAddOpnd;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1720' href='#L_ANDXOR_1720'><pre>1720</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt *LAddCst, *RAddCst;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1721' href='#L_ANDXOR_1721'><pre>1721</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (match(LAdd, m_Add(m_Value(LAddOpnd), m_ConstantInt(LAddCst))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1722' href='#L_ANDXOR_1722'><pre>1722</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> match(RAdd, m_Add(m_Value(RAddOpnd), m_ConstantInt(RAddCst))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1723' href='#L_ANDXOR_1723'><pre>1723</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> LAddCst->getValue().ugt(LHSCst->getValue()) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1724' href='#L_ANDXOR_1724'><pre>1724</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>RAddCst->getValue().ugt(LHSCst->getValue())<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1725' href='#L_ANDXOR_1725'><pre>1725</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1726' href='#L_ANDXOR_1726'><pre>1726</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt DiffCst = LAddCst->getValue() ^ RAddCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1727' href='#L_ANDXOR_1727'><pre>1727</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>LAddOpnd == RAddOpnd && <span class='tooltip-content'>1</span></div><div class='tooltip'>DiffCst.isPowerOf2()<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1728' href='#L_ANDXOR_1728'><pre>1728</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt *MaxAddCst = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1729' href='#L_ANDXOR_1729'><pre>1729</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (LAddCst->getValue().ult(RAddCst->getValue()))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1730' href='#L_ANDXOR_1730'><pre>1730</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> MaxAddCst = RAddCst;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1731' href='#L_ANDXOR_1731'><pre>1731</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1732' href='#L_ANDXOR_1732'><pre>1732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>MaxAddCst = LAddCst</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1733' href='#L_ANDXOR_1733'><pre>1733</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1734' href='#L_ANDXOR_1734'><pre>1734</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt RRangeLow = -RAddCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1735' href='#L_ANDXOR_1735'><pre>1735</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt RRangeHigh = RRangeLow + LHSCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1736' href='#L_ANDXOR_1736'><pre>1736</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt LRangeLow = -LAddCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1737' href='#L_ANDXOR_1737'><pre>1737</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt LRangeHigh = LRangeLow + LHSCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1738' href='#L_ANDXOR_1738'><pre>1738</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt LowRangeDiff = RRangeLow ^ LRangeLow;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1739' href='#L_ANDXOR_1739'><pre>1739</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt HighRangeDiff = RRangeHigh ^ LRangeHigh;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1740' href='#L_ANDXOR_1740'><pre>1740</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt RangeDiff = LRangeLow.sgt(RRangeLow) ? LRangeLow - RRangeLow</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1741' href='#L_ANDXOR_1741'><pre>1741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>RRangeLow - LRangeLow</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1742' href='#L_ANDXOR_1742'><pre>1742</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1743' href='#L_ANDXOR_1743'><pre>1743</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>LowRangeDiff.isPowerOf2() && <span class='tooltip-content'>1</span></div><div class='tooltip'>LowRangeDiff == HighRangeDiff<span class='tooltip-content'>1</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1744' href='#L_ANDXOR_1744'><pre>1744</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>RangeDiff.ugt(LHSCst->getValue())<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1745' href='#L_ANDXOR_1745'><pre>1745</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *MaskCst = ConstantInt::get(LAddCst->getType(), ~DiffCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1746' href='#L_ANDXOR_1746'><pre>1746</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1747' href='#L_ANDXOR_1747'><pre>1747</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(LAddOpnd, MaskCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1748' href='#L_ANDXOR_1748'><pre>1748</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateAdd(NewAnd, MaxAddCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1749' href='#L_ANDXOR_1749'><pre>1749</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return (Builder->CreateICmp(LHS->getPredicate(), NewAdd, LHSCst));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1750' href='#L_ANDXOR_1750'><pre>1750</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1751' href='#L_ANDXOR_1751'><pre>1751</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1752' href='#L_ANDXOR_1752'><pre>1752</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1753' href='#L_ANDXOR_1753'><pre>1753</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1754' href='#L_ANDXOR_1754'><pre>1754</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1755' href='#L_ANDXOR_1755'><pre>1755</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // (icmp1 A, B) | (icmp2 A, B) --> (icmp3 A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1756' href='#L_ANDXOR_1756'><pre>1756</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>29.7k</span></div><div class='tooltip'>PredicatesFoldable(LHSCC, RHSCC)<span class='tooltip-content'>29.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>29.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1757' href='#L_ANDXOR_1757'><pre>1757</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(1) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1758' href='#L_ANDXOR_1758'><pre>1758</pre></a></td><td class='covered-line'><pre>980</pre></td><td class='code'><pre> LHS->getOperand(1) == RHS->getOperand(0))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1759' href='#L_ANDXOR_1759'><pre>1759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHS->swapOperands()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1760' href='#L_ANDXOR_1760'><pre>1760</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(0) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1761' href='#L_ANDXOR_1761'><pre>1761</pre></a></td><td class='covered-line'><pre>3.22k</pre></td><td class='code'><pre> <div class='tooltip'>LHS->getOperand(1) == RHS->getOperand(1)<span class='tooltip-content'>3.22k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1762' href='#L_ANDXOR_1762'><pre>1762</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1763' href='#L_ANDXOR_1763'><pre>1763</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned Code = getICmpCode(LHS) | getICmpCode(RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1764' href='#L_ANDXOR_1764'><pre>1764</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> bool isSigned = LHS->isSigned() || RHS->isSigned();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1765' href='#L_ANDXOR_1765'><pre>1765</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return getNewICmpValue(isSigned, Code, Op0, Op1, Builder);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1766' href='#L_ANDXOR_1766'><pre>1766</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1767' href='#L_ANDXOR_1767'><pre>1767</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1768' href='#L_ANDXOR_1768'><pre>1768</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1769' href='#L_ANDXOR_1769'><pre>1769</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // handle (roughly):</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1770' href='#L_ANDXOR_1770'><pre>1770</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> // (icmp ne (A & B), C) | (icmp ne (A & D), E)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1771' href='#L_ANDXOR_1771'><pre>1771</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>29.7k</span></div><div class='tooltip'>V<span class='tooltip-content'>29.7k</span></div> = foldLogOpOfMaskedICmps(LHS, RHS, false, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1772' href='#L_ANDXOR_1772'><pre>1772</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1773' href='#L_ANDXOR_1773'><pre>1773</pre></a></td><td class='covered-line'><pre>29.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1774' href='#L_ANDXOR_1774'><pre>1774</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre> Value *Val = LHS->getOperand(0), *Val2 = RHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1775' href='#L_ANDXOR_1775'><pre>1775</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS->hasOneUse() || <span class='tooltip-content'>29.6k</span></div><div class='tooltip'>RHS->hasOneUse()<span class='tooltip-content'>5.59k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1776' href='#L_ANDXOR_1776'><pre>1776</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> // (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1777' href='#L_ANDXOR_1777'><pre>1777</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> // (icmp eq B, 0) | (icmp ugt B, A) -> (icmp ule A, B-1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1778' href='#L_ANDXOR_1778'><pre>1778</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1779' href='#L_ANDXOR_1779'><pre>1779</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSCC == ICmpInst::ICMP_EQ && <span class='tooltip-content'>28.4k</span></div><div class='tooltip'>LHSCst<span class='tooltip-content'>19.8k</span></div> && <div class='tooltip'>LHSCst->isZero()<span class='tooltip-content'>5.10k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.57k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1780' href='#L_ANDXOR_1780'><pre>1780</pre></a></td><td class='covered-line'><pre>2.57k</pre></td><td class='code'><pre> B = Val;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1781' href='#L_ANDXOR_1781'><pre>1781</pre></a></td><td class='covered-line'><pre>2.57k</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSCC == ICmpInst::ICMP_ULT && <span class='tooltip-content'>2.57k</span></div><div class='tooltip'>Val == RHS->getOperand(1)<span class='tooltip-content'>107</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1782' href='#L_ANDXOR_1782'><pre>1782</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> A = Val2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1783' href='#L_ANDXOR_1783'><pre>1783</pre></a></td><td class='covered-line'><pre>2.56k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>2.56k</span></div><div class='tooltip'>RHSCC == ICmpInst::ICMP_UGT && <span class='tooltip-content'>2.56k</span></div><div class='tooltip'>Val == Val2<span class='tooltip-content'>217</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1784' href='#L_ANDXOR_1784'><pre>1784</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> A = RHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1785' href='#L_ANDXOR_1785'><pre>1785</pre></a></td><td class='covered-line'><pre>2.57k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1786' href='#L_ANDXOR_1786'><pre>1786</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> // (icmp ult A, B) | (icmp eq B, 0) -> (icmp ule A, B-1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1787' href='#L_ANDXOR_1787'><pre>1787</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> // (icmp ugt B, A) | (icmp eq B, 0) -> (icmp ule A, B-1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1788' href='#L_ANDXOR_1788'><pre>1788</pre></a></td><td class='covered-line'><pre>25.8k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>25.8k</span></div><div class='tooltip'>RHSCC == ICmpInst::ICMP_EQ && <span class='tooltip-content'>25.8k</span></div><div class='tooltip'>RHSCst<span class='tooltip-content'>17.6k</span></div> && <div class='tooltip'>RHSCst->isZero()<span class='tooltip-content'>6.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.45k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1789' href='#L_ANDXOR_1789'><pre>1789</pre></a></td><td class='covered-line'><pre>5.45k</pre></td><td class='code'><pre> B = Val2;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1790' href='#L_ANDXOR_1790'><pre>1790</pre></a></td><td class='covered-line'><pre>5.45k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSCC == ICmpInst::ICMP_ULT && <span class='tooltip-content'>5.45k</span></div><div class='tooltip'>Val2 == LHS->getOperand(1)<span class='tooltip-content'>171</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1791' href='#L_ANDXOR_1791'><pre>1791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>A = Val</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1792' href='#L_ANDXOR_1792'><pre>1792</pre></a></td><td class='covered-line'><pre>5.45k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>5.45k</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_UGT && <span class='tooltip-content'>5.45k</span></div><div class='tooltip'>Val2 == Val<span class='tooltip-content'>196</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1793' href='#L_ANDXOR_1793'><pre>1793</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> A = LHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1794' href='#L_ANDXOR_1794'><pre>1794</pre></a></td><td class='covered-line'><pre>5.45k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1795' href='#L_ANDXOR_1795'><pre>1795</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>A && <span class='tooltip-content'>28.4k</span></div><div class='tooltip'>B<span class='tooltip-content'>44</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1796' href='#L_ANDXOR_1796'><pre>1796</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> return Builder->CreateICmp(</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1797' href='#L_ANDXOR_1797'><pre>1797</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> ICmpInst::ICMP_UGE,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1798' href='#L_ANDXOR_1798'><pre>1798</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> Builder->CreateAdd(B, ConstantInt::getSigned(B->getType(), -1)), A);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1799' href='#L_ANDXOR_1799'><pre>1799</pre></a></td><td class='covered-line'><pre>28.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1800' href='#L_ANDXOR_1800'><pre>1800</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1801' href='#L_ANDXOR_1801'><pre>1801</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre> // E.g. (icmp slt x, 0) | (icmp sgt x, n) --> icmp ugt x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1802' href='#L_ANDXOR_1802'><pre>1802</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>29.6k</span></div><div class='tooltip'>V<span class='tooltip-content'>29.6k</span></div> = simplifyRangeCheck(LHS, RHS, /*Inverted=*/true))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1803' href='#L_ANDXOR_1803'><pre>1803</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1804' href='#L_ANDXOR_1804'><pre>1804</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1805' href='#L_ANDXOR_1805'><pre>1805</pre></a></td><td class='covered-line'><pre>29.6k</pre></td><td class='code'><pre> // E.g. (icmp sgt x, n) | (icmp slt x, 0) --> icmp ugt x, n</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1806' href='#L_ANDXOR_1806'><pre>1806</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>29.5k</span></div><div class='tooltip'>V<span class='tooltip-content'>29.5k</span></div> = simplifyRangeCheck(RHS, LHS, /*Inverted=*/true))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1807' href='#L_ANDXOR_1807'><pre>1807</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1808' href='#L_ANDXOR_1808'><pre>1808</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1809' href='#L_ANDXOR_1809'><pre>1809</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> // This only handles icmp of constants: (icmp1 A, C1) | (icmp2 B, C2).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1810' href='#L_ANDXOR_1810'><pre>1810</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>29.5k</span></div><div class='tooltip'>!LHSCst || <span class='tooltip-content'>29.5k</span></div><div class='tooltip'>!RHSCst<span class='tooltip-content'>10.8k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>22.1k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1811' href='#L_ANDXOR_1811'><pre>1811</pre></a></td><td class='covered-line'><pre>29.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1812' href='#L_ANDXOR_1812'><pre>1812</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.45k</span></div><div class='tooltip'>LHSCst == RHSCst && <span class='tooltip-content'>7.45k</span></div><div class='tooltip'>LHSCC == RHSCC<span class='tooltip-content'>2.28k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.48k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1813' href='#L_ANDXOR_1813'><pre>1813</pre></a></td><td class='covered-line'><pre>1.48k</pre></td><td class='code'><pre> // (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1814' href='#L_ANDXOR_1814'><pre>1814</pre></a></td><td class='covered-line'><pre>1.48k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSCC == ICmpInst::ICMP_NE && <span class='tooltip-content'>1.48k</span></div><div class='tooltip'>LHSCst->isZero()<span class='tooltip-content'>20</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1815' href='#L_ANDXOR_1815'><pre>1815</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *NewOr = Builder->CreateOr(Val, Val2);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1816' href='#L_ANDXOR_1816'><pre>1816</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Builder->CreateICmp(LHSCC, NewOr, LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1817' href='#L_ANDXOR_1817'><pre>1817</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1818' href='#L_ANDXOR_1818'><pre>1818</pre></a></td><td class='covered-line'><pre>1.48k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1819' href='#L_ANDXOR_1819'><pre>1819</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1820' href='#L_ANDXOR_1820'><pre>1820</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> // (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1821' href='#L_ANDXOR_1821'><pre>1821</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> // iff C2 + CA == C1.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1822' href='#L_ANDXOR_1822'><pre>1822</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.45k</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_ULT && <span class='tooltip-content'>7.45k</span></div><div class='tooltip'>RHSCC == ICmpInst::ICMP_EQ<span class='tooltip-content'>297</span></div>) <div class='tooltip'>{<span class='tooltip-content'>110</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1823' href='#L_ANDXOR_1823'><pre>1823</pre></a></td><td class='covered-line'><pre>110</pre></td><td class='code'><pre> ConstantInt *AddCst;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1824' href='#L_ANDXOR_1824'><pre>1824</pre></a></td><td class='covered-line'><pre>110</pre></td><td class='code'><pre> if (match(Val, m_Add(m_Specific(Val2), m_ConstantInt(AddCst))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1825' href='#L_ANDXOR_1825'><pre>1825</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28</span></div><div class='tooltip'>RHSCst->getValue() + AddCst->getValue() == LHSCst->getValue()<span class='tooltip-content'>28</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1826' href='#L_ANDXOR_1826'><pre>1826</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return Builder->CreateICmpULE(Val, LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1827' href='#L_ANDXOR_1827'><pre>1827</pre></a></td><td class='covered-line'><pre>110</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1828' href='#L_ANDXOR_1828'><pre>1828</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1829' href='#L_ANDXOR_1829'><pre>1829</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> // From here on, we only handle:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1830' href='#L_ANDXOR_1830'><pre>1830</pre></a></td><td class='covered-line'><pre>7.45k</pre></td><td class='code'><pre> // (icmp1 A, C1) | (icmp2 A, C2) --> something simpler.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1831' href='#L_ANDXOR_1831'><pre>1831</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.44k</span></div><div class='tooltip'>Val != Val2<span class='tooltip-content'>7.44k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>6.60k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1832' href='#L_ANDXOR_1832'><pre>1832</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1833' href='#L_ANDXOR_1833'><pre>1833</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ICMP_[US][GL]E X, CST is folded to ICMP_[US][GL]T elsewhere.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1834' href='#L_ANDXOR_1834'><pre>1834</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>845</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_UGE || <span class='tooltip-content'>845</span></div><div class='tooltip'>LHSCC == ICmpInst::ICMP_ULE<span class='tooltip-content'>845</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1835' href='#L_ANDXOR_1835'><pre>1835</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> <div class='tooltip'>RHSCC == ICmpInst::ICMP_UGE<span class='tooltip-content'>845</span></div> || <div class='tooltip'>RHSCC == ICmpInst::ICMP_ULE<span class='tooltip-content'>845</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1836' href='#L_ANDXOR_1836'><pre>1836</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> <div class='tooltip'>LHSCC == ICmpInst::ICMP_SGE<span class='tooltip-content'>845</span></div> || <div class='tooltip'>LHSCC == ICmpInst::ICMP_SLE<span class='tooltip-content'>845</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1837' href='#L_ANDXOR_1837'><pre>1837</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> <div class='tooltip'>RHSCC == ICmpInst::ICMP_SGE<span class='tooltip-content'>845</span></div> || <div class='tooltip'>RHSCC == ICmpInst::ICMP_SLE<span class='tooltip-content'>845</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1838' href='#L_ANDXOR_1838'><pre>1838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1839' href='#L_ANDXOR_1839'><pre>1839</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1840' href='#L_ANDXOR_1840'><pre>1840</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> // We can't fold (ugt x, C) | (sgt x, C2).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1841' href='#L_ANDXOR_1841'><pre>1841</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>845</span></div><div class='tooltip'>!PredicatesFoldable(LHSCC, RHSCC)<span class='tooltip-content'>845</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1842' href='#L_ANDXOR_1842'><pre>1842</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1843' href='#L_ANDXOR_1843'><pre>1843</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1844' href='#L_ANDXOR_1844'><pre>1844</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> // Ensure that the larger constant is on the RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1845' href='#L_ANDXOR_1845'><pre>1845</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> bool ShouldSwap;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1846' href='#L_ANDXOR_1846'><pre>1846</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> if (CmpInst::isSigned(LHSCC) ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1847' href='#L_ANDXOR_1847'><pre>1847</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre> (ICmpInst::isEquality(LHSCC) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1848' href='#L_ANDXOR_1848'><pre>1848</pre></a></td><td class='covered-line'><pre>617</pre></td><td class='code'><pre> CmpInst::isSigned(RHSCC)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1849' href='#L_ANDXOR_1849'><pre>1849</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> ShouldSwap = LHSCst->getValue().sgt(RHSCst->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1850' href='#L_ANDXOR_1850'><pre>1850</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1851' href='#L_ANDXOR_1851'><pre>1851</pre></a></td><td class='covered-line'><pre>628</pre></td><td class='code'><pre> ShouldSwap = LHSCst->getValue().ugt(RHSCst->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1852' href='#L_ANDXOR_1852'><pre>1852</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1853' href='#L_ANDXOR_1853'><pre>1853</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> if (<div class='tooltip'>ShouldSwap<span class='tooltip-content'>823</span></div>) <div class='tooltip'>{<span class='tooltip-content'>199</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1854' href='#L_ANDXOR_1854'><pre>1854</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> std::swap(LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1855' href='#L_ANDXOR_1855'><pre>1855</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> std::swap(LHSCst, RHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1856' href='#L_ANDXOR_1856'><pre>1856</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> std::swap(LHSCC, RHSCC);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1857' href='#L_ANDXOR_1857'><pre>1857</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1858' href='#L_ANDXOR_1858'><pre>1858</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1859' href='#L_ANDXOR_1859'><pre>1859</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // At this point, we know we have two icmp instructions</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1860' href='#L_ANDXOR_1860'><pre>1860</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // comparing a value against two constants and or'ing the result</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1861' href='#L_ANDXOR_1861'><pre>1861</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // together. Because of the above check, we know that we only have</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1862' href='#L_ANDXOR_1862'><pre>1862</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1863' href='#L_ANDXOR_1863'><pre>1863</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // icmp folding check above), that the two constants are not</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1864' href='#L_ANDXOR_1864'><pre>1864</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // equal.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1865' href='#L_ANDXOR_1865'><pre>1865</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> assert(LHSCst != RHSCst && "Compares not folded above?");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1866' href='#L_ANDXOR_1866'><pre>1866</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1867' href='#L_ANDXOR_1867'><pre>1867</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> switch (LHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1868' href='#L_ANDXOR_1868'><pre>1868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1869' href='#L_ANDXOR_1869'><pre>1869</pre></a></td><td class='covered-line'><pre>626</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1870' href='#L_ANDXOR_1870'><pre>1870</pre></a></td><td class='covered-line'><pre>626</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1871' href='#L_ANDXOR_1871'><pre>1871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1872' href='#L_ANDXOR_1872'><pre>1872</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1873' href='#L_ANDXOR_1873'><pre>1873</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS->getOperand(0) == RHS->getOperand(0)<span class='tooltip-content'>553</span></div>) <div class='tooltip'>{<span class='tooltip-content'>553</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1874' href='#L_ANDXOR_1874'><pre>1874</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // if LHSCst and RHSCst differ only by one bit:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1875' href='#L_ANDXOR_1875'><pre>1875</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> // (A == C1 || A == C2) -> (A | (C1 ^ C2)) == C2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1876' href='#L_ANDXOR_1876'><pre>1876</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> assert(LHSCst->getValue().ule(LHSCst->getValue()));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1877' href='#L_ANDXOR_1877'><pre>1877</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1878' href='#L_ANDXOR_1878'><pre>1878</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> APInt Xor = LHSCst->getValue() ^ RHSCst->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1879' href='#L_ANDXOR_1879'><pre>1879</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> if (<div class='tooltip'>Xor.isPowerOf2()<span class='tooltip-content'>553</span></div>) <div class='tooltip'>{<span class='tooltip-content'>52</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1880' href='#L_ANDXOR_1880'><pre>1880</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> Value *Cst = Builder->getInt(Xor);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1881' href='#L_ANDXOR_1881'><pre>1881</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> Value *Or = Builder->CreateOr(LHS->getOperand(0), Cst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1882' href='#L_ANDXOR_1882'><pre>1882</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> return Builder->CreateICmp(ICmpInst::ICMP_EQ, Or, RHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1883' href='#L_ANDXOR_1883'><pre>1883</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1884' href='#L_ANDXOR_1884'><pre>1884</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1885' href='#L_ANDXOR_1885'><pre>1885</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1886' href='#L_ANDXOR_1886'><pre>1886</pre></a></td><td class='covered-line'><pre>501</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>501</span></div><div class='tooltip'>LHSCst == SubOne(RHSCst)<span class='tooltip-content'>501</span></div>) <div class='tooltip'>{<span class='tooltip-content'>38</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1887' href='#L_ANDXOR_1887'><pre>1887</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> // (X == 13 | X == 14) -> X-13 <u 2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1888' href='#L_ANDXOR_1888'><pre>1888</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> Constant *AddCST = ConstantExpr::getNeg(LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1889' href='#L_ANDXOR_1889'><pre>1889</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1890' href='#L_ANDXOR_1890'><pre>1890</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1891' href='#L_ANDXOR_1891'><pre>1891</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> return Builder->CreateICmpULT(Add, AddCST);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1892' href='#L_ANDXOR_1892'><pre>1892</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1893' href='#L_ANDXOR_1893'><pre>1893</pre></a></td><td class='covered-line'><pre>501</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1894' href='#L_ANDXOR_1894'><pre>1894</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> break; // (X == 13 | X == 15) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1895' href='#L_ANDXOR_1895'><pre>1895</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT: // (X == 13 | X u> 14) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1896' href='#L_ANDXOR_1896'><pre>1896</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT: // (X == 13 | X s> 14) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1897' href='#L_ANDXOR_1897'><pre>1897</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1898' href='#L_ANDXOR_1898'><pre>1898</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE: // (X == 13 | X != 15) -> X != 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1899' href='#L_ANDXOR_1899'><pre>1899</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: // (X == 13 | X u< 15) -> X u< 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1900' href='#L_ANDXOR_1900'><pre>1900</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: // (X == 13 | X s< 15) -> X s< 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1901' href='#L_ANDXOR_1901'><pre>1901</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1902' href='#L_ANDXOR_1902'><pre>1902</pre></a></td><td class='covered-line'><pre>626</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1903' href='#L_ANDXOR_1903'><pre>1903</pre></a></td><td class='covered-line'><pre>533</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1904' href='#L_ANDXOR_1904'><pre>1904</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_NE:</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1905' href='#L_ANDXOR_1905'><pre>1905</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (RHSCC) {</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1906' href='#L_ANDXOR_1906'><pre>1906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1907' href='#L_ANDXOR_1907'><pre>1907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ: // (X != 13 | X == 15) -> X != 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1908' href='#L_ANDXOR_1908'><pre>1908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT: // (X != 13 | X u> 15) -> X != 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1909' href='#L_ANDXOR_1909'><pre>1909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT: // (X != 13 | X s> 15) -> X != 13</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1910' href='#L_ANDXOR_1910'><pre>1910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LHS</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1911' href='#L_ANDXOR_1911'><pre>1911</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE: // (X != 13 | X != 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1912' href='#L_ANDXOR_1912'><pre>1912</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT: // (X != 13 | X u< 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1913' href='#L_ANDXOR_1913'><pre>1913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT: // (X != 13 | X s< 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1914' href='#L_ANDXOR_1914'><pre>1914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->getTrue()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1915' href='#L_ANDXOR_1915'><pre>1915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1916' href='#L_ANDXOR_1916'><pre>1916</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_ULT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1917' href='#L_ANDXOR_1917'><pre>1917</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1918' href='#L_ANDXOR_1918'><pre>1918</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1919' href='#L_ANDXOR_1919'><pre>1919</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X u< 13 | X == 14) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1920' href='#L_ANDXOR_1920'><pre>1920</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> break<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1921' href='#L_ANDXOR_1921'><pre>1921</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_UGT: // (X u< 13 | X u> 15) -> (X-13) u> 2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1922' href='#L_ANDXOR_1922'><pre>1922</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // If RHSCst is [us]MAXINT, it is always false. Not handling</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1923' href='#L_ANDXOR_1923'><pre>1923</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // this can cause overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1924' href='#L_ANDXOR_1924'><pre>1924</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> if (RHSCst->isMaxValue(false))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1925' href='#L_ANDXOR_1925'><pre>1925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return LHS</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1926' href='#L_ANDXOR_1926'><pre>1926</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> return insertRangeTest(Val, LHSCst->getValue(), RHSCst->getValue() + 1,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1927' href='#L_ANDXOR_1927'><pre>1927</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> false, false);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1928' href='#L_ANDXOR_1928'><pre>1928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SGT: // (X u< 13 | X s> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1929' href='#L_ANDXOR_1929'><pre>1929</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1930' href='#L_ANDXOR_1930'><pre>1930</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE: // (X u< 13 | X != 15) -> X != 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1931' href='#L_ANDXOR_1931'><pre>1931</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: // (X u< 13 | X u< 15) -> X u< 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1932' href='#L_ANDXOR_1932'><pre>1932</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1933' href='#L_ANDXOR_1933'><pre>1933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SLT: // (X u< 13 | X s< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1934' href='#L_ANDXOR_1934'><pre>1934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1935' href='#L_ANDXOR_1935'><pre>1935</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1936' href='#L_ANDXOR_1936'><pre>1936</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1937' href='#L_ANDXOR_1937'><pre>1937</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1938' href='#L_ANDXOR_1938'><pre>1938</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1939' href='#L_ANDXOR_1939'><pre>1939</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1940' href='#L_ANDXOR_1940'><pre>1940</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X s< 13 | X == 14) -> no change</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1941' href='#L_ANDXOR_1941'><pre>1941</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> break<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1942' href='#L_ANDXOR_1942'><pre>1942</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_SGT: // (X s< 13 | X s> 15) -> (X-13) s> 2</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1943' href='#L_ANDXOR_1943'><pre>1943</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> // If RHSCst is [us]MAXINT, it is always false. Not handling</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1944' href='#L_ANDXOR_1944'><pre>1944</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> // this can cause overflow.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1945' href='#L_ANDXOR_1945'><pre>1945</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> if (RHSCst->isMaxValue(true))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1946' href='#L_ANDXOR_1946'><pre>1946</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return LHS</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1947' href='#L_ANDXOR_1947'><pre>1947</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> return insertRangeTest(Val, LHSCst->getValue(), RHSCst->getValue() + 1,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1948' href='#L_ANDXOR_1948'><pre>1948</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> true, false);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1949' href='#L_ANDXOR_1949'><pre>1949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_UGT: // (X s< 13 | X u> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1950' href='#L_ANDXOR_1950'><pre>1950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1951' href='#L_ANDXOR_1951'><pre>1951</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE: // (X s< 13 | X != 15) -> X != 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1952' href='#L_ANDXOR_1952'><pre>1952</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: // (X s< 13 | X s< 15) -> X s< 15</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1953' href='#L_ANDXOR_1953'><pre>1953</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return RHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1954' href='#L_ANDXOR_1954'><pre>1954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_ULT: // (X s< 13 | X u< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1955' href='#L_ANDXOR_1955'><pre>1955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1956' href='#L_ANDXOR_1956'><pre>1956</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1957' href='#L_ANDXOR_1957'><pre>1957</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1958' href='#L_ANDXOR_1958'><pre>1958</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1959' href='#L_ANDXOR_1959'><pre>1959</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1960' href='#L_ANDXOR_1960'><pre>1960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1961' href='#L_ANDXOR_1961'><pre>1961</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X u> 13 | X == 15) -> X u> 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1962' href='#L_ANDXOR_1962'><pre>1962</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT: // (X u> 13 | X u> 15) -> X u> 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1963' href='#L_ANDXOR_1963'><pre>1963</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1964' href='#L_ANDXOR_1964'><pre>1964</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SGT: // (X u> 13 | X s> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1965' href='#L_ANDXOR_1965'><pre>1965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1966' href='#L_ANDXOR_1966'><pre>1966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_NE: // (X u> 13 | X != 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1967' href='#L_ANDXOR_1967'><pre>1967</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT: // (X u> 13 | X u< 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1968' href='#L_ANDXOR_1968'><pre>1968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->getTrue()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1969' href='#L_ANDXOR_1969'><pre>1969</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT: // (X u> 13 | X s< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1970' href='#L_ANDXOR_1970'><pre>1970</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1971' href='#L_ANDXOR_1971'><pre>1971</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1972' href='#L_ANDXOR_1972'><pre>1972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1973' href='#L_ANDXOR_1973'><pre>1973</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1974' href='#L_ANDXOR_1974'><pre>1974</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> switch (RHSCC) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1975' href='#L_ANDXOR_1975'><pre>1975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown integer condition code!");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1976' href='#L_ANDXOR_1976'><pre>1976</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: // (X s> 13 | X == 15) -> X > 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1977' href='#L_ANDXOR_1977'><pre>1977</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT: // (X s> 13 | X s> 15) -> X > 13</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1978' href='#L_ANDXOR_1978'><pre>1978</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return LHS;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1979' href='#L_ANDXOR_1979'><pre>1979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_UGT: // (X s> 13 | X u> 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1980' href='#L_ANDXOR_1980'><pre>1980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1981' href='#L_ANDXOR_1981'><pre>1981</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_NE: // (X s> 13 | X != 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1982' href='#L_ANDXOR_1982'><pre>1982</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT: // (X s> 13 | X s< 15) -> true</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1983' href='#L_ANDXOR_1983'><pre>1983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->getTrue()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1984' href='#L_ANDXOR_1984'><pre>1984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT: // (X s> 13 | X u< 15) -> no change</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1985' href='#L_ANDXOR_1985'><pre>1985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1986' href='#L_ANDXOR_1986'><pre>1986</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1987' href='#L_ANDXOR_1987'><pre>1987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1988' href='#L_ANDXOR_1988'><pre>1988</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1989' href='#L_ANDXOR_1989'><pre>1989</pre></a></td><td class='covered-line'><pre>663</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1990' href='#L_ANDXOR_1990'><pre>1990</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1991' href='#L_ANDXOR_1991'><pre>1991</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1992' href='#L_ANDXOR_1992'><pre>1992</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Optimize (fcmp)|(fcmp). NOTE: Unlike the rest of instcombine, this returns</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1993' href='#L_ANDXOR_1993'><pre>1993</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a Value which should already be inserted into the function.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1994' href='#L_ANDXOR_1994'><pre>1994</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre>Value *InstCombiner::FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1995' href='#L_ANDXOR_1995'><pre>1995</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> Value *Op0LHS = LHS->getOperand(0), *Op0RHS = LHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1996' href='#L_ANDXOR_1996'><pre>1996</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> Value *Op1LHS = RHS->getOperand(0), *Op1RHS = RHS->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1997' href='#L_ANDXOR_1997'><pre>1997</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> FCmpInst::Predicate Op0CC = LHS->getPredicate(), Op1CC = RHS->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1998' href='#L_ANDXOR_1998'><pre>1998</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_1999' href='#L_ANDXOR_1999'><pre>1999</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0LHS == Op1RHS && <span class='tooltip-content'>639</span></div><div class='tooltip'>Op0RHS == Op1LHS<span class='tooltip-content'>48</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2000' href='#L_ANDXOR_2000'><pre>2000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Swap RHS operands to match LHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2001' href='#L_ANDXOR_2001'><pre>2001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1CC = FCmpInst::getSwappedPredicate(Op1CC);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2002' href='#L_ANDXOR_2002'><pre>2002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op1LHS, Op1RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2003' href='#L_ANDXOR_2003'><pre>2003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2004' href='#L_ANDXOR_2004'><pre>2004</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2005' href='#L_ANDXOR_2005'><pre>2005</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // Simplify (fcmp cc0 x, y) | (fcmp cc1 x, y).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2006' href='#L_ANDXOR_2006'><pre>2006</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // This is a similar transformation to the one in FoldAndOfFCmps.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2007' href='#L_ANDXOR_2007'><pre>2007</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2008' href='#L_ANDXOR_2008'><pre>2008</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // Since (R & CC0) and (R & CC1) are either R or 0, we actually have this:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2009' href='#L_ANDXOR_2009'><pre>2009</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // bool(R & CC0) || bool(R & CC1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2010' href='#L_ANDXOR_2010'><pre>2010</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // = bool((R & CC0) | (R & CC1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2011' href='#L_ANDXOR_2011'><pre>2011</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> // = bool(R & (CC0 | CC1)) <= by reversed distribution (contribution? ;)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2012' href='#L_ANDXOR_2012'><pre>2012</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0LHS == Op1LHS && <span class='tooltip-content'>639</span></div><div class='tooltip'>Op0RHS == Op1RHS<span class='tooltip-content'>202</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2013' href='#L_ANDXOR_2013'><pre>2013</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return getFCmpValue(getFCmpCode(Op0CC) | getFCmpCode(Op1CC), Op0LHS, Op0RHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2014' href='#L_ANDXOR_2014'><pre>2014</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Builder);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2015' href='#L_ANDXOR_2015'><pre>2015</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2016' href='#L_ANDXOR_2016'><pre>2016</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>638</span></div><div class='tooltip'>LHS->getPredicate() == FCmpInst::FCMP_UNO &&<span class='tooltip-content'>638</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2017' href='#L_ANDXOR_2017'><pre>2017</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>RHS->getPredicate() == FCmpInst::FCMP_UNO</span> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2018' href='#L_ANDXOR_2018'><pre>2018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>LHS->getOperand(0)->getType() == RHS->getOperand(0)->getType()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2019' href='#L_ANDXOR_2019'><pre>2019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantFP *</span><span class='red'>LHSC</span><span class='red'> = dyn_cast<ConstantFP>(LHS->getOperand(1)))</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2020' href='#L_ANDXOR_2020'><pre>2020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantFP *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHSC</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(RHS->getOperand(1))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2021' href='#L_ANDXOR_2021'><pre>2021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If either of the constants are nans, then the whole thing returns</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2022' href='#L_ANDXOR_2022'><pre>2022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // true.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2023' href='#L_ANDXOR_2023'><pre>2023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>LHSC->getValueAPF().isNaN() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHSC->getValueAPF().isNaN()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2024' href='#L_ANDXOR_2024'><pre>2024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder->getTrue()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2025' href='#L_ANDXOR_2025'><pre>2025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2026' href='#L_ANDXOR_2026'><pre>2026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, no need to compare the two constants, compare the</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2027' href='#L_ANDXOR_2027'><pre>2027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // rest.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2028' href='#L_ANDXOR_2028'><pre>2028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2029' href='#L_ANDXOR_2029'><pre>2029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2030' href='#L_ANDXOR_2030'><pre>2030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2031' href='#L_ANDXOR_2031'><pre>2031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle vector zeros. This occurs because the canonical form of</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2032' href='#L_ANDXOR_2032'><pre>2032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // "fcmp uno x,x" is "fcmp uno x, 0".</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2033' href='#L_ANDXOR_2033'><pre>2033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(LHS->getOperand(1)) &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2034' href='#L_ANDXOR_2034'><pre>2034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>isa<ConstantAggregateZero>(RHS->getOperand(1))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2035' href='#L_ANDXOR_2035'><pre>2035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2036' href='#L_ANDXOR_2036'><pre>2036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2037' href='#L_ANDXOR_2037'><pre>2037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2038' href='#L_ANDXOR_2038'><pre>2038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2039' href='#L_ANDXOR_2039'><pre>2039</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2040' href='#L_ANDXOR_2040'><pre>2040</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2041' href='#L_ANDXOR_2041'><pre>2041</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2042' href='#L_ANDXOR_2042'><pre>2042</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2043' href='#L_ANDXOR_2043'><pre>2043</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This helper function folds:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2044' href='#L_ANDXOR_2044'><pre>2044</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2045' href='#L_ANDXOR_2045'><pre>2045</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ((A | B) & C1) | (B & C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2046' href='#L_ANDXOR_2046'><pre>2046</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2047' href='#L_ANDXOR_2047'><pre>2047</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2048' href='#L_ANDXOR_2048'><pre>2048</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2049' href='#L_ANDXOR_2049'><pre>2049</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (A & C1) | B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2050' href='#L_ANDXOR_2050'><pre>2050</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2051' href='#L_ANDXOR_2051'><pre>2051</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// when the XOR of the two constants is "all ones" (-1).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2052' href='#L_ANDXOR_2052'><pre>2052</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::FoldOrWithConstants(BinaryOperator &I, Value *Op,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2053' href='#L_ANDXOR_2053'><pre>2053</pre></a></td><td class='covered-line'><pre>72</pre></td><td class='code'><pre> Value *A, Value *B, Value *C) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2054' href='#L_ANDXOR_2054'><pre>2054</pre></a></td><td class='covered-line'><pre>72</pre></td><td class='code'><pre> ConstantInt *CI1 = dyn_cast<ConstantInt>(C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2055' href='#L_ANDXOR_2055'><pre>2055</pre></a></td><td class='covered-line'><pre>72</pre></td><td class='code'><pre> if (<div class='tooltip'>!CI1<span class='tooltip-content'>72</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>72</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2056' href='#L_ANDXOR_2056'><pre>2056</pre></a></td><td class='covered-line'><pre>72</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2057' href='#L_ANDXOR_2057'><pre>2057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *V1 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2058' href='#L_ANDXOR_2058'><pre>2058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI2 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2059' href='#L_ANDXOR_2059'><pre>2059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!match(Op, m_And(m_Value(V1), m_ConstantInt(CI2)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2060' href='#L_ANDXOR_2060'><pre>2060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2061' href='#L_ANDXOR_2061'><pre>2061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Xor = CI1->getValue() ^ CI2->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2062' href='#L_ANDXOR_2062'><pre>2062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Xor.isAllOnesValue()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2063' href='#L_ANDXOR_2063'><pre>2063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2064' href='#L_ANDXOR_2064'><pre>2064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V1 == A || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V1 == B</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2065' href='#L_ANDXOR_2065'><pre>2065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOp = Builder->CreateAnd((V1 == A) ? </span><div class='tooltip'><span class='red'>B</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>A</span><span class='tooltip-content'>0</span></div><span class='red'>, CI1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2066' href='#L_ANDXOR_2066'><pre>2066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(NewOp, V1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2067' href='#L_ANDXOR_2067'><pre>2067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2068' href='#L_ANDXOR_2068'><pre>2068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2069' href='#L_ANDXOR_2069'><pre>2069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2070' href='#L_ANDXOR_2070'><pre>2070</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2071' href='#L_ANDXOR_2071'><pre>2071</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2072' href='#L_ANDXOR_2072'><pre>2072</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief This helper function folds:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2073' href='#L_ANDXOR_2073'><pre>2073</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2074' href='#L_ANDXOR_2074'><pre>2074</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ((A | B) & C1) ^ (B & C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2075' href='#L_ANDXOR_2075'><pre>2075</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2076' href='#L_ANDXOR_2076'><pre>2076</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into:</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2077' href='#L_ANDXOR_2077'><pre>2077</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2078' href='#L_ANDXOR_2078'><pre>2078</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (A & C1) ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2079' href='#L_ANDXOR_2079'><pre>2079</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2080' href='#L_ANDXOR_2080'><pre>2080</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// when the XOR of the two constants is "all ones" (-1).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2081' href='#L_ANDXOR_2081'><pre>2081</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::FoldXorWithConstants(BinaryOperator &I, Value *Op,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2082' href='#L_ANDXOR_2082'><pre>2082</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Value *A, Value *B, Value *C) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2083' href='#L_ANDXOR_2083'><pre>2083</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> ConstantInt *CI1 = dyn_cast<ConstantInt>(C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2084' href='#L_ANDXOR_2084'><pre>2084</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (!CI1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2085' href='#L_ANDXOR_2085'><pre>2085</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2086' href='#L_ANDXOR_2086'><pre>2086</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2087' href='#L_ANDXOR_2087'><pre>2087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *V1 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2088' href='#L_ANDXOR_2088'><pre>2088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI2 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2089' href='#L_ANDXOR_2089'><pre>2089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!match(Op, m_And(m_Value(V1), m_ConstantInt(CI2)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2090' href='#L_ANDXOR_2090'><pre>2090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2091' href='#L_ANDXOR_2091'><pre>2091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2092' href='#L_ANDXOR_2092'><pre>2092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Xor = CI1->getValue() ^ CI2->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2093' href='#L_ANDXOR_2093'><pre>2093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Xor.isAllOnesValue()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2094' href='#L_ANDXOR_2094'><pre>2094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2095' href='#L_ANDXOR_2095'><pre>2095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2096' href='#L_ANDXOR_2096'><pre>2096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V1 == A || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V1 == B</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2097' href='#L_ANDXOR_2097'><pre>2097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOp = Builder->CreateAnd(V1 == A ? </span><div class='tooltip'><span class='red'>B</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>A</span><span class='tooltip-content'>0</span></div><span class='red'>, CI1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2098' href='#L_ANDXOR_2098'><pre>2098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(NewOp, V1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2099' href='#L_ANDXOR_2099'><pre>2099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2100' href='#L_ANDXOR_2100'><pre>2100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2101' href='#L_ANDXOR_2101'><pre>2101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2102' href='#L_ANDXOR_2102'><pre>2102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2103' href='#L_ANDXOR_2103'><pre>2103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2104' href='#L_ANDXOR_2104'><pre>2104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// FIXME: We use commutative matchers (m_c_*) for some, but not all, matches</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2105' href='#L_ANDXOR_2105'><pre>2105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// here. We should standardize that construct where it is needed or choose some</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2106' href='#L_ANDXOR_2106'><pre>2106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// other way to ensure that commutated variants of patterns are not missed.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2107' href='#L_ANDXOR_2107'><pre>2107</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitOr(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2108' href='#L_ANDXOR_2108'><pre>2108</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2109' href='#L_ANDXOR_2109'><pre>2109</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2110' href='#L_ANDXOR_2110'><pre>2110</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2111' href='#L_ANDXOR_2111'><pre>2111</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2112' href='#L_ANDXOR_2112'><pre>2112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2113' href='#L_ANDXOR_2113'><pre>2113</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2114' href='#L_ANDXOR_2114'><pre>2114</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>101k</span></div><div class='tooltip'>V<span class='tooltip-content'>101k</span></div> = SimplifyOrInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2115' href='#L_ANDXOR_2115'><pre>2115</pre></a></td><td class='covered-line'><pre>669</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2116' href='#L_ANDXOR_2116'><pre>2116</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2117' href='#L_ANDXOR_2117'><pre>2117</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // (A&B)|(A&C) -> A&(B|C) etc</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2118' href='#L_ANDXOR_2118'><pre>2118</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>100k</span></div><div class='tooltip'>V<span class='tooltip-content'>100k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2119' href='#L_ANDXOR_2119'><pre>2119</pre></a></td><td class='covered-line'><pre>102</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2120' href='#L_ANDXOR_2120'><pre>2120</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2121' href='#L_ANDXOR_2121'><pre>2121</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // See if we can simplify any instructions used by the instruction whose sole</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2122' href='#L_ANDXOR_2122'><pre>2122</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // purpose is to compute bits we don't care about.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2123' href='#L_ANDXOR_2123'><pre>2123</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(I)<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2124' href='#L_ANDXOR_2124'><pre>2124</pre></a></td><td class='covered-line'><pre>241</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2125' href='#L_ANDXOR_2125'><pre>2125</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2126' href='#L_ANDXOR_2126'><pre>2126</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>100k</span></div><div class='tooltip'>V<span class='tooltip-content'>100k</span></div> = SimplifyBSwap(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2127' href='#L_ANDXOR_2127'><pre>2127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2128' href='#L_ANDXOR_2128'><pre>2128</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2129' href='#L_ANDXOR_2129'><pre>2129</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>100k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>100k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>21.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2130' href='#L_ANDXOR_2130'><pre>2130</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> ConstantInt *C1 = nullptr; Value *X = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2131' href='#L_ANDXOR_2131'><pre>2131</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> // (X & C1) | C2 --> (X | C2) & (C1|C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2132' href='#L_ANDXOR_2132'><pre>2132</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> // iff (C1 & C2) == 0.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2133' href='#L_ANDXOR_2133'><pre>2133</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2134' href='#L_ANDXOR_2134'><pre>2134</pre></a></td><td class='covered-line'><pre>5.44k</pre></td><td class='code'><pre> (RHS->getValue() & C1->getValue()) != 0 &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2135' href='#L_ANDXOR_2135'><pre>2135</pre></a></td><td class='covered-line'><pre>157</pre></td><td class='code'><pre> <div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>157</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2136' href='#L_ANDXOR_2136'><pre>2136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Or = Builder->CreateOr(X, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2137' href='#L_ANDXOR_2137'><pre>2137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Or->takeName(Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2138' href='#L_ANDXOR_2138'><pre>2138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(Or,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2139' href='#L_ANDXOR_2139'><pre>2139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt(RHS->getValue() | C1->getValue()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2140' href='#L_ANDXOR_2140'><pre>2140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2141' href='#L_ANDXOR_2141'><pre>2141</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2142' href='#L_ANDXOR_2142'><pre>2142</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> // (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2143' href='#L_ANDXOR_2143'><pre>2143</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.5k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Value(X), m_ConstantInt(C1))) &&<span class='tooltip-content'>21.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2144' href='#L_ANDXOR_2144'><pre>2144</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> <div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2145' href='#L_ANDXOR_2145'><pre>2145</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *Or = Builder->CreateOr(X, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2146' href='#L_ANDXOR_2146'><pre>2146</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Or->takeName(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2147' href='#L_ANDXOR_2147'><pre>2147</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(Or,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2148' href='#L_ANDXOR_2148'><pre>2148</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Builder->getInt(C1->getValue() & ~RHS->getValue()));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2149' href='#L_ANDXOR_2149'><pre>2149</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2150' href='#L_ANDXOR_2150'><pre>2150</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2151' href='#L_ANDXOR_2151'><pre>2151</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>21.5k</span></div><div class='tooltip'>FoldedLogic<span class='tooltip-content'>21.5k</span></div> = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2152' href='#L_ANDXOR_2152'><pre>2152</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return FoldedLogic;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2153' href='#L_ANDXOR_2153'><pre>2153</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2154' href='#L_ANDXOR_2154'><pre>2154</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2155' href='#L_ANDXOR_2155'><pre>2155</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Given an OR instruction, check to see if this is a bswap.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2156' href='#L_ANDXOR_2156'><pre>2156</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>100k</span></div><div class='tooltip'>BSwap<span class='tooltip-content'>100k</span></div> = MatchBSwap(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2157' href='#L_ANDXOR_2157'><pre>2157</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return BSwap;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2158' href='#L_ANDXOR_2158'><pre>2158</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2159' href='#L_ANDXOR_2159'><pre>2159</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2160' href='#L_ANDXOR_2160'><pre>2160</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> ConstantInt *C1 = nullptr, *C2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2161' href='#L_ANDXOR_2161'><pre>2161</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2162' href='#L_ANDXOR_2162'><pre>2162</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (X^C)|Y -> (X|Y)^C iff Y&C == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2163' href='#L_ANDXOR_2163'><pre>2163</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (Op0->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2164' href='#L_ANDXOR_2164'><pre>2164</pre></a></td><td class='covered-line'><pre>83.0k</pre></td><td class='code'><pre> match(Op0, m_Xor(m_Value(A), m_ConstantInt(C1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2165' href='#L_ANDXOR_2165'><pre>2165</pre></a></td><td class='covered-line'><pre>109</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op1, C1->getValue(), 0, &I)<span class='tooltip-content'>109</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2166' href='#L_ANDXOR_2166'><pre>2166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NOr = Builder->CreateOr(A, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2167' href='#L_ANDXOR_2167'><pre>2167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NOr->takeName(Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2168' href='#L_ANDXOR_2168'><pre>2168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(NOr, C1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2169' href='#L_ANDXOR_2169'><pre>2169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2170' href='#L_ANDXOR_2170'><pre>2170</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2171' href='#L_ANDXOR_2171'><pre>2171</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Y|(X^C) -> (X|Y)^C iff Y&C == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2172' href='#L_ANDXOR_2172'><pre>2172</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>Op1->hasOneUse() &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2173' href='#L_ANDXOR_2173'><pre>2173</pre></a></td><td class='covered-line'><pre>71.1k</pre></td><td class='code'><pre> match(Op1, m_Xor(m_Value(A), m_ConstantInt(C1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2174' href='#L_ANDXOR_2174'><pre>2174</pre></a></td><td class='covered-line'><pre>1.76k</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0, C1->getValue(), 0, &I)<span class='tooltip-content'>1.76k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2175' href='#L_ANDXOR_2175'><pre>2175</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *NOr = Builder->CreateOr(A, Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2176' href='#L_ANDXOR_2176'><pre>2176</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> NOr->takeName(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2177' href='#L_ANDXOR_2177'><pre>2177</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(NOr, C1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2178' href='#L_ANDXOR_2178'><pre>2178</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2179' href='#L_ANDXOR_2179'><pre>2179</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2180' href='#L_ANDXOR_2180'><pre>2180</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // ((~A & B) | A) -> (A | B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2181' href='#L_ANDXOR_2181'><pre>2181</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_And(m_Not(m_Value(A)), m_Value(B))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2182' href='#L_ANDXOR_2182'><pre>2182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(Op1, m_Specific(A))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2183' href='#L_ANDXOR_2183'><pre>2183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2184' href='#L_ANDXOR_2184'><pre>2184</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2185' href='#L_ANDXOR_2185'><pre>2185</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // ((A & B) | ~A) -> (~A | B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2186' href='#L_ANDXOR_2186'><pre>2186</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_And(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2187' href='#L_ANDXOR_2187'><pre>2187</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> match(Op1, m_Not(m_Specific(A))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2188' href='#L_ANDXOR_2188'><pre>2188</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(Builder->CreateNot(A), B);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2189' href='#L_ANDXOR_2189'><pre>2189</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2190' href='#L_ANDXOR_2190'><pre>2190</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & ~B) | (A ^ B) -> (A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2191' href='#L_ANDXOR_2191'><pre>2191</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (~B & A) | (A ^ B) -> (A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2192' href='#L_ANDXOR_2192'><pre>2192</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2193' href='#L_ANDXOR_2193'><pre>2193</pre></a></td><td class='covered-line'><pre>74</pre></td><td class='code'><pre> match(Op1, m_Xor(m_Specific(A), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2194' href='#L_ANDXOR_2194'><pre>2194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2195' href='#L_ANDXOR_2195'><pre>2195</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2196' href='#L_ANDXOR_2196'><pre>2196</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Commute the 'or' operands.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2197' href='#L_ANDXOR_2197'><pre>2197</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A ^ B) | (A & ~B) -> (A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2198' href='#L_ANDXOR_2198'><pre>2198</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A ^ B) | (~B & A) -> (A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2199' href='#L_ANDXOR_2199'><pre>2199</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op1, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2200' href='#L_ANDXOR_2200'><pre>2200</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> match(Op0, m_Xor(m_Specific(A), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2201' href='#L_ANDXOR_2201'><pre>2201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2202' href='#L_ANDXOR_2202'><pre>2202</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2203' href='#L_ANDXOR_2203'><pre>2203</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & C)|(B & D)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2204' href='#L_ANDXOR_2204'><pre>2204</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> Value *C = nullptr, *D = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2205' href='#L_ANDXOR_2205'><pre>2205</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (match(Op0, m_And(m_Value(A), m_Value(C))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2206' href='#L_ANDXOR_2206'><pre>2206</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_And(m_Value(B), m_Value(D)))<span class='tooltip-content'>23.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2207' href='#L_ANDXOR_2207'><pre>2207</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> Value *V1 = nullptr, *V2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2208' href='#L_ANDXOR_2208'><pre>2208</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> C1 = dyn_cast<ConstantInt>(C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2209' href='#L_ANDXOR_2209'><pre>2209</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> C2 = dyn_cast<ConstantInt>(D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2210' href='#L_ANDXOR_2210'><pre>2210</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>C1 && <span class='tooltip-content'>15.2k</span></div><div class='tooltip'>C2<span class='tooltip-content'>14.9k</span></div>) <div class='tooltip'>{ // (A & C1)|(B & C2)<span class='tooltip-content'>14.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2211' href='#L_ANDXOR_2211'><pre>2211</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>(C1->getValue() & C2->getValue()) == 0<span class='tooltip-content'>14.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>14.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2212' href='#L_ANDXOR_2212'><pre>2212</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> // ((V | N) & C1) | (V & C2) --> (V|N) & (C1|C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2213' href='#L_ANDXOR_2213'><pre>2213</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> // iff (C1&C2) == 0 and (N&~C1) == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2214' href='#L_ANDXOR_2214'><pre>2214</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> if (match(A, m_Or(m_Value(V1), m_Value(V2))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2215' href='#L_ANDXOR_2215'><pre>2215</pre></a></td><td class='covered-line'><pre>7.00k</pre></td><td class='code'><pre> ((V1 == B &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2216' href='#L_ANDXOR_2216'><pre>2216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>MaskedValueIsZero(V2, ~C1->getValue(), 0, &I)</span>) || // (V|N)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2217' href='#L_ANDXOR_2217'><pre>2217</pre></a></td><td class='covered-line'><pre>7.00k</pre></td><td class='code'><pre> (V2 == B &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2218' href='#L_ANDXOR_2218'><pre>2218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>MaskedValueIsZero(V1, ~C1->getValue(), 0, &I)</span>))) // (N|V)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2219' href='#L_ANDXOR_2219'><pre>2219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2220' href='#L_ANDXOR_2220'><pre>2220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt(C1->getValue()|C2->getValue()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2221' href='#L_ANDXOR_2221'><pre>2221</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> // Or commutes, try both ways.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2222' href='#L_ANDXOR_2222'><pre>2222</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>14.9k</span></div><div class='tooltip'>match(B, m_Or(m_Value(V1), m_Value(V2))) &&<span class='tooltip-content'>14.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2223' href='#L_ANDXOR_2223'><pre>2223</pre></a></td><td class='covered-line'><pre>253</pre></td><td class='code'><pre> ((V1 == A &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2224' href='#L_ANDXOR_2224'><pre>2224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>MaskedValueIsZero(V2, ~C2->getValue(), 0, &I)</span>) || // (V|N)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2225' href='#L_ANDXOR_2225'><pre>2225</pre></a></td><td class='covered-line'><pre>253</pre></td><td class='code'><pre> (V2 == A &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2226' href='#L_ANDXOR_2226'><pre>2226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>MaskedValueIsZero(V1, ~C2->getValue(), 0, &I)</span>))) // (N|V)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2227' href='#L_ANDXOR_2227'><pre>2227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(B,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2228' href='#L_ANDXOR_2228'><pre>2228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt(C1->getValue()|C2->getValue()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2229' href='#L_ANDXOR_2229'><pre>2229</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2230' href='#L_ANDXOR_2230'><pre>2230</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> // ((V|C3)&C1) | ((V|C4)&C2) --> (V|C3|C4)&(C1|C2)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2231' href='#L_ANDXOR_2231'><pre>2231</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> // iff (C1&C2) == 0 and (C3&~C1) == 0 and (C4&~C2) == 0.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2232' href='#L_ANDXOR_2232'><pre>2232</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> ConstantInt *C3 = nullptr, *C4 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2233' href='#L_ANDXOR_2233'><pre>2233</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> if (match(A, m_Or(m_Value(V1), m_ConstantInt(C3))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2234' href='#L_ANDXOR_2234'><pre>2234</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> (C3->getValue() & ~C1->getValue()) == 0 &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2235' href='#L_ANDXOR_2235'><pre>2235</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> match(B, m_Or(m_Specific(V1), m_ConstantInt(C4))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2236' href='#L_ANDXOR_2236'><pre>2236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>(C4->getValue() & ~C2->getValue()) == 0</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2237' href='#L_ANDXOR_2237'><pre>2237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V2 = Builder->CreateOr(V1, ConstantExpr::getOr(C3, C4), "bitfield");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2238' href='#L_ANDXOR_2238'><pre>2238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(V2,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2239' href='#L_ANDXOR_2239'><pre>2239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt(C1->getValue()|C2->getValue()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2240' href='#L_ANDXOR_2240'><pre>2240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2241' href='#L_ANDXOR_2241'><pre>2241</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2242' href='#L_ANDXOR_2242'><pre>2242</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2243' href='#L_ANDXOR_2243'><pre>2243</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2244' href='#L_ANDXOR_2244'><pre>2244</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // Don't try to form a select if it's unlikely that we'll get rid of at</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2245' href='#L_ANDXOR_2245'><pre>2245</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // least one of the operands. A select is generally more expensive than the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2246' href='#L_ANDXOR_2246'><pre>2246</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // 'or' that it is replacing.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2247' href='#L_ANDXOR_2247'><pre>2247</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>Op0->hasOneUse() || <span class='tooltip-content'>15.2k</span></div><div class='tooltip'>Op1->hasOneUse()<span class='tooltip-content'>547</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2248' href='#L_ANDXOR_2248'><pre>2248</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // (Cond & C) | (~Cond & D) -> Cond ? C : D, and commuted variants.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2249' href='#L_ANDXOR_2249'><pre>2249</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> if (Value *V = matchSelectFromAndOr(A, C, B, D, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2250' href='#L_ANDXOR_2250'><pre>2250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2251' href='#L_ANDXOR_2251'><pre>2251</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(A, C, D, B, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2252' href='#L_ANDXOR_2252'><pre>2252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2253' href='#L_ANDXOR_2253'><pre>2253</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(C, A, B, D, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2254' href='#L_ANDXOR_2254'><pre>2254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2255' href='#L_ANDXOR_2255'><pre>2255</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(C, A, D, B, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2256' href='#L_ANDXOR_2256'><pre>2256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2257' href='#L_ANDXOR_2257'><pre>2257</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(B, D, A, C, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2258' href='#L_ANDXOR_2258'><pre>2258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2259' href='#L_ANDXOR_2259'><pre>2259</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(B, D, C, A, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2260' href='#L_ANDXOR_2260'><pre>2260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2261' href='#L_ANDXOR_2261'><pre>2261</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(D, B, A, C, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2262' href='#L_ANDXOR_2262'><pre>2262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2263' href='#L_ANDXOR_2263'><pre>2263</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = matchSelectFromAndOr(D, B, C, A, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2264' href='#L_ANDXOR_2264'><pre>2264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2265' href='#L_ANDXOR_2265'><pre>2265</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2266' href='#L_ANDXOR_2266'><pre>2266</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2267' href='#L_ANDXOR_2267'><pre>2267</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((A&~B)|(~A&B)) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2268' href='#L_ANDXOR_2268'><pre>2268</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>(match(C, m_Not(m_Specific(D))) &&<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2269' href='#L_ANDXOR_2269'><pre>2269</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> match(B, m_Not(m_Specific(A)))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2270' href='#L_ANDXOR_2270'><pre>2270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, D)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2271' href='#L_ANDXOR_2271'><pre>2271</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((~B&A)|(~A&B)) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2272' href='#L_ANDXOR_2272'><pre>2272</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>(match(A, m_Not(m_Specific(D))) &&<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2273' href='#L_ANDXOR_2273'><pre>2273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(B, m_Not(m_Specific(C)))</span>))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2274' href='#L_ANDXOR_2274'><pre>2274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(C, D)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2275' href='#L_ANDXOR_2275'><pre>2275</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((A&~B)|(B&~A)) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2276' href='#L_ANDXOR_2276'><pre>2276</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>(match(C, m_Not(m_Specific(B))) &&<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2277' href='#L_ANDXOR_2277'><pre>2277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(D, m_Not(m_Specific(A)))</span>))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2278' href='#L_ANDXOR_2278'><pre>2278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2279' href='#L_ANDXOR_2279'><pre>2279</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((~B&A)|(B&~A)) -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2280' href='#L_ANDXOR_2280'><pre>2280</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>(match(A, m_Not(m_Specific(B))) &&<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2281' href='#L_ANDXOR_2281'><pre>2281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(D, m_Not(m_Specific(C)))</span>))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2282' href='#L_ANDXOR_2282'><pre>2282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(C, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2283' href='#L_ANDXOR_2283'><pre>2283</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2284' href='#L_ANDXOR_2284'><pre>2284</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((A|B)&1)|(B&-2) -> (A&1) | B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2285' href='#L_ANDXOR_2285'><pre>2285</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>match(A, m_Or(m_Value(V1), m_Specific(B))) ||<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2286' href='#L_ANDXOR_2286'><pre>2286</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>match(A, m_Or(m_Specific(B), m_Value(V1)))<span class='tooltip-content'>15.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>48</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2287' href='#L_ANDXOR_2287'><pre>2287</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> Instruction *Ret = FoldOrWithConstants(I, Op1, V1, B, C);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2288' href='#L_ANDXOR_2288'><pre>2288</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> if (<div class='tooltip'>Ret<span class='tooltip-content'>48</span></div>) <div class='tooltip'><span class='red'>return Ret</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2289' href='#L_ANDXOR_2289'><pre>2289</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2290' href='#L_ANDXOR_2290'><pre>2290</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // (B&-2)|((A|B)&1) -> (A&1) | B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2291' href='#L_ANDXOR_2291'><pre>2291</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>match(B, m_Or(m_Specific(A), m_Value(V1))) ||<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2292' href='#L_ANDXOR_2292'><pre>2292</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>match(B, m_Or(m_Value(V1), m_Specific(A)))<span class='tooltip-content'>15.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>24</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2293' href='#L_ANDXOR_2293'><pre>2293</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Instruction *Ret = FoldOrWithConstants(I, Op0, A, V1, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2294' href='#L_ANDXOR_2294'><pre>2294</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> if (<div class='tooltip'>Ret<span class='tooltip-content'>24</span></div>) <div class='tooltip'><span class='red'>return Ret</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2295' href='#L_ANDXOR_2295'><pre>2295</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2296' href='#L_ANDXOR_2296'><pre>2296</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // ((A^B)&1)|(B&-2) -> (A&1) ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2297' href='#L_ANDXOR_2297'><pre>2297</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>match(A, m_Xor(m_Value(V1), m_Specific(B))) ||<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2298' href='#L_ANDXOR_2298'><pre>2298</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>match(A, m_Xor(m_Specific(B), m_Value(V1)))<span class='tooltip-content'>15.2k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2299' href='#L_ANDXOR_2299'><pre>2299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Ret = FoldXorWithConstants(I, Op1, V1, B, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2300' href='#L_ANDXOR_2300'><pre>2300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Ret</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return Ret</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2301' href='#L_ANDXOR_2301'><pre>2301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2302' href='#L_ANDXOR_2302'><pre>2302</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // (B&-2)|((A^B)&1) -> (A&1) ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2303' href='#L_ANDXOR_2303'><pre>2303</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>match(B, m_Xor(m_Specific(A), m_Value(V1))) ||<span class='tooltip-content'>15.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2304' href='#L_ANDXOR_2304'><pre>2304</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>match(B, m_Xor(m_Value(V1), m_Specific(A)))<span class='tooltip-content'>15.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2305' href='#L_ANDXOR_2305'><pre>2305</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Instruction *Ret = FoldXorWithConstants(I, Op0, A, V1, D);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2306' href='#L_ANDXOR_2306'><pre>2306</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (<div class='tooltip'>Ret<span class='tooltip-content'>12</span></div>) <div class='tooltip'><span class='red'>return Ret</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2307' href='#L_ANDXOR_2307'><pre>2307</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2308' href='#L_ANDXOR_2308'><pre>2308</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2309' href='#L_ANDXOR_2309'><pre>2309</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2310' href='#L_ANDXOR_2310'><pre>2310</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A ^ B) | ((B ^ C) ^ A) -> (A ^ B) | C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2311' href='#L_ANDXOR_2311'><pre>2311</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Value(A), m_Value(B)))<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2312' href='#L_ANDXOR_2312'><pre>2312</pre></a></td><td class='covered-line'><pre>179</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>179</span></div><div class='tooltip'>match(Op1, m_Xor(m_Xor(m_Specific(B), m_Value(C)), m_Specific(A)))<span class='tooltip-content'>179</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2313' href='#L_ANDXOR_2313'><pre>2313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op1->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cast<BinaryOperator>(Op1)->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2314' href='#L_ANDXOR_2314'><pre>2314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateOr(Op0, C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2315' href='#L_ANDXOR_2315'><pre>2315</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2316' href='#L_ANDXOR_2316'><pre>2316</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // ((A ^ C) ^ B) | (B ^ A) -> (B ^ A) | C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2317' href='#L_ANDXOR_2317'><pre>2317</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_Xor(m_Xor(m_Value(A), m_Value(C)), m_Value(B)))<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2318' href='#L_ANDXOR_2318'><pre>2318</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>25</span></div><div class='tooltip'>match(Op1, m_Xor(m_Specific(B), m_Specific(A)))<span class='tooltip-content'>25</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2319' href='#L_ANDXOR_2319'><pre>2319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op0->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cast<BinaryOperator>(Op0)->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2320' href='#L_ANDXOR_2320'><pre>2320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateOr(Op1, C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2321' href='#L_ANDXOR_2321'><pre>2321</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2322' href='#L_ANDXOR_2322'><pre>2322</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // ((B | C) & A) | B -> B | (A & C)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2323' href='#L_ANDXOR_2323'><pre>2323</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_And(m_Or(m_Specific(Op1), m_Value(C)), m_Value(A)))<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2324' href='#L_ANDXOR_2324'><pre>2324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(Op1, Builder->CreateAnd(A, C))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2325' href='#L_ANDXOR_2325'><pre>2325</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2326' href='#L_ANDXOR_2326'><pre>2326</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>100k</span></div><div class='tooltip'>DeMorgan<span class='tooltip-content'>100k</span></div> = matchDeMorgansLaws(I, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2327' href='#L_ANDXOR_2327'><pre>2327</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> return DeMorgan;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2328' href='#L_ANDXOR_2328'><pre>2328</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2329' href='#L_ANDXOR_2329'><pre>2329</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Canonicalize xor to the RHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2330' href='#L_ANDXOR_2330'><pre>2330</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> bool SwappedForXor = false;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2331' href='#L_ANDXOR_2331'><pre>2331</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Xor(m_Value(), m_Value()))<span class='tooltip-content'>100k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>137</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2332' href='#L_ANDXOR_2332'><pre>2332</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2333' href='#L_ANDXOR_2333'><pre>2333</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> SwappedForXor = true;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2334' href='#L_ANDXOR_2334'><pre>2334</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2335' href='#L_ANDXOR_2335'><pre>2335</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2336' href='#L_ANDXOR_2336'><pre>2336</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // A | ( A ^ B) -> A | B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2337' href='#L_ANDXOR_2337'><pre>2337</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // A | (~A ^ B) -> A | ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2338' href='#L_ANDXOR_2338'><pre>2338</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & B) | (A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2339' href='#L_ANDXOR_2339'><pre>2339</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_Xor(m_Value(A), m_Value(B)))<span class='tooltip-content'>100k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.93k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2340' href='#L_ANDXOR_2340'><pre>2340</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0 == A || <span class='tooltip-content'>1.93k</span></div><div class='tooltip'>Op0 == B<span class='tooltip-content'>1.93k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2341' href='#L_ANDXOR_2341'><pre>2341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2342' href='#L_ANDXOR_2342'><pre>2342</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2343' href='#L_ANDXOR_2343'><pre>2343</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.93k</span></div><div class='tooltip'>match(Op0, m_And(m_Specific(A), m_Specific(B))) ||<span class='tooltip-content'>1.93k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2344' href='#L_ANDXOR_2344'><pre>2344</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> match(Op0, m_And(m_Specific(B), m_Specific(A))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2345' href='#L_ANDXOR_2345'><pre>2345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2346' href='#L_ANDXOR_2346'><pre>2346</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2347' href='#L_ANDXOR_2347'><pre>2347</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.93k</span></div><div class='tooltip'>Op1->hasOneUse() && <span class='tooltip-content'>1.93k</span></div><div class='tooltip'>match(A, m_Not(m_Specific(Op0)))<span class='tooltip-content'>1.80k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2348' href='#L_ANDXOR_2348'><pre>2348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(B, B->getName()+".not");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2349' href='#L_ANDXOR_2349'><pre>2349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(Not, Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2350' href='#L_ANDXOR_2350'><pre>2350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2351' href='#L_ANDXOR_2351'><pre>2351</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.93k</span></div><div class='tooltip'>Op1->hasOneUse() && <span class='tooltip-content'>1.93k</span></div><div class='tooltip'>match(B, m_Not(m_Specific(Op0)))<span class='tooltip-content'>1.80k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2352' href='#L_ANDXOR_2352'><pre>2352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(A, A->getName()+".not");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2353' href='#L_ANDXOR_2353'><pre>2353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(Not, Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2354' href='#L_ANDXOR_2354'><pre>2354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2355' href='#L_ANDXOR_2355'><pre>2355</pre></a></td><td class='covered-line'><pre>1.93k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2356' href='#L_ANDXOR_2356'><pre>2356</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2357' href='#L_ANDXOR_2357'><pre>2357</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // A | ~(A | B) -> A | ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2358' href='#L_ANDXOR_2358'><pre>2358</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // A | ~(A ^ B) -> A | ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2359' href='#L_ANDXOR_2359'><pre>2359</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op1, m_Not(m_Value(A)))<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2360' href='#L_ANDXOR_2360'><pre>2360</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> <div class='tooltip'>if (BinaryOperator *<span class='tooltip-content'>1.78k</span></div><div class='tooltip'>B<span class='tooltip-content'>1.78k</span></div> = dyn_cast<BinaryOperator>(A))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2361' href='#L_ANDXOR_2361'><pre>2361</pre></a></td><td class='covered-line'><pre>423</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>423</span></div><div class='tooltip'>(Op0 == B->getOperand(0) || <span class='tooltip-content'>423</span></div><div class='tooltip'>Op0 == B->getOperand(1)<span class='tooltip-content'>423</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2362' href='#L_ANDXOR_2362'><pre>2362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>Op1->hasOneUse()</span><span class='tooltip-content'>0</span></div> && <div class='tooltip'><span class='red'>(B->getOpcode() == Instruction::Or ||</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2363' href='#L_ANDXOR_2363'><pre>2363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>B->getOpcode() == Instruction::Xor</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2364' href='#L_ANDXOR_2364'><pre>2364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NotOp = Op0 == B->getOperand(0) ? </span><span class='red'>B->getOperand(1)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2365' href='#L_ANDXOR_2365'><pre>2365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>B->getOperand(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2366' href='#L_ANDXOR_2366'><pre>2366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(NotOp, NotOp->getName()+".not");</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2367' href='#L_ANDXOR_2367'><pre>2367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(Not, Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2368' href='#L_ANDXOR_2368'><pre>2368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2369' href='#L_ANDXOR_2369'><pre>2369</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2370' href='#L_ANDXOR_2370'><pre>2370</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & B) | (~A ^ B) -> (~A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2371' href='#L_ANDXOR_2371'><pre>2371</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (A & B) | (B ^ ~A) -> (~A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2372' href='#L_ANDXOR_2372'><pre>2372</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (B & A) | (~A ^ B) -> (~A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2373' href='#L_ANDXOR_2373'><pre>2373</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (B & A) | (B ^ ~A) -> (~A ^ B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2374' href='#L_ANDXOR_2374'><pre>2374</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // The match order is important: match the xor first because the 'not'</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2375' href='#L_ANDXOR_2375'><pre>2375</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // operation defines 'A'. We do not need to match the xor as Op0 because the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2376' href='#L_ANDXOR_2376'><pre>2376</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // xor was canonicalized to Op1 above.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2377' href='#L_ANDXOR_2377'><pre>2377</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op1, m_c_Xor(m_Not(m_Value(A)), m_Value(B))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2378' href='#L_ANDXOR_2378'><pre>2378</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> match(Op0, m_c_And(m_Specific(A), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2379' href='#L_ANDXOR_2379'><pre>2379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(Builder->CreateNot(A), B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2380' href='#L_ANDXOR_2380'><pre>2380</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2381' href='#L_ANDXOR_2381'><pre>2381</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>SwappedForXor<span class='tooltip-content'>100k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2382' href='#L_ANDXOR_2382'><pre>2382</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2383' href='#L_ANDXOR_2383'><pre>2383</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2384' href='#L_ANDXOR_2384'><pre>2384</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2385' href='#L_ANDXOR_2385'><pre>2385</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> ICmpInst *LHS = dyn_cast<ICmpInst>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2386' href='#L_ANDXOR_2386'><pre>2386</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> ICmpInst *RHS = dyn_cast<ICmpInst>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2387' href='#L_ANDXOR_2387'><pre>2387</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS && <span class='tooltip-content'>100k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>30.1k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2388' href='#L_ANDXOR_2388'><pre>2388</pre></a></td><td class='covered-line'><pre>27.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>27.3k</span></div><div class='tooltip'>Res<span class='tooltip-content'>27.3k</span></div> = FoldOrOfICmps(LHS, RHS, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2389' href='#L_ANDXOR_2389'><pre>2389</pre></a></td><td class='covered-line'><pre>298</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Res);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2390' href='#L_ANDXOR_2390'><pre>2390</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2391' href='#L_ANDXOR_2391'><pre>2391</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // TODO: Make this recursive; it's a little tricky because an arbitrary</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2392' href='#L_ANDXOR_2392'><pre>2392</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // number of 'or' instructions might have to be created.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2393' href='#L_ANDXOR_2393'><pre>2393</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> Value *X, *Y;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2394' href='#L_ANDXOR_2394'><pre>2394</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS && <span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op1, m_OneUse(m_Or(m_Value(X), m_Value(Y))))<span class='tooltip-content'>29.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>651</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2395' href='#L_ANDXOR_2395'><pre>2395</pre></a></td><td class='covered-line'><pre>651</pre></td><td class='code'><pre> if (auto *Cmp = dyn_cast<ICmpInst>(X))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2396' href='#L_ANDXOR_2396'><pre>2396</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>604</span></div><div class='tooltip'>Res<span class='tooltip-content'>604</span></div> = FoldOrOfICmps(LHS, Cmp, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2397' href='#L_ANDXOR_2397'><pre>2397</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateOr(Res, Y));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2398' href='#L_ANDXOR_2398'><pre>2398</pre></a></td><td class='covered-line'><pre>650</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>650</span></div><div class='tooltip'>Cmp<span class='tooltip-content'>650</span></div> = dyn_cast<ICmpInst>(Y))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2399' href='#L_ANDXOR_2399'><pre>2399</pre></a></td><td class='covered-line'><pre>454</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>454</span></div><div class='tooltip'>Res<span class='tooltip-content'>454</span></div> = FoldOrOfICmps(LHS, Cmp, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2400' href='#L_ANDXOR_2400'><pre>2400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, Builder->CreateOr(Res, X))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2401' href='#L_ANDXOR_2401'><pre>2401</pre></a></td><td class='covered-line'><pre>650</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2402' href='#L_ANDXOR_2402'><pre>2402</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>RHS && <span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_OneUse(m_Or(m_Value(X), m_Value(Y))))<span class='tooltip-content'>28.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>829</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2403' href='#L_ANDXOR_2403'><pre>2403</pre></a></td><td class='covered-line'><pre>829</pre></td><td class='code'><pre> if (auto *Cmp = dyn_cast<ICmpInst>(X))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2404' href='#L_ANDXOR_2404'><pre>2404</pre></a></td><td class='covered-line'><pre>543</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>543</span></div><div class='tooltip'>Res<span class='tooltip-content'>543</span></div> = FoldOrOfICmps(Cmp, RHS, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2405' href='#L_ANDXOR_2405'><pre>2405</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateOr(Res, Y));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2406' href='#L_ANDXOR_2406'><pre>2406</pre></a></td><td class='covered-line'><pre>815</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>815</span></div><div class='tooltip'>Cmp<span class='tooltip-content'>815</span></div> = dyn_cast<ICmpInst>(Y))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2407' href='#L_ANDXOR_2407'><pre>2407</pre></a></td><td class='covered-line'><pre>763</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>763</span></div><div class='tooltip'>Res<span class='tooltip-content'>763</span></div> = FoldOrOfICmps(Cmp, RHS, &I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2408' href='#L_ANDXOR_2408'><pre>2408</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Builder->CreateOr(Res, X));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2409' href='#L_ANDXOR_2409'><pre>2409</pre></a></td><td class='covered-line'><pre>815</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2410' href='#L_ANDXOR_2410'><pre>2410</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2411' href='#L_ANDXOR_2411'><pre>2411</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2412' href='#L_ANDXOR_2412'><pre>2412</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (fcmp uno x, c) | (fcmp uno y, c) -> (fcmp uno x, y)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2413' href='#L_ANDXOR_2413'><pre>2413</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (FCmpInst *<span class='tooltip-content'>100k</span></div><div class='tooltip'>LHS<span class='tooltip-content'>100k</span></div> = dyn_cast<FCmpInst>(I.getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2414' href='#L_ANDXOR_2414'><pre>2414</pre></a></td><td class='covered-line'><pre>728</pre></td><td class='code'><pre> <div class='tooltip'>if (FCmpInst *<span class='tooltip-content'>728</span></div><div class='tooltip'>RHS<span class='tooltip-content'>728</span></div> = dyn_cast<FCmpInst>(I.getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2415' href='#L_ANDXOR_2415'><pre>2415</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>639</span></div><div class='tooltip'>Res<span class='tooltip-content'>639</span></div> = FoldOrOfFCmps(LHS, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2416' href='#L_ANDXOR_2416'><pre>2416</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Res);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2417' href='#L_ANDXOR_2417'><pre>2417</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2418' href='#L_ANDXOR_2418'><pre>2418</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>100k</span></div><div class='tooltip'>CastedOr<span class='tooltip-content'>100k</span></div> = foldCastedBitwiseLogic(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2419' href='#L_ANDXOR_2419'><pre>2419</pre></a></td><td class='covered-line'><pre>164</pre></td><td class='code'><pre> return CastedOr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2420' href='#L_ANDXOR_2420'><pre>2420</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2421' href='#L_ANDXOR_2421'><pre>2421</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // or(sext(A), B) / or(B, sext(A)) --> A ? -1 : B, where A is i1 or <N x i1>.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2422' href='#L_ANDXOR_2422'><pre>2422</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op0, m_OneUse(m_SExt(m_Value(A)))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2423' href='#L_ANDXOR_2423'><pre>2423</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> A->getType()->getScalarType()->isIntegerTy(1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2424' href='#L_ANDXOR_2424'><pre>2424</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2425' href='#L_ANDXOR_2425'><pre>2425</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>match(Op1, m_OneUse(m_SExt(m_Value(A)))) &&<span class='tooltip-content'>100k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2426' href='#L_ANDXOR_2426'><pre>2426</pre></a></td><td class='covered-line'><pre>164</pre></td><td class='code'><pre> A->getType()->getScalarType()->isIntegerTy(1))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2427' href='#L_ANDXOR_2427'><pre>2427</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2428' href='#L_ANDXOR_2428'><pre>2428</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2429' href='#L_ANDXOR_2429'><pre>2429</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Note: If we've gotten to the point of visiting the outer OR, then the</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2430' href='#L_ANDXOR_2430'><pre>2430</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // inner one couldn't be simplified. If it was a constant, then it won't</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2431' href='#L_ANDXOR_2431'><pre>2431</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // be simplified by a later pass either, so we try swapping the inner/outer</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2432' href='#L_ANDXOR_2432'><pre>2432</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // ORs in the hopes that we'll be able to simplify it this way.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2433' href='#L_ANDXOR_2433'><pre>2433</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // (X|C) | V --> (X|V) | C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2434' href='#L_ANDXOR_2434'><pre>2434</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100k</span></div><div class='tooltip'>Op0->hasOneUse() && <span class='tooltip-content'>100k</span></div><div class='tooltip'>!isa<ConstantInt>(Op1)<span class='tooltip-content'>82.5k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2435' href='#L_ANDXOR_2435'><pre>2435</pre></a></td><td class='covered-line'><pre>67.6k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op0, m_Or(m_Value(A), m_ConstantInt(C1)))<span class='tooltip-content'>67.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>11</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2436' href='#L_ANDXOR_2436'><pre>2436</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Value *Inner = Builder->CreateOr(A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2437' href='#L_ANDXOR_2437'><pre>2437</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Inner->takeName(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2438' href='#L_ANDXOR_2438'><pre>2438</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(Inner, C1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2439' href='#L_ANDXOR_2439'><pre>2439</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2440' href='#L_ANDXOR_2440'><pre>2440</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2441' href='#L_ANDXOR_2441'><pre>2441</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Change (or (bool?A:B),(bool?C:D)) --> (bool?(or A,C):(or B,D))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2442' href='#L_ANDXOR_2442'><pre>2442</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // Since this OR statement hasn't been optimized further yet, we hope</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2443' href='#L_ANDXOR_2443'><pre>2443</pre></a></td><td class='covered-line'><pre>100k</pre></td><td class='code'><pre> // that this transformation will allow the new ORs to be optimized.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2444' href='#L_ANDXOR_2444'><pre>2444</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2445' href='#L_ANDXOR_2445'><pre>2445</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre> Value *X = nullptr, *Y = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2446' href='#L_ANDXOR_2446'><pre>2446</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0->hasOneUse() && <span class='tooltip-content'>99.9k</span></div><div class='tooltip'>Op1->hasOneUse()<span class='tooltip-content'>82.4k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2447' href='#L_ANDXOR_2447'><pre>2447</pre></a></td><td class='covered-line'><pre>62.5k</pre></td><td class='code'><pre> match(Op0, m_Select(m_Value(X), m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2448' href='#L_ANDXOR_2448'><pre>2448</pre></a></td><td class='covered-line'><pre>213</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_Select(m_Value(Y), m_Value(C), m_Value(D)))<span class='tooltip-content'>213</span></div> && <div class='tooltip'>X == Y<span class='tooltip-content'>25</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2449' href='#L_ANDXOR_2449'><pre>2449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *orTrue = Builder->CreateOr(A, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2450' href='#L_ANDXOR_2450'><pre>2450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *orFalse = Builder->CreateOr(B, D);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2451' href='#L_ANDXOR_2451'><pre>2451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(X, orTrue, orFalse);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2452' href='#L_ANDXOR_2452'><pre>2452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2453' href='#L_ANDXOR_2453'><pre>2453</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2454' href='#L_ANDXOR_2454'><pre>2454</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2455' href='#L_ANDXOR_2455'><pre>2455</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>99.9k</span></div><div class='tooltip'>&I<span class='tooltip-content'>712</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>99.2k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2456' href='#L_ANDXOR_2456'><pre>2456</pre></a></td><td class='covered-line'><pre>99.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2457' href='#L_ANDXOR_2457'><pre>2457</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2458' href='#L_ANDXOR_2458'><pre>2458</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// FIXME: We use commutative matchers (m_c_*) for some, but not all, matches</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2459' href='#L_ANDXOR_2459'><pre>2459</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// here. We should standardize that construct where it is needed or choose some</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2460' href='#L_ANDXOR_2460'><pre>2460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// other way to ensure that commutated variants of patterns are not missed.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2461' href='#L_ANDXOR_2461'><pre>2461</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitXor(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2462' href='#L_ANDXOR_2462'><pre>2462</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2463' href='#L_ANDXOR_2463'><pre>2463</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2464' href='#L_ANDXOR_2464'><pre>2464</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2465' href='#L_ANDXOR_2465'><pre>2465</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2466' href='#L_ANDXOR_2466'><pre>2466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2467' href='#L_ANDXOR_2467'><pre>2467</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2468' href='#L_ANDXOR_2468'><pre>2468</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>48.1k</span></div><div class='tooltip'>V<span class='tooltip-content'>48.1k</span></div> = SimplifyXorInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2469' href='#L_ANDXOR_2469'><pre>2469</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2470' href='#L_ANDXOR_2470'><pre>2470</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2471' href='#L_ANDXOR_2471'><pre>2471</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> // (A&B)^(A&C) -> A&(B^C) etc</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2472' href='#L_ANDXOR_2472'><pre>2472</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>48.1k</span></div><div class='tooltip'>V<span class='tooltip-content'>48.1k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2473' href='#L_ANDXOR_2473'><pre>2473</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2474' href='#L_ANDXOR_2474'><pre>2474</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2475' href='#L_ANDXOR_2475'><pre>2475</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> // See if we can simplify any instructions used by the instruction whose sole</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2476' href='#L_ANDXOR_2476'><pre>2476</pre></a></td><td class='covered-line'><pre>48.1k</pre></td><td class='code'><pre> // purpose is to compute bits we don't care about.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2477' href='#L_ANDXOR_2477'><pre>2477</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>48.0k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(I)<span class='tooltip-content'>48.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2478' href='#L_ANDXOR_2478'><pre>2478</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2479' href='#L_ANDXOR_2479'><pre>2479</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2480' href='#L_ANDXOR_2480'><pre>2480</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>48.0k</span></div><div class='tooltip'>V<span class='tooltip-content'>48.0k</span></div> = SimplifyBSwap(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2481' href='#L_ANDXOR_2481'><pre>2481</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2482' href='#L_ANDXOR_2482'><pre>2482</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2483' href='#L_ANDXOR_2483'><pre>2483</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre> // Is this a ~ operation?</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2484' href='#L_ANDXOR_2484'><pre>2484</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>48.0k</span></div><div class='tooltip'>NotOp<span class='tooltip-content'>48.0k</span></div> = dyn_castNotVal(&I)) <div class='tooltip'>{<span class='tooltip-content'>31.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2485' href='#L_ANDXOR_2485'><pre>2485</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> if (BinaryOperator *<div class='tooltip'>Op0I<span class='tooltip-content'>31.0k</span></div> = dyn_cast<BinaryOperator>(NotOp)) <div class='tooltip'>{<span class='tooltip-content'>17.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2486' href='#L_ANDXOR_2486'><pre>2486</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> if (Op0I->getOpcode() == Instruction::And ||</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2487' href='#L_ANDXOR_2487'><pre>2487</pre></a></td><td class='covered-line'><pre>16.7k</pre></td><td class='code'><pre> <div class='tooltip'>Op0I->getOpcode() == Instruction::Or<span class='tooltip-content'>16.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>934</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2488' href='#L_ANDXOR_2488'><pre>2488</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> // ~(~X & Y) --> (X | ~Y) - De Morgan's Law</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2489' href='#L_ANDXOR_2489'><pre>2489</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> // ~(~X | Y) === (X & ~Y) - De Morgan's Law</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2490' href='#L_ANDXOR_2490'><pre>2490</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> if (dyn_castNotVal(Op0I->getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2491' href='#L_ANDXOR_2491'><pre>2491</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Op0I->swapOperands();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2492' href='#L_ANDXOR_2492'><pre>2492</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>Op0NotVal<span class='tooltip-content'>934</span></div> = dyn_castNotVal(Op0I->getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2493' href='#L_ANDXOR_2493'><pre>2493</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *NotY =</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2494' href='#L_ANDXOR_2494'><pre>2494</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Builder->CreateNot(Op0I->getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2495' href='#L_ANDXOR_2495'><pre>2495</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Op0I->getOperand(1)->getName()+".not");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2496' href='#L_ANDXOR_2496'><pre>2496</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (Op0I->getOpcode() == Instruction::And)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2497' href='#L_ANDXOR_2497'><pre>2497</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(Op0NotVal, NotY);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2498' href='#L_ANDXOR_2498'><pre>2498</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Op0NotVal, NotY);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2499' href='#L_ANDXOR_2499'><pre>2499</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2500' href='#L_ANDXOR_2500'><pre>2500</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2501' href='#L_ANDXOR_2501'><pre>2501</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> // ~(X & Y) --> (~X | ~Y) - De Morgan's Law</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2502' href='#L_ANDXOR_2502'><pre>2502</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> // ~(X | Y) === (~X & ~Y) - De Morgan's Law</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2503' href='#L_ANDXOR_2503'><pre>2503</pre></a></td><td class='covered-line'><pre>928</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>928</span></div><div class='tooltip'>IsFreeToInvert(Op0I->getOperand(0),<span class='tooltip-content'>928</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2504' href='#L_ANDXOR_2504'><pre>2504</pre></a></td><td class='covered-line'><pre>928</pre></td><td class='code'><pre> Op0I->getOperand(0)->hasOneUse()) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2505' href='#L_ANDXOR_2505'><pre>2505</pre></a></td><td class='covered-line'><pre>340</pre></td><td class='code'><pre> IsFreeToInvert(Op0I->getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2506' href='#L_ANDXOR_2506'><pre>2506</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> Op0I->getOperand(1)->hasOneUse())) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2507' href='#L_ANDXOR_2507'><pre>2507</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> Value *NotX =</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2508' href='#L_ANDXOR_2508'><pre>2508</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> Builder->CreateNot(Op0I->getOperand(0), "notlhs");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2509' href='#L_ANDXOR_2509'><pre>2509</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> Value *NotY =</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2510' href='#L_ANDXOR_2510'><pre>2510</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> Builder->CreateNot(Op0I->getOperand(1), "notrhs");</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2511' href='#L_ANDXOR_2511'><pre>2511</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> if (Op0I->getOpcode() == Instruction::And)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2512' href='#L_ANDXOR_2512'><pre>2512</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(NotX, NotY);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2513' href='#L_ANDXOR_2513'><pre>2513</pre></a></td><td class='covered-line'><pre>138</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NotX, NotY);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2514' href='#L_ANDXOR_2514'><pre>2514</pre></a></td><td class='covered-line'><pre>204</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2515' href='#L_ANDXOR_2515'><pre>2515</pre></a></td><td class='covered-line'><pre>928</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2516' href='#L_ANDXOR_2516'><pre>2516</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>16.1k</span></div><div class='tooltip'>Op0I->getOpcode() == Instruction::AShr<span class='tooltip-content'>16.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2517' href='#L_ANDXOR_2517'><pre>2517</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // ~(~X >>s Y) --> (X >>s Y)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2518' href='#L_ANDXOR_2518'><pre>2518</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (Value *Op0NotVal = dyn_castNotVal(Op0I->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2519' href='#L_ANDXOR_2519'><pre>2519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAShr(Op0NotVal, Op0I->getOperand(1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2520' href='#L_ANDXOR_2520'><pre>2520</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2521' href='#L_ANDXOR_2521'><pre>2521</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2522' href='#L_ANDXOR_2522'><pre>2522</pre></a></td><td class='covered-line'><pre>31.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2523' href='#L_ANDXOR_2523'><pre>2523</pre></a></td><td class='covered-line'><pre>48.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2524' href='#L_ANDXOR_2524'><pre>2524</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>47.8k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>47.8k</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>35.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2525' href='#L_ANDXOR_2525'><pre>2525</pre></a></td><td class='covered-line'><pre>35.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>RHS->isAllOnesValue() && <span class='tooltip-content'>35.5k</span></div><div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>32.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2526' href='#L_ANDXOR_2526'><pre>2526</pre></a></td><td class='covered-line'><pre>35.5k</pre></td><td class='code'><pre> // xor (cmp A, B), true = not (cmp A, B) = !cmp A, B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2527' href='#L_ANDXOR_2527'><pre>2527</pre></a></td><td class='covered-line'><pre>20.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (CmpInst *<span class='tooltip-content'>20.1k</span></div><div class='tooltip'>CI<span class='tooltip-content'>20.1k</span></div> = dyn_cast<CmpInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2528' href='#L_ANDXOR_2528'><pre>2528</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> return CmpInst::Create(CI->getOpcode(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2529' href='#L_ANDXOR_2529'><pre>2529</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> CI->getInversePredicate(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2530' href='#L_ANDXOR_2530'><pre>2530</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> CI->getOperand(0), CI->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2531' href='#L_ANDXOR_2531'><pre>2531</pre></a></td><td class='covered-line'><pre>35.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2532' href='#L_ANDXOR_2532'><pre>2532</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2533' href='#L_ANDXOR_2533'><pre>2533</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>45.9k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>45.9k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>33.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2534' href='#L_ANDXOR_2534'><pre>2534</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> // fold (xor(zext(cmp)), 1) and (xor(sext(cmp)), -1) to ext(!cmp).</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2535' href='#L_ANDXOR_2535'><pre>2535</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> if (CastInst *<div class='tooltip'>Op0C<span class='tooltip-content'>33.5k</span></div> = dyn_cast<CastInst>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>857</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2536' href='#L_ANDXOR_2536'><pre>2536</pre></a></td><td class='covered-line'><pre>857</pre></td><td class='code'><pre> if (CmpInst *<div class='tooltip'>CI<span class='tooltip-content'>857</span></div> = dyn_cast<CmpInst>(Op0C->getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>17</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2537' href='#L_ANDXOR_2537'><pre>2537</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> if (<div class='tooltip'>CI->hasOneUse() && <span class='tooltip-content'>17</span></div><div class='tooltip'>Op0C->hasOneUse()<span class='tooltip-content'>3</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2538' href='#L_ANDXOR_2538'><pre>2538</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Instruction::CastOps Opcode = Op0C->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2539' href='#L_ANDXOR_2539'><pre>2539</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>(Opcode == Instruction::ZExt || <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>Opcode == Instruction::SExt</span><span class='tooltip-content'>0</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2540' href='#L_ANDXOR_2540'><pre>2540</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> (RHS == ConstantExpr::getCast(Opcode, Builder->getTrue(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2541' href='#L_ANDXOR_2541'><pre>2541</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Op0C->getDestTy()))) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2542' href='#L_ANDXOR_2542'><pre>2542</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> CI->setPredicate(CI->getInversePredicate());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2543' href='#L_ANDXOR_2543'><pre>2543</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return CastInst::Create(Opcode, CI, Op0C->getType());</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2544' href='#L_ANDXOR_2544'><pre>2544</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2545' href='#L_ANDXOR_2545'><pre>2545</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2546' href='#L_ANDXOR_2546'><pre>2546</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2547' href='#L_ANDXOR_2547'><pre>2547</pre></a></td><td class='covered-line'><pre>857</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2548' href='#L_ANDXOR_2548'><pre>2548</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2549' href='#L_ANDXOR_2549'><pre>2549</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (BinaryOperator *<span class='tooltip-content'>33.5k</span></div><div class='tooltip'>Op0I<span class='tooltip-content'>33.5k</span></div> = dyn_cast<BinaryOperator>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>17.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2550' href='#L_ANDXOR_2550'><pre>2550</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> // ~(c-X) == X-c-1 == X+(-c-1)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2551' href='#L_ANDXOR_2551'><pre>2551</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0I->getOpcode() == Instruction::Sub && <span class='tooltip-content'>17.7k</span></div><div class='tooltip'><span class='red'>RHS->isAllOnesValue()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2552' href='#L_ANDXOR_2552'><pre>2552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (Constant *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op0I0C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Op0I->getOperand(0))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2553' href='#L_ANDXOR_2553'><pre>2553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *NegOp0I0C = ConstantExpr::getNeg(Op0I0C);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2554' href='#L_ANDXOR_2554'><pre>2554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *ConstantRHS = ConstantExpr::getSub(NegOp0I0C,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2555' href='#L_ANDXOR_2555'><pre>2555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(I.getType(), 1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2556' href='#L_ANDXOR_2556'><pre>2556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAdd(Op0I->getOperand(1), ConstantRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2557' href='#L_ANDXOR_2557'><pre>2557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2558' href='#L_ANDXOR_2558'><pre>2558</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2559' href='#L_ANDXOR_2559'><pre>2559</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>17.7k</span></div><div class='tooltip'>Op0CI<span class='tooltip-content'>17.7k</span></div> = dyn_cast<ConstantInt>(Op0I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>16.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2560' href='#L_ANDXOR_2560'><pre>2560</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0I->getOpcode() == Instruction::Add<span class='tooltip-content'>16.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>39</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2561' href='#L_ANDXOR_2561'><pre>2561</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> // ~(X-c) --> (-c-1)-X</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2562' href='#L_ANDXOR_2562'><pre>2562</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> if (<div class='tooltip'>RHS->isAllOnesValue()<span class='tooltip-content'>39</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2563' href='#L_ANDXOR_2563'><pre>2563</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Constant *NegOp0CI = ConstantExpr::getNeg(Op0CI);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2564' href='#L_ANDXOR_2564'><pre>2564</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2565' href='#L_ANDXOR_2565'><pre>2565</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> ConstantExpr::getSub(NegOp0CI,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2566' href='#L_ANDXOR_2566'><pre>2566</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> ConstantInt::get(I.getType(), 1)),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2567' href='#L_ANDXOR_2567'><pre>2567</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Op0I->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2568' href='#L_ANDXOR_2568'><pre>2568</pre></a></td><td class='covered-line'><pre>31</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>31</span></div><div class='tooltip'>RHS->getValue().isSignBit()<span class='tooltip-content'>31</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2569' href='#L_ANDXOR_2569'><pre>2569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X + C) ^ signbit -> (X + C + signbit)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2570' href='#L_ANDXOR_2570'><pre>2570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C = Builder->getInt(RHS->getValue() + Op0CI->getValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2571' href='#L_ANDXOR_2571'><pre>2571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAdd(Op0I->getOperand(0), C);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2572' href='#L_ANDXOR_2572'><pre>2572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2573' href='#L_ANDXOR_2573'><pre>2573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2574' href='#L_ANDXOR_2574'><pre>2574</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>16.2k</span></div><div class='tooltip'>Op0I->getOpcode() == Instruction::Or<span class='tooltip-content'>16.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>33</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2575' href='#L_ANDXOR_2575'><pre>2575</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2576' href='#L_ANDXOR_2576'><pre>2576</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> if (MaskedValueIsZero(Op0I->getOperand(0), Op0CI->getValue(),</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2577' href='#L_ANDXOR_2577'><pre>2577</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> 0, &I)) {</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2578' href='#L_ANDXOR_2578'><pre>2578</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Constant *NewRHS = ConstantExpr::getOr(Op0CI, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2579' href='#L_ANDXOR_2579'><pre>2579</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Anything in both C1 and C2 is known to be zero, remove it from</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2580' href='#L_ANDXOR_2580'><pre>2580</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // NewRHS.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2581' href='#L_ANDXOR_2581'><pre>2581</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Constant *CommonBits = ConstantExpr::getAnd(Op0CI, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2582' href='#L_ANDXOR_2582'><pre>2582</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> NewRHS = ConstantExpr::getAnd(NewRHS,</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2583' href='#L_ANDXOR_2583'><pre>2583</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ConstantExpr::getNot(CommonBits));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2584' href='#L_ANDXOR_2584'><pre>2584</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Worklist.Add(Op0I);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2585' href='#L_ANDXOR_2585'><pre>2585</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> I.setOperand(0, Op0I->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2586' href='#L_ANDXOR_2586'><pre>2586</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> I.setOperand(1, NewRHS);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2587' href='#L_ANDXOR_2587'><pre>2587</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2588' href='#L_ANDXOR_2588'><pre>2588</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2589' href='#L_ANDXOR_2589'><pre>2589</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>16.2k</span></div><div class='tooltip'>Op0I->getOpcode() == Instruction::LShr<span class='tooltip-content'>16.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.67k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2590' href='#L_ANDXOR_2590'><pre>2590</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> // ((X^C1) >> C2) ^ C3 -> (X>>C2) ^ ((C1>>C2)^C3)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2591' href='#L_ANDXOR_2591'><pre>2591</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> // E1 = "X ^ C1"</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2592' href='#L_ANDXOR_2592'><pre>2592</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> BinaryOperator *E1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2593' href='#L_ANDXOR_2593'><pre>2593</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> ConstantInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2594' href='#L_ANDXOR_2594'><pre>2594</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> if (Op0I->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2595' href='#L_ANDXOR_2595'><pre>2595</pre></a></td><td class='covered-line'><pre>3.57k</pre></td><td class='code'><pre> (E1 = dyn_cast<BinaryOperator>(Op0I->getOperand(0))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2596' href='#L_ANDXOR_2596'><pre>2596</pre></a></td><td class='covered-line'><pre>3.45k</pre></td><td class='code'><pre> E1->getOpcode() == Instruction::Xor &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2597' href='#L_ANDXOR_2597'><pre>2597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>(C1 = dyn_cast<ConstantInt>(E1->getOperand(1)))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2598' href='#L_ANDXOR_2598'><pre>2598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fold (C1 >> C2) ^ C3</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2599' href='#L_ANDXOR_2599'><pre>2599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *C2 = Op0CI, *C3 = RHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2600' href='#L_ANDXOR_2600'><pre>2600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt FoldConst = C1->getValue().lshr(C2->getValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2601' href='#L_ANDXOR_2601'><pre>2601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FoldConst ^= C3->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2602' href='#L_ANDXOR_2602'><pre>2602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Prepare the two operands.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2603' href='#L_ANDXOR_2603'><pre>2603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0 = Builder->CreateLShr(E1->getOperand(0), C2);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2604' href='#L_ANDXOR_2604'><pre>2604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Opnd0->takeName(Op0I);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2605' href='#L_ANDXOR_2605'><pre>2605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<Instruction>(Opnd0)->setDebugLoc(I.getDebugLoc());</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2606' href='#L_ANDXOR_2606'><pre>2606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *FoldVal = ConstantInt::get(Opnd0->getType(), FoldConst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2607' href='#L_ANDXOR_2607'><pre>2607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2608' href='#L_ANDXOR_2608'><pre>2608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(Opnd0, FoldVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2609' href='#L_ANDXOR_2609'><pre>2609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2610' href='#L_ANDXOR_2610'><pre>2610</pre></a></td><td class='covered-line'><pre>3.67k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2611' href='#L_ANDXOR_2611'><pre>2611</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2612' href='#L_ANDXOR_2612'><pre>2612</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2613' href='#L_ANDXOR_2613'><pre>2613</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2614' href='#L_ANDXOR_2614'><pre>2614</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>33.5k</span></div><div class='tooltip'>FoldedLogic<span class='tooltip-content'>33.5k</span></div> = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2615' href='#L_ANDXOR_2615'><pre>2615</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> return FoldedLogic;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2616' href='#L_ANDXOR_2616'><pre>2616</pre></a></td><td class='covered-line'><pre>33.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2617' href='#L_ANDXOR_2617'><pre>2617</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2618' href='#L_ANDXOR_2618'><pre>2618</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> BinaryOperator *Op1I = dyn_cast<BinaryOperator>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2619' href='#L_ANDXOR_2619'><pre>2619</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op1I<span class='tooltip-content'>45.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.55k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2620' href='#L_ANDXOR_2620'><pre>2620</pre></a></td><td class='covered-line'><pre>6.55k</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2621' href='#L_ANDXOR_2621'><pre>2621</pre></a></td><td class='covered-line'><pre>6.55k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1I, m_Or(m_Value(A), m_Value(B)))<span class='tooltip-content'>6.55k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.28k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2622' href='#L_ANDXOR_2622'><pre>2622</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> if (<div class='tooltip'>A == Op0<span class='tooltip-content'>2.28k</span></div>) <div class='tooltip'>{ // B^(B|A) == (A|B)^B<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2623' href='#L_ANDXOR_2623'><pre>2623</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Op1I->swapOperands();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2624' href='#L_ANDXOR_2624'><pre>2624</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> I.swapOperands();</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2625' href='#L_ANDXOR_2625'><pre>2625</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2626' href='#L_ANDXOR_2626'><pre>2626</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>2.28k</span></div><div class='tooltip'>B == Op0<span class='tooltip-content'>2.28k</span></div>) <div class='tooltip'>{ // B^(A|B) == (A|B)^B<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2627' href='#L_ANDXOR_2627'><pre>2627</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> I.swapOperands(); // Simplified below.</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2628' href='#L_ANDXOR_2628'><pre>2628</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2629' href='#L_ANDXOR_2629'><pre>2629</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2630' href='#L_ANDXOR_2630'><pre>2630</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>4.26k</span></div><div class='tooltip'>match(Op1I, m_And(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>4.26k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2631' href='#L_ANDXOR_2631'><pre>2631</pre></a></td><td class='covered-line'><pre>591</pre></td><td class='code'><pre> <div class='tooltip'>Op1I->hasOneUse()<span class='tooltip-content'>591</span></div>)<div class='tooltip'>{<span class='tooltip-content'>583</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2632' href='#L_ANDXOR_2632'><pre>2632</pre></a></td><td class='covered-line'><pre>583</pre></td><td class='code'><pre> if (<div class='tooltip'>A == Op0<span class='tooltip-content'>583</span></div>) <div class='tooltip'><span class='red'>{ // A^(A&B) -> A^(B&A)</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2633' href='#L_ANDXOR_2633'><pre>2633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1I->swapOperands();</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2634' href='#L_ANDXOR_2634'><pre>2634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2635' href='#L_ANDXOR_2635'><pre>2635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2636' href='#L_ANDXOR_2636'><pre>2636</pre></a></td><td class='covered-line'><pre>583</pre></td><td class='code'><pre> if (<div class='tooltip'>B == Op0<span class='tooltip-content'>583</span></div>) <div class='tooltip'><span class='red'>{ // A^(B&A) -> (B&A)^A</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2637' href='#L_ANDXOR_2637'><pre>2637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.swapOperands(); // Simplified below.</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2638' href='#L_ANDXOR_2638'><pre>2638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2639' href='#L_ANDXOR_2639'><pre>2639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2640' href='#L_ANDXOR_2640'><pre>2640</pre></a></td><td class='covered-line'><pre>583</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2641' href='#L_ANDXOR_2641'><pre>2641</pre></a></td><td class='covered-line'><pre>6.55k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2642' href='#L_ANDXOR_2642'><pre>2642</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2643' href='#L_ANDXOR_2643'><pre>2643</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2644' href='#L_ANDXOR_2644'><pre>2644</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0I<span class='tooltip-content'>45.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>26.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2645' href='#L_ANDXOR_2645'><pre>2645</pre></a></td><td class='covered-line'><pre>26.8k</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2646' href='#L_ANDXOR_2646'><pre>2646</pre></a></td><td class='covered-line'><pre>26.8k</pre></td><td class='code'><pre> if (match(Op0I, m_Or(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2647' href='#L_ANDXOR_2647'><pre>2647</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> <div class='tooltip'>Op0I->hasOneUse()<span class='tooltip-content'>2.27k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.91k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2648' href='#L_ANDXOR_2648'><pre>2648</pre></a></td><td class='covered-line'><pre>1.91k</pre></td><td class='code'><pre> if (A == Op1) // (B|A)^B == (A|B)^B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2649' href='#L_ANDXOR_2649'><pre>2649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>std::swap(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2650' href='#L_ANDXOR_2650'><pre>2650</pre></a></td><td class='covered-line'><pre>1.91k</pre></td><td class='code'><pre> if (B == Op1) // (A|B)^B == A & ~B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2651' href='#L_ANDXOR_2651'><pre>2651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(A, Builder->CreateNot(Op1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2652' href='#L_ANDXOR_2652'><pre>2652</pre></a></td><td class='covered-line'><pre>24.8k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>24.8k</span></div><div class='tooltip'>match(Op0I, m_And(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>24.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2653' href='#L_ANDXOR_2653'><pre>2653</pre></a></td><td class='covered-line'><pre>2.39k</pre></td><td class='code'><pre> <div class='tooltip'>Op0I->hasOneUse()<span class='tooltip-content'>2.39k</span></div>)<div class='tooltip'>{<span class='tooltip-content'>2.20k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2654' href='#L_ANDXOR_2654'><pre>2654</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> if (A == Op1) // (A&B)^A -> (B&A)^A</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2655' href='#L_ANDXOR_2655'><pre>2655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>std::swap(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2656' href='#L_ANDXOR_2656'><pre>2656</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> if (B == Op1 && // (B&A)^A == ~B & A</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2657' href='#L_ANDXOR_2657'><pre>2657</pre></a></td><td class='covered-line'><pre>221</pre></td><td class='code'><pre> <div class='tooltip'>!isa<ConstantInt>(Op1)<span class='tooltip-content'>221</span></div>) <div class='tooltip'><span class='red'>{ // Canonical form is (B&C)^C</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2658' href='#L_ANDXOR_2658'><pre>2658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(Builder->CreateNot(A), Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2659' href='#L_ANDXOR_2659'><pre>2659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2660' href='#L_ANDXOR_2660'><pre>2660</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2661' href='#L_ANDXOR_2661'><pre>2661</pre></a></td><td class='covered-line'><pre>26.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2662' href='#L_ANDXOR_2662'><pre>2662</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2663' href='#L_ANDXOR_2663'><pre>2663</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>45.8k</span></div><div class='tooltip'>Op0I && <span class='tooltip-content'>45.8k</span></div><div class='tooltip'>Op1I<span class='tooltip-content'>26.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2664' href='#L_ANDXOR_2664'><pre>2664</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> Value *A, *B, *C, *D;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2665' href='#L_ANDXOR_2665'><pre>2665</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A & B)^(A | B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2666' href='#L_ANDXOR_2666'><pre>2666</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> if (match(Op0I, m_And(m_Value(A), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2667' href='#L_ANDXOR_2667'><pre>2667</pre></a></td><td class='covered-line'><pre>994</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1I, m_Or(m_Value(C), m_Value(D)))<span class='tooltip-content'>994</span></div>) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2668' href='#L_ANDXOR_2668'><pre>2668</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>(A == C && <span class='tooltip-content'>100</span></div><div class='tooltip'><span class='red'>B == D</span><span class='tooltip-content'>0</span></div>) || <div class='tooltip'>(A == D && <span class='tooltip-content'>100</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2669' href='#L_ANDXOR_2669'><pre>2669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2670' href='#L_ANDXOR_2670'><pre>2670</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2671' href='#L_ANDXOR_2671'><pre>2671</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A | B)^(A & B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2672' href='#L_ANDXOR_2672'><pre>2672</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_Or(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2673' href='#L_ANDXOR_2673'><pre>2673</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1I, m_And(m_Value(C), m_Value(D)))<span class='tooltip-content'>1.51k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>54</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2674' href='#L_ANDXOR_2674'><pre>2674</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> if (<div class='tooltip'>(A == C && <span class='tooltip-content'>54</span></div><div class='tooltip'><span class='red'>B == D</span><span class='tooltip-content'>0</span></div>) || <div class='tooltip'>(A == D && <span class='tooltip-content'>54</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2675' href='#L_ANDXOR_2675'><pre>2675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2676' href='#L_ANDXOR_2676'><pre>2676</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2677' href='#L_ANDXOR_2677'><pre>2677</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A | ~B) ^ (~A | B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2678' href='#L_ANDXOR_2678'><pre>2678</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (~B | A) ^ (~A | B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2679' href='#L_ANDXOR_2679'><pre>2679</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_c_Or(m_Value(A), m_Not(m_Value(B)))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2680' href='#L_ANDXOR_2680'><pre>2680</pre></a></td><td class='covered-line'><pre>160</pre></td><td class='code'><pre> match(Op1I, m_Or(m_Not(m_Specific(A)), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2681' href='#L_ANDXOR_2681'><pre>2681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2682' href='#L_ANDXOR_2682'><pre>2682</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2683' href='#L_ANDXOR_2683'><pre>2683</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (~A | B) ^ (A | ~B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2684' href='#L_ANDXOR_2684'><pre>2684</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_Or(m_Not(m_Value(A)), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2685' href='#L_ANDXOR_2685'><pre>2685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(Op1I, m_Or(m_Specific(A), m_Not(m_Specific(B))))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2686' href='#L_ANDXOR_2686'><pre>2686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2687' href='#L_ANDXOR_2687'><pre>2687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2688' href='#L_ANDXOR_2688'><pre>2688</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A & ~B) ^ (~A & B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2689' href='#L_ANDXOR_2689'><pre>2689</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (~B & A) ^ (~A & B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2690' href='#L_ANDXOR_2690'><pre>2690</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2691' href='#L_ANDXOR_2691'><pre>2691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(Op1I, m_And(m_Not(m_Specific(A)), m_Specific(B)))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2692' href='#L_ANDXOR_2692'><pre>2692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2693' href='#L_ANDXOR_2693'><pre>2693</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2694' href='#L_ANDXOR_2694'><pre>2694</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (~A & B) ^ (A & ~B) -> A ^ B</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2695' href='#L_ANDXOR_2695'><pre>2695</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_And(m_Not(m_Value(A)), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2696' href='#L_ANDXOR_2696'><pre>2696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(Op1I, m_And(m_Specific(A), m_Not(m_Specific(B))))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2697' href='#L_ANDXOR_2697'><pre>2697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2698' href='#L_ANDXOR_2698'><pre>2698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2699' href='#L_ANDXOR_2699'><pre>2699</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A ^ C)^(A | B) -> ((~A) & B) ^ C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2700' href='#L_ANDXOR_2700'><pre>2700</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_Xor(m_Value(D), m_Value(C))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2701' href='#L_ANDXOR_2701'><pre>2701</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1I, m_Or(m_Value(A), m_Value(B)))<span class='tooltip-content'>1.67k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.04k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2702' href='#L_ANDXOR_2702'><pre>2702</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre> if (D == A)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2703' href='#L_ANDXOR_2703'><pre>2703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2704' href='#L_ANDXOR_2704'><pre>2704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateAnd(Builder->CreateNot(A), B), C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2705' href='#L_ANDXOR_2705'><pre>2705</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.04k</span></div><div class='tooltip'>D == B<span class='tooltip-content'>1.04k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2706' href='#L_ANDXOR_2706'><pre>2706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateXor(</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2707' href='#L_ANDXOR_2707'><pre>2707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateAnd(Builder->CreateNot(B), A), C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2708' href='#L_ANDXOR_2708'><pre>2708</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2709' href='#L_ANDXOR_2709'><pre>2709</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A | B)^(A ^ C) -> ((~A) & B) ^ C</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2710' href='#L_ANDXOR_2710'><pre>2710</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_Or(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2711' href='#L_ANDXOR_2711'><pre>2711</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1I, m_Xor(m_Value(D), m_Value(C)))<span class='tooltip-content'>1.51k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2712' href='#L_ANDXOR_2712'><pre>2712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>D == A</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2713' href='#L_ANDXOR_2713'><pre>2713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateXor(</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2714' href='#L_ANDXOR_2714'><pre>2714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateAnd(Builder->CreateNot(A), B), C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2715' href='#L_ANDXOR_2715'><pre>2715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>D == B</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2716' href='#L_ANDXOR_2716'><pre>2716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateXor(</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2717' href='#L_ANDXOR_2717'><pre>2717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateAnd(Builder->CreateNot(B), A), C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2718' href='#L_ANDXOR_2718'><pre>2718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2719' href='#L_ANDXOR_2719'><pre>2719</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A & B) ^ (A ^ B) -> (A | B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2720' href='#L_ANDXOR_2720'><pre>2720</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_And(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2721' href='#L_ANDXOR_2721'><pre>2721</pre></a></td><td class='covered-line'><pre>994</pre></td><td class='code'><pre> match(Op1I, m_Xor(m_Specific(A), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2722' href='#L_ANDXOR_2722'><pre>2722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2723' href='#L_ANDXOR_2723'><pre>2723</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> // (A ^ B) ^ (A & B) -> (A | B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2724' href='#L_ANDXOR_2724'><pre>2724</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.03k</span></div><div class='tooltip'>match(Op0I, m_Xor(m_Value(A), m_Value(B))) &&<span class='tooltip-content'>6.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2725' href='#L_ANDXOR_2725'><pre>2725</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> match(Op1I, m_And(m_Specific(A), m_Specific(B))))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2726' href='#L_ANDXOR_2726'><pre>2726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(A, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2727' href='#L_ANDXOR_2727'><pre>2727</pre></a></td><td class='covered-line'><pre>6.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2728' href='#L_ANDXOR_2728'><pre>2728</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2729' href='#L_ANDXOR_2729'><pre>2729</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> // (A & ~B) ^ ~A -> ~(A & B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2730' href='#L_ANDXOR_2730'><pre>2730</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> // (~B & A) ^ ~A -> ~(A & B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2731' href='#L_ANDXOR_2731'><pre>2731</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2732' href='#L_ANDXOR_2732'><pre>2732</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> if (match(Op0, m_c_And(m_Value(A), m_Not(m_Value(B)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2733' href='#L_ANDXOR_2733'><pre>2733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>match(Op1, m_Not(m_Specific(A)))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2734' href='#L_ANDXOR_2734'><pre>2734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateNot(Builder->CreateAnd(A, B))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2735' href='#L_ANDXOR_2735'><pre>2735</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2736' href='#L_ANDXOR_2736'><pre>2736</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> // (icmp1 A, B) ^ (icmp2 A, B) --> (icmp3 A, B)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2737' href='#L_ANDXOR_2737'><pre>2737</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>45.8k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>45.8k</span></div> = dyn_cast<ICmpInst>(I.getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2738' href='#L_ANDXOR_2738'><pre>2738</pre></a></td><td class='covered-line'><pre>558</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>558</span></div><div class='tooltip'>LHS<span class='tooltip-content'>558</span></div> = dyn_cast<ICmpInst>(I.getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2739' href='#L_ANDXOR_2739'><pre>2739</pre></a></td><td class='covered-line'><pre>542</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>542</span></div><div class='tooltip'>PredicatesFoldable(LHS->getPredicate(), RHS->getPredicate())<span class='tooltip-content'>542</span></div>) <div class='tooltip'>{<span class='tooltip-content'>542</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2740' href='#L_ANDXOR_2740'><pre>2740</pre></a></td><td class='covered-line'><pre>542</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(1) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2741' href='#L_ANDXOR_2741'><pre>2741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHS->getOperand(1) == RHS->getOperand(0)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2742' href='#L_ANDXOR_2742'><pre>2742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHS->swapOperands()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2743' href='#L_ANDXOR_2743'><pre>2743</pre></a></td><td class='covered-line'><pre>542</pre></td><td class='code'><pre> if (LHS->getOperand(0) == RHS->getOperand(0) &&</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2744' href='#L_ANDXOR_2744'><pre>2744</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> <div class='tooltip'>LHS->getOperand(1) == RHS->getOperand(1)<span class='tooltip-content'>34</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2745' href='#L_ANDXOR_2745'><pre>2745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2746' href='#L_ANDXOR_2746'><pre>2746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Code = getICmpCode(LHS) ^ getICmpCode(RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2747' href='#L_ANDXOR_2747'><pre>2747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool isSigned = LHS->isSigned() || </span><span class='red'>RHS->isSigned()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2748' href='#L_ANDXOR_2748'><pre>2748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2749' href='#L_ANDXOR_2749'><pre>2749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> getNewICmpValue(isSigned, Code, Op0, Op1,</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2750' href='#L_ANDXOR_2750'><pre>2750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder));</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2751' href='#L_ANDXOR_2751'><pre>2751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2752' href='#L_ANDXOR_2752'><pre>2752</pre></a></td><td class='covered-line'><pre>542</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2753' href='#L_ANDXOR_2753'><pre>2753</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2754' href='#L_ANDXOR_2754'><pre>2754</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>45.8k</span></div><div class='tooltip'>CastedXor<span class='tooltip-content'>45.8k</span></div> = foldCastedBitwiseLogic(I))</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2755' href='#L_ANDXOR_2755'><pre>2755</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> return CastedXor;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2756' href='#L_ANDXOR_2756'><pre>2756</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2757' href='#L_ANDXOR_2757'><pre>2757</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>45.8k</span></div><div class='tooltip'>&I<span class='tooltip-content'>3.28k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>42.5k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ANDXOR_2758' href='#L_ANDXOR_2758'><pre>2758</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='CALLS' href='#CALLS'>lib/Transforms/InstCombine/InstCombineCalls.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_CALLS_71'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1' href='#L_CALLS_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineCalls.cpp -----------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2' href='#L_CALLS_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3' href='#L_CALLS_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4' href='#L_CALLS_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_5' href='#L_CALLS_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_6' href='#L_CALLS_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_7' href='#L_CALLS_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_8' href='#L_CALLS_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_9' href='#L_CALLS_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_10' href='#L_CALLS_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitCall and visitInvoke functions.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_11' href='#L_CALLS_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_12' href='#L_CALLS_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_13' href='#L_CALLS_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_14' href='#L_CALLS_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_15' href='#L_CALLS_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/APFloat.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_16' href='#L_CALLS_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/APInt.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_17' href='#L_CALLS_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/ArrayRef.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_18' href='#L_CALLS_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/None.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_19' href='#L_CALLS_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/Statistic.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_20' href='#L_CALLS_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/STLExtras.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_21' href='#L_CALLS_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/SmallVector.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_22' href='#L_CALLS_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/Twine.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_23' href='#L_CALLS_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_24' href='#L_CALLS_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/MemoryBuiltins.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_25' href='#L_CALLS_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ValueTracking.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_26' href='#L_CALLS_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/BasicBlock.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_27' href='#L_CALLS_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/CallSite.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_28' href='#L_CALLS_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Constant.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_29' href='#L_CALLS_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DataLayout.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_30' href='#L_CALLS_30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DerivedTypes.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_31' href='#L_CALLS_31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Function.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_32' href='#L_CALLS_32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/GlobalVariable.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_33' href='#L_CALLS_33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/InstrTypes.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_34' href='#L_CALLS_34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Instruction.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_35' href='#L_CALLS_35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Instructions.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_36' href='#L_CALLS_36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_37' href='#L_CALLS_37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Intrinsics.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_38' href='#L_CALLS_38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/LLVMContext.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_39' href='#L_CALLS_39'><pre>39</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Metadata.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_40' href='#L_CALLS_40'><pre>40</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_41' href='#L_CALLS_41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Statepoint.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_42' href='#L_CALLS_42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Type.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_43' href='#L_CALLS_43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/Value.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_44' href='#L_CALLS_44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/ValueHandle.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_45' href='#L_CALLS_45'><pre>45</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Support/Casting.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_46' href='#L_CALLS_46'><pre>46</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Support/Debug.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_47' href='#L_CALLS_47'><pre>47</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Support/MathExtras.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_48' href='#L_CALLS_48'><pre>48</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/Local.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_49' href='#L_CALLS_49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/SimplifyLibCalls.h"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_50' href='#L_CALLS_50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include <algorithm></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_51' href='#L_CALLS_51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include <cassert></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_52' href='#L_CALLS_52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include <cstdint></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_53' href='#L_CALLS_53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include <cstring></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_54' href='#L_CALLS_54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include <vector></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_55' href='#L_CALLS_55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_56' href='#L_CALLS_56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_57' href='#L_CALLS_57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_58' href='#L_CALLS_58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_59' href='#L_CALLS_59'><pre>59</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_60' href='#L_CALLS_60'><pre>60</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_61' href='#L_CALLS_61'><pre>61</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>STATISTIC(NumSimplified, "Number of library calls simplified");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_62' href='#L_CALLS_62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_63' href='#L_CALLS_63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static cl::opt<unsigned> UnfoldElementAtomicMemcpyMaxElements(</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_64' href='#L_CALLS_64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> "unfold-element-atomic-memcpy-max-elements",</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_65' href='#L_CALLS_65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cl::init(16),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_66' href='#L_CALLS_66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cl::desc("Maximum number of elements in atomic memcpy the optimizer is "</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_67' href='#L_CALLS_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> "allowed to unfold"));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_68' href='#L_CALLS_68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_69' href='#L_CALLS_69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return the specified type promoted as it would be to pass though a va_arg</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_70' href='#L_CALLS_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// area.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_71' href='#L_CALLS_71'><pre>71</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Type *getPromotedType(Type *Ty) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_72' href='#L_CALLS_72'><pre>72</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (IntegerType* </span><div class='tooltip'><span class='red'>ITy</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<IntegerType>(Ty)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_73' href='#L_CALLS_73'><pre>73</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ITy->getBitWidth() < 32</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_74' href='#L_CALLS_74'><pre>74</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Type::getInt32Ty(Ty->getContext())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_75' href='#L_CALLS_75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_76' href='#L_CALLS_76'><pre>76</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Ty</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_77' href='#L_CALLS_77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_78' href='#L_CALLS_78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_79' href='#L_CALLS_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return a constant boolean vector that has true elements in all positions</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_80' href='#L_CALLS_80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where the input constant data vector has an element with the sign bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_81' href='#L_CALLS_81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Constant *getNegativeIsTrueBoolVec(ConstantDataVector *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_82' href='#L_CALLS_82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 32> BoolVec;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_83' href='#L_CALLS_83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntegerType *BoolTy = Type::getInt1Ty(V->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_84' href='#L_CALLS_84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = V->getNumElements(); </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_85' href='#L_CALLS_85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = V->getElementAsConstant(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_86' href='#L_CALLS_86'><pre>86</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((isa<ConstantInt>(Elt) || isa<ConstantFP>(Elt)) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_87' href='#L_CALLS_87'><pre>87</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected constant data vector element type");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_88' href='#L_CALLS_88'><pre>88</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Sign = V->getElementType()->isIntegerTy()</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_89' href='#L_CALLS_89'><pre>89</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>cast<ConstantInt>(Elt)->isNegative()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_90' href='#L_CALLS_90'><pre>90</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>cast<ConstantFP>(Elt)->isNegative()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_91' href='#L_CALLS_91'><pre>91</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BoolVec.push_back(ConstantInt::get(BoolTy, Sign));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_92' href='#L_CALLS_92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_93' href='#L_CALLS_93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantVector::get(BoolVec);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_94' href='#L_CALLS_94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_95' href='#L_CALLS_95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_96' href='#L_CALLS_96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_97' href='#L_CALLS_97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>InstCombiner::SimplifyElementAtomicMemCpy(ElementAtomicMemCpyInst *AMI) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_98' href='#L_CALLS_98'><pre>98</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Try to unfold this intrinsic into sequence of explicit atomic loads and</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_99' href='#L_CALLS_99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // stores.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_100' href='#L_CALLS_100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // First check that number of elements is compile time constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_101' href='#L_CALLS_101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NumElementsCI = dyn_cast<ConstantInt>(AMI->getNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_102' href='#L_CALLS_102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!NumElementsCI</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_103' href='#L_CALLS_103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_104' href='#L_CALLS_104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_105' href='#L_CALLS_105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that there are not too many elements.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_106' href='#L_CALLS_106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>uint64_t NumElements = NumElementsCI->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_107' href='#L_CALLS_107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NumElements >= UnfoldElementAtomicMemcpyMaxElements</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_108' href='#L_CALLS_108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_109' href='#L_CALLS_109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_110' href='#L_CALLS_110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't unfold into illegal integers</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_111' href='#L_CALLS_111'><pre>111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>uint64_t ElementSizeInBytes = AMI->getElementSizeInBytes() * 8;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_112' href='#L_CALLS_112'><pre>112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!getDataLayout().isLegalInteger(ElementSizeInBytes)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_113' href='#L_CALLS_113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_114' href='#L_CALLS_114'><pre>114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_115' href='#L_CALLS_115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Cast source and destination to the correct type. Intrinsic input arguments</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_116' href='#L_CALLS_116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // are usually represented as i8*.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_117' href='#L_CALLS_117'><pre>117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Often operands will be explicitly casted to i8* and we can just strip</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_118' href='#L_CALLS_118'><pre>118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // those casts instead of inserting new ones. However it's easier to rely on</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_119' href='#L_CALLS_119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // other InstCombine rules which will cover trivial cases anyway.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_120' href='#L_CALLS_120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Src = AMI->getRawSource();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_121' href='#L_CALLS_121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Dst = AMI->getRawDest();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_122' href='#L_CALLS_122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ElementPointerType = Type::getIntNPtrTy(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_123' href='#L_CALLS_123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AMI->getContext(), ElementSizeInBytes, Src->getType()->getPointerAddressSpace());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_124' href='#L_CALLS_124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_125' href='#L_CALLS_125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SrcCasted = Builder->CreatePointerCast(Src, ElementPointerType,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_126' href='#L_CALLS_126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "memcpy_unfold.src_casted");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_127' href='#L_CALLS_127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *DstCasted = Builder->CreatePointerCast(Dst, ElementPointerType,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_128' href='#L_CALLS_128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "memcpy_unfold.dst_casted");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_129' href='#L_CALLS_129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_130' href='#L_CALLS_130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (uint64_t i = 0; </span><div class='tooltip'><span class='red'>i < NumElements</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_131' href='#L_CALLS_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Get current element addresses</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_132' href='#L_CALLS_132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *ElementIdxCI =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_133' href='#L_CALLS_133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(AMI->getContext(), APInt(64, i));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_134' href='#L_CALLS_134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SrcElementAddr =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_135' href='#L_CALLS_135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateGEP(SrcCasted, ElementIdxCI, "memcpy_unfold.src_addr");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_136' href='#L_CALLS_136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *DstElementAddr =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_137' href='#L_CALLS_137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateGEP(DstCasted, ElementIdxCI, "memcpy_unfold.dst_addr");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_138' href='#L_CALLS_138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_139' href='#L_CALLS_139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Load from the source. Transfer alignment information and mark load as</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_140' href='#L_CALLS_140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // unordered atomic.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_141' href='#L_CALLS_141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoadInst *Load = Builder->CreateLoad(SrcElementAddr, "memcpy_unfold.val");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_142' href='#L_CALLS_142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Load->setOrdering(AtomicOrdering::Unordered);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_143' href='#L_CALLS_143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We know alignment of the first element. It is also guaranteed by the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_144' href='#L_CALLS_144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // verifier that element size is less or equal than first element alignment</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_145' href='#L_CALLS_145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // and both of this values are powers of two.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_146' href='#L_CALLS_146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This means that all subsequent accesses are at least element size</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_147' href='#L_CALLS_147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_148' href='#L_CALLS_148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: We can infer better alignment but there is no evidence that this</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_149' href='#L_CALLS_149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // will matter.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_150' href='#L_CALLS_150'><pre>150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Load->setAlignment(i == 0 ? </span><span class='red'>AMI->getSrcAlignment()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_151' href='#L_CALLS_151'><pre>151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>AMI->getElementSizeInBytes()</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_152' href='#L_CALLS_152'><pre>152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Load->setDebugLoc(AMI->getDebugLoc());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_153' href='#L_CALLS_153'><pre>153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_154' href='#L_CALLS_154'><pre>154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Store loaded value via unordered atomic store.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_155' href='#L_CALLS_155'><pre>155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> StoreInst *Store = Builder->CreateStore(Load, DstElementAddr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_156' href='#L_CALLS_156'><pre>156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Store->setOrdering(AtomicOrdering::Unordered);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_157' href='#L_CALLS_157'><pre>157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Store->setAlignment(i == 0 ? </span><span class='red'>AMI->getDstAlignment()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_158' href='#L_CALLS_158'><pre>158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>AMI->getElementSizeInBytes()</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_159' href='#L_CALLS_159'><pre>159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Store->setDebugLoc(AMI->getDebugLoc());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_160' href='#L_CALLS_160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_161' href='#L_CALLS_161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_162' href='#L_CALLS_162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Set the number of elements of the copy to 0, it will be deleted on the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_163' href='#L_CALLS_163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // next iteration.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_164' href='#L_CALLS_164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AMI->setNumElements(Constant::getNullValue(NumElementsCI->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_165' href='#L_CALLS_165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return AMI</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_166' href='#L_CALLS_166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_167' href='#L_CALLS_167'><pre>167</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_168' href='#L_CALLS_168'><pre>168</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_169' href='#L_CALLS_169'><pre>169</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> unsigned DstAlign = getKnownAlignment(MI->getArgOperand(0), DL, MI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_170' href='#L_CALLS_170'><pre>170</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> unsigned SrcAlign = getKnownAlignment(MI->getArgOperand(1), DL, MI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_171' href='#L_CALLS_171'><pre>171</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> unsigned MinAlign = std::min(DstAlign, SrcAlign);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_172' href='#L_CALLS_172'><pre>172</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> unsigned CopyAlign = MI->getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_173' href='#L_CALLS_173'><pre>173</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_174' href='#L_CALLS_174'><pre>174</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>CopyAlign < MinAlign<span class='tooltip-content'>34.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>65</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_175' href='#L_CALLS_175'><pre>175</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> MI->setAlignment(ConstantInt::get(MI->getAlignmentType(), MinAlign, false));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_176' href='#L_CALLS_176'><pre>176</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> return MI;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_177' href='#L_CALLS_177'><pre>177</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_178' href='#L_CALLS_178'><pre>178</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_179' href='#L_CALLS_179'><pre>179</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // If MemCpyInst length is 1/2/4/8 bytes then replace memcpy with</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_180' href='#L_CALLS_180'><pre>180</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // load/store.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_181' href='#L_CALLS_181'><pre>181</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> ConstantInt *MemOpLength = dyn_cast<ConstantInt>(MI->getArgOperand(2));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_182' href='#L_CALLS_182'><pre>182</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>!MemOpLength<span class='tooltip-content'>34.2k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>3.43k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_183' href='#L_CALLS_183'><pre>183</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_184' href='#L_CALLS_184'><pre>184</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // Source and destination pointer types are always "i8*" for intrinsic. See</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_185' href='#L_CALLS_185'><pre>185</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // if the size is something we can handle with a single primitive load/store.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_186' href='#L_CALLS_186'><pre>186</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // A single load+store correctly handles overlapping memory in the memmove</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_187' href='#L_CALLS_187'><pre>187</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // case.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_188' href='#L_CALLS_188'><pre>188</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre> uint64_t Size = MemOpLength->getLimitedValue();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_189' href='#L_CALLS_189'><pre>189</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre> assert(Size && "0-sized memory transferring should be removed already.");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_190' href='#L_CALLS_190'><pre>190</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_191' href='#L_CALLS_191'><pre>191</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>Size > 8 || <span class='tooltip-content'>30.7k</span></div><div class='tooltip'>(Size&(Size-1))<span class='tooltip-content'>1.42k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_192' href='#L_CALLS_192'><pre>192</pre></a></td><td class='covered-line'><pre>30.4k</pre></td><td class='code'><pre> return nullptr; // If not 1/2/4/8 bytes, exit.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_193' href='#L_CALLS_193'><pre>193</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_194' href='#L_CALLS_194'><pre>194</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre> // Use an integer load+store unless we can find something better.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_195' href='#L_CALLS_195'><pre>195</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> unsigned SrcAddrSp =</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_196' href='#L_CALLS_196'><pre>196</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> cast<PointerType>(MI->getArgOperand(1)->getType())->getAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_197' href='#L_CALLS_197'><pre>197</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> unsigned DstAddrSp =</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_198' href='#L_CALLS_198'><pre>198</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> cast<PointerType>(MI->getArgOperand(0)->getType())->getAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_199' href='#L_CALLS_199'><pre>199</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_200' href='#L_CALLS_200'><pre>200</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> IntegerType* IntType = IntegerType::get(MI->getContext(), Size<<3);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_201' href='#L_CALLS_201'><pre>201</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> Type *NewSrcPtrTy = PointerType::get(IntType, SrcAddrSp);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_202' href='#L_CALLS_202'><pre>202</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> Type *NewDstPtrTy = PointerType::get(IntType, DstAddrSp);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_203' href='#L_CALLS_203'><pre>203</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_204' href='#L_CALLS_204'><pre>204</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> // If the memcpy has metadata describing the members, see if we can get the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_205' href='#L_CALLS_205'><pre>205</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> // TBAA tag describing our copy.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_206' href='#L_CALLS_206'><pre>206</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> MDNode *CopyMD = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_207' href='#L_CALLS_207'><pre>207</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> if (MDNode *<div class='tooltip'>M<span class='tooltip-content'>309</span></div> = MI->getMetadata(LLVMContext::MD_tbaa_struct)) <div class='tooltip'>{<span class='tooltip-content'>104</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_208' href='#L_CALLS_208'><pre>208</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> if (<div class='tooltip'>M->getNumOperands() == 3 && <span class='tooltip-content'>104</span></div><div class='tooltip'>M->getOperand(0)<span class='tooltip-content'>16</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_209' href='#L_CALLS_209'><pre>209</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> mdconst::hasa<ConstantInt>(M->getOperand(0)) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_210' href='#L_CALLS_210'><pre>210</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> mdconst::extract<ConstantInt>(M->getOperand(0))->isNullValue() &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_211' href='#L_CALLS_211'><pre>211</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> M->getOperand(1) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_212' href='#L_CALLS_212'><pre>212</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> mdconst::hasa<ConstantInt>(M->getOperand(1)) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_213' href='#L_CALLS_213'><pre>213</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> mdconst::extract<ConstantInt>(M->getOperand(1))->getValue() ==</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_214' href='#L_CALLS_214'><pre>214</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Size &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_215' href='#L_CALLS_215'><pre>215</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>M->getOperand(2)<span class='tooltip-content'>16</span></div> && <div class='tooltip'>isa<MDNode>(M->getOperand(2))<span class='tooltip-content'>16</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_216' href='#L_CALLS_216'><pre>216</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> CopyMD = cast<MDNode>(M->getOperand(2));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_217' href='#L_CALLS_217'><pre>217</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_218' href='#L_CALLS_218'><pre>218</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_219' href='#L_CALLS_219'><pre>219</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> // If the memcpy/memmove provides better alignment info than we can</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_220' href='#L_CALLS_220'><pre>220</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> // infer, use it.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_221' href='#L_CALLS_221'><pre>221</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> SrcAlign = std::max(SrcAlign, CopyAlign);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_222' href='#L_CALLS_222'><pre>222</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> DstAlign = std::max(DstAlign, CopyAlign);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_223' href='#L_CALLS_223'><pre>223</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_224' href='#L_CALLS_224'><pre>224</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> Value *Src = Builder->CreateBitCast(MI->getArgOperand(1), NewSrcPtrTy);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_225' href='#L_CALLS_225'><pre>225</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> Value *Dest = Builder->CreateBitCast(MI->getArgOperand(0), NewDstPtrTy);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_226' href='#L_CALLS_226'><pre>226</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> LoadInst *L = Builder->CreateLoad(Src, MI->isVolatile());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_227' href='#L_CALLS_227'><pre>227</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> L->setAlignment(SrcAlign);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_228' href='#L_CALLS_228'><pre>228</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> if (CopyMD)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_229' href='#L_CALLS_229'><pre>229</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> L->setMetadata(LLVMContext::MD_tbaa, CopyMD);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_230' href='#L_CALLS_230'><pre>230</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> MDNode *LoopMemParallelMD =</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_231' href='#L_CALLS_231'><pre>231</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> MI->getMetadata(LLVMContext::MD_mem_parallel_loop_access);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_232' href='#L_CALLS_232'><pre>232</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> if (LoopMemParallelMD)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_233' href='#L_CALLS_233'><pre>233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>L->setMetadata(LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_234' href='#L_CALLS_234'><pre>234</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_235' href='#L_CALLS_235'><pre>235</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> StoreInst *S = Builder->CreateStore(L, Dest, MI->isVolatile());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_236' href='#L_CALLS_236'><pre>236</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> S->setAlignment(DstAlign);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_237' href='#L_CALLS_237'><pre>237</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> if (CopyMD)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_238' href='#L_CALLS_238'><pre>238</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> S->setMetadata(LLVMContext::MD_tbaa, CopyMD);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_239' href='#L_CALLS_239'><pre>239</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> if (LoopMemParallelMD)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_240' href='#L_CALLS_240'><pre>240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>S->setMetadata(LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_241' href='#L_CALLS_241'><pre>241</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_242' href='#L_CALLS_242'><pre>242</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> // Set the size of the copy to 0, it will be deleted on the next iteration.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_243' href='#L_CALLS_243'><pre>243</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> MI->setArgOperand(2, Constant::getNullValue(MemOpLength->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_244' href='#L_CALLS_244'><pre>244</pre></a></td><td class='covered-line'><pre>309</pre></td><td class='code'><pre> return MI;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_245' href='#L_CALLS_245'><pre>245</pre></a></td><td class='covered-line'><pre>30.7k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_246' href='#L_CALLS_246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_247' href='#L_CALLS_247'><pre>247</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre>Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_248' href='#L_CALLS_248'><pre>248</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> unsigned Alignment = getKnownAlignment(MI->getDest(), DL, MI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_249' href='#L_CALLS_249'><pre>249</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>MI->getAlignment() < Alignment<span class='tooltip-content'>44.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>130</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_250' href='#L_CALLS_250'><pre>250</pre></a></td><td class='covered-line'><pre>130</pre></td><td class='code'><pre> MI->setAlignment(ConstantInt::get(MI->getAlignmentType(),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_251' href='#L_CALLS_251'><pre>251</pre></a></td><td class='covered-line'><pre>130</pre></td><td class='code'><pre> Alignment, false));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_252' href='#L_CALLS_252'><pre>252</pre></a></td><td class='covered-line'><pre>130</pre></td><td class='code'><pre> return MI;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_253' href='#L_CALLS_253'><pre>253</pre></a></td><td class='covered-line'><pre>130</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_254' href='#L_CALLS_254'><pre>254</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_255' href='#L_CALLS_255'><pre>255</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> // Extract the length and alignment and fill if they are constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_256' href='#L_CALLS_256'><pre>256</pre></a></td><td class='covered-line'><pre>43.9k</pre></td><td class='code'><pre> ConstantInt *LenC = dyn_cast<ConstantInt>(MI->getLength());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_257' href='#L_CALLS_257'><pre>257</pre></a></td><td class='covered-line'><pre>43.9k</pre></td><td class='code'><pre> ConstantInt *FillC = dyn_cast<ConstantInt>(MI->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_258' href='#L_CALLS_258'><pre>258</pre></a></td><td class='covered-line'><pre>43.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LenC || <span class='tooltip-content'>43.9k</span></div><div class='tooltip'>!FillC<span class='tooltip-content'>41.8k</span></div> || <div class='tooltip'>!FillC->getType()->isIntegerTy(8)<span class='tooltip-content'>41.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_259' href='#L_CALLS_259'><pre>259</pre></a></td><td class='covered-line'><pre>2.32k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_260' href='#L_CALLS_260'><pre>260</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> uint64_t Len = LenC->getLimitedValue();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_261' href='#L_CALLS_261'><pre>261</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> Alignment = MI->getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_262' href='#L_CALLS_262'><pre>262</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> assert(Len && "0-sized memory setting should be removed already.");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_263' href='#L_CALLS_263'><pre>263</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_264' href='#L_CALLS_264'><pre>264</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> // memset(s,c,n) -> store s, c (for n=1,2,4,8)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_265' href='#L_CALLS_265'><pre>265</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>Len <= 8 && <span class='tooltip-content'>41.6k</span></div><div class='tooltip'>isPowerOf2_32((uint32_t)Len)<span class='tooltip-content'>135</span></div>) <div class='tooltip'>{<span class='tooltip-content'>51</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_266' href='#L_CALLS_266'><pre>266</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Type *ITy = IntegerType::get(MI->getContext(), Len*8); // n=1 -> i8.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_267' href='#L_CALLS_267'><pre>267</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_268' href='#L_CALLS_268'><pre>268</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Value *Dest = MI->getDest();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_269' href='#L_CALLS_269'><pre>269</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> unsigned DstAddrSp = cast<PointerType>(Dest->getType())->getAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_270' href='#L_CALLS_270'><pre>270</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Type *NewDstPtrTy = PointerType::get(ITy, DstAddrSp);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_271' href='#L_CALLS_271'><pre>271</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Dest = Builder->CreateBitCast(Dest, NewDstPtrTy);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_272' href='#L_CALLS_272'><pre>272</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_273' href='#L_CALLS_273'><pre>273</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> // Alignment 0 is identity for alignment 1 for memset, but not store.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_274' href='#L_CALLS_274'><pre>274</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> if (<div class='tooltip'>Alignment == 0<span class='tooltip-content'>51</span></div>) <div class='tooltip'><span class='red'>Alignment = 1</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_275' href='#L_CALLS_275'><pre>275</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_276' href='#L_CALLS_276'><pre>276</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> // Extract the fill value and store.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_277' href='#L_CALLS_277'><pre>277</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> uint64_t Fill = FillC->getZExtValue()*0x0101010101010101ULL;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_278' href='#L_CALLS_278'><pre>278</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> StoreInst *S = Builder->CreateStore(ConstantInt::get(ITy, Fill), Dest,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_279' href='#L_CALLS_279'><pre>279</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> MI->isVolatile());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_280' href='#L_CALLS_280'><pre>280</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> S->setAlignment(Alignment);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_281' href='#L_CALLS_281'><pre>281</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_282' href='#L_CALLS_282'><pre>282</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> // Set the size of the copy to 0, it will be deleted on the next iteration.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_283' href='#L_CALLS_283'><pre>283</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> MI->setLength(Constant::getNullValue(LenC->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_284' href='#L_CALLS_284'><pre>284</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> return MI;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_285' href='#L_CALLS_285'><pre>285</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_286' href='#L_CALLS_286'><pre>286</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_287' href='#L_CALLS_287'><pre>287</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_288' href='#L_CALLS_288'><pre>288</pre></a></td><td class='covered-line'><pre>41.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_289' href='#L_CALLS_289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_290' href='#L_CALLS_290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86immShift(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_291' href='#L_CALLS_291'><pre>291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_292' href='#L_CALLS_292'><pre>292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LogicalShift = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_293' href='#L_CALLS_293'><pre>293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_294' href='#L_CALLS_294'><pre>294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_295' href='#L_CALLS_295'><pre>295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (II.getIntrinsicID()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_296' href='#L_CALLS_296'><pre>296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unexpected intrinsic!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_297' href='#L_CALLS_297'><pre>297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psra_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_298' href='#L_CALLS_298'><pre>298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psra_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_299' href='#L_CALLS_299'><pre>299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrai_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_300' href='#L_CALLS_300'><pre>300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrai_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_301' href='#L_CALLS_301'><pre>301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psra_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_302' href='#L_CALLS_302'><pre>302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psra_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_303' href='#L_CALLS_303'><pre>303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrai_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_304' href='#L_CALLS_304'><pre>304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrai_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_305' href='#L_CALLS_305'><pre>305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_306' href='#L_CALLS_306'><pre>306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_307' href='#L_CALLS_307'><pre>307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_308' href='#L_CALLS_308'><pre>308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_309' href='#L_CALLS_309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_310' href='#L_CALLS_310'><pre>310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_311' href='#L_CALLS_311'><pre>311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_312' href='#L_CALLS_312'><pre>312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_313' href='#L_CALLS_313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_314' href='#L_CALLS_314'><pre>314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_315' href='#L_CALLS_315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = false; ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_316' href='#L_CALLS_316'><pre>316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_317' href='#L_CALLS_317'><pre>317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_318' href='#L_CALLS_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_319' href='#L_CALLS_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_320' href='#L_CALLS_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_321' href='#L_CALLS_321'><pre>321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_322' href='#L_CALLS_322'><pre>322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_323' href='#L_CALLS_323'><pre>323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_324' href='#L_CALLS_324'><pre>324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_325' href='#L_CALLS_325'><pre>325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_326' href='#L_CALLS_326'><pre>326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_327' href='#L_CALLS_327'><pre>327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_328' href='#L_CALLS_328'><pre>328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_329' href='#L_CALLS_329'><pre>329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_330' href='#L_CALLS_330'><pre>330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_331' href='#L_CALLS_331'><pre>331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_332' href='#L_CALLS_332'><pre>332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_333' href='#L_CALLS_333'><pre>333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_334' href='#L_CALLS_334'><pre>334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_335' href='#L_CALLS_335'><pre>335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = true; ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_336' href='#L_CALLS_336'><pre>336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_337' href='#L_CALLS_337'><pre>337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_338' href='#L_CALLS_338'><pre>338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_339' href='#L_CALLS_339'><pre>339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_340' href='#L_CALLS_340'><pre>340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_341' href='#L_CALLS_341'><pre>341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_342' href='#L_CALLS_342'><pre>342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_343' href='#L_CALLS_343'><pre>343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_344' href='#L_CALLS_344'><pre>344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_345' href='#L_CALLS_345'><pre>345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_346' href='#L_CALLS_346'><pre>346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_347' href='#L_CALLS_347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_348' href='#L_CALLS_348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_349' href='#L_CALLS_349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_350' href='#L_CALLS_350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_351' href='#L_CALLS_351'><pre>351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_352' href='#L_CALLS_352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_353' href='#L_CALLS_353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_354' href='#L_CALLS_354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_355' href='#L_CALLS_355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = true; ShiftLeft = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_356' href='#L_CALLS_356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_357' href='#L_CALLS_357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_358' href='#L_CALLS_358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>((LogicalShift || !ShiftLeft) && "Only logical shifts can shift left");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_359' href='#L_CALLS_359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_360' href='#L_CALLS_360'><pre>360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplify if count is constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_361' href='#L_CALLS_361'><pre>361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Arg1 = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_362' href='#L_CALLS_362'><pre>362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto CAZ = dyn_cast<ConstantAggregateZero>(Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_363' href='#L_CALLS_363'><pre>363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto CDV = dyn_cast<ConstantDataVector>(Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_364' href='#L_CALLS_364'><pre>364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto CInt = dyn_cast<ConstantInt>(Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_365' href='#L_CALLS_365'><pre>365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CAZ && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CDV</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!CInt</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_366' href='#L_CALLS_366'><pre>366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_367' href='#L_CALLS_367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_368' href='#L_CALLS_368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Count(64, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_369' href='#L_CALLS_369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CDV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_370' href='#L_CALLS_370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // SSE2/AVX2 uses all the first 64-bits of the 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_371' href='#L_CALLS_371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operand to compute the shift amount.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_372' href='#L_CALLS_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VT = cast<VectorType>(CDV->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_373' href='#L_CALLS_373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned BitWidth = VT->getElementType()->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_374' href='#L_CALLS_374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((64 % BitWidth) == 0 && "Unexpected packed shift size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_375' href='#L_CALLS_375'><pre>375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumSubElts = 64 / BitWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_376' href='#L_CALLS_376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_377' href='#L_CALLS_377'><pre>377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Concatenate the sub-elements to create the 64-bit value.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_378' href='#L_CALLS_378'><pre>378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumSubElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_379' href='#L_CALLS_379'><pre>379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SubEltIdx = (NumSubElts - 1) - i;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_380' href='#L_CALLS_380'><pre>380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto SubElt = cast<ConstantInt>(CDV->getElementAsConstant(SubEltIdx));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_381' href='#L_CALLS_381'><pre>381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Count = Count.shl(BitWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_382' href='#L_CALLS_382'><pre>382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Count |= SubElt->getValue().zextOrTrunc(64);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_383' href='#L_CALLS_383'><pre>383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_384' href='#L_CALLS_384'><pre>384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_385' href='#L_CALLS_385'><pre>385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CInt</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_386' href='#L_CALLS_386'><pre>386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Count = CInt->getValue()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_387' href='#L_CALLS_387'><pre>387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_388' href='#L_CALLS_388'><pre>388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Vec = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_389' href='#L_CALLS_389'><pre>389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VT = cast<VectorType>(Vec->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_390' href='#L_CALLS_390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto SVT = VT->getElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_391' href='#L_CALLS_391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = VT->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_392' href='#L_CALLS_392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned BitWidth = SVT->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_393' href='#L_CALLS_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_394' href='#L_CALLS_394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If shift-by-zero then just return the original value.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_395' href='#L_CALLS_395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Count == 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_396' href='#L_CALLS_396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Vec</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_397' href='#L_CALLS_397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_398' href='#L_CALLS_398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle cases when Shift >= BitWidth.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_399' href='#L_CALLS_399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Count.uge(BitWidth)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_400' href='#L_CALLS_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If LogicalShift - just return zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_401' href='#L_CALLS_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>LogicalShift</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_402' href='#L_CALLS_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ConstantAggregateZero::get(VT)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_403' href='#L_CALLS_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_404' href='#L_CALLS_404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If ArithmeticShift - clamp Shift to (BitWidth - 1).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_405' href='#L_CALLS_405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Count = APInt(64, BitWidth - 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_406' href='#L_CALLS_406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_407' href='#L_CALLS_407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_408' href='#L_CALLS_408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Get a constant vector of the same type as the first operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_409' href='#L_CALLS_409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto ShiftAmt = ConstantInt::get(SVT, Count.zextOrTrunc(BitWidth));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_410' href='#L_CALLS_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto ShiftVec = Builder.CreateVectorSplat(VWidth, ShiftAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_411' href='#L_CALLS_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_412' href='#L_CALLS_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ShiftLeft</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_413' href='#L_CALLS_413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateShl(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_414' href='#L_CALLS_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_415' href='#L_CALLS_415'><pre>415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LogicalShift</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_416' href='#L_CALLS_416'><pre>416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateLShr(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_417' href='#L_CALLS_417'><pre>417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_418' href='#L_CALLS_418'><pre>418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateAShr(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_419' href='#L_CALLS_419'><pre>419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_420' href='#L_CALLS_420'><pre>420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_421' href='#L_CALLS_421'><pre>421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Attempt to simplify AVX2 per-element shift intrinsics to a generic IR shift.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_422' href='#L_CALLS_422'><pre>422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Unlike the generic IR shifts, the intrinsics have defined behaviour for out</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_423' href='#L_CALLS_423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// of range shift amounts (logical - set to zero, arithmetic - splat sign bit).</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_424' href='#L_CALLS_424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86varShift(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_425' href='#L_CALLS_425'><pre>425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_426' href='#L_CALLS_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LogicalShift = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_427' href='#L_CALLS_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_428' href='#L_CALLS_428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_429' href='#L_CALLS_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (II.getIntrinsicID()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_430' href='#L_CALLS_430'><pre>430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unexpected intrinsic!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_431' href='#L_CALLS_431'><pre>431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrav_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_432' href='#L_CALLS_432'><pre>432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrav_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_433' href='#L_CALLS_433'><pre>433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_434' href='#L_CALLS_434'><pre>434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_435' href='#L_CALLS_435'><pre>435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_436' href='#L_CALLS_436'><pre>436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_437' href='#L_CALLS_437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_438' href='#L_CALLS_438'><pre>438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_439' href='#L_CALLS_439'><pre>439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_440' href='#L_CALLS_440'><pre>440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_441' href='#L_CALLS_441'><pre>441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_442' href='#L_CALLS_442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_443' href='#L_CALLS_443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_444' href='#L_CALLS_444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_445' href='#L_CALLS_445'><pre>445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_446' href='#L_CALLS_446'><pre>446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_447' href='#L_CALLS_447'><pre>447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_448' href='#L_CALLS_448'><pre>448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_449' href='#L_CALLS_449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_450' href='#L_CALLS_450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_451' href='#L_CALLS_451'><pre>451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_452' href='#L_CALLS_452'><pre>452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_453' href='#L_CALLS_453'><pre>453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftLeft = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_454' href='#L_CALLS_454'><pre>454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_455' href='#L_CALLS_455'><pre>455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_456' href='#L_CALLS_456'><pre>456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_457' href='#L_CALLS_457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_458' href='#L_CALLS_458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_459' href='#L_CALLS_459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_460' href='#L_CALLS_460'><pre>460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_461' href='#L_CALLS_461'><pre>461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_462' href='#L_CALLS_462'><pre>462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_463' href='#L_CALLS_463'><pre>463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_464' href='#L_CALLS_464'><pre>464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LogicalShift = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_465' href='#L_CALLS_465'><pre>465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftLeft = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_466' href='#L_CALLS_466'><pre>466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_467' href='#L_CALLS_467'><pre>467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_468' href='#L_CALLS_468'><pre>468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>((LogicalShift || !ShiftLeft) && "Only logical shifts can shift left");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_469' href='#L_CALLS_469'><pre>469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_470' href='#L_CALLS_470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplify if all shift amounts are constant/undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_471' href='#L_CALLS_471'><pre>471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CShift = dyn_cast<Constant>(II.getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_472' href='#L_CALLS_472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CShift</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_473' href='#L_CALLS_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_474' href='#L_CALLS_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_475' href='#L_CALLS_475'><pre>475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto Vec = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_476' href='#L_CALLS_476'><pre>476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VT = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_477' href='#L_CALLS_477'><pre>477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto SVT = VT->getVectorElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_478' href='#L_CALLS_478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int NumElts = VT->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_479' href='#L_CALLS_479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int BitWidth = SVT->getIntegerBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_480' href='#L_CALLS_480'><pre>480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_481' href='#L_CALLS_481'><pre>481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Collect each element's shift amount.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_482' href='#L_CALLS_482'><pre>482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We also collect special cases: UNDEF = -1, OUT-OF-RANGE = BitWidth.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_483' href='#L_CALLS_483'><pre>483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool AnyOutOfRange = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_484' href='#L_CALLS_484'><pre>484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<int, 8> ShiftAmts;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_485' href='#L_CALLS_485'><pre>485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int I = 0; </span><div class='tooltip'><span class='red'>I < NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_486' href='#L_CALLS_486'><pre>486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CElt = CShift->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_487' href='#L_CALLS_487'><pre>487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CElt && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(CElt)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_488' href='#L_CALLS_488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftAmts.push_back(-1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_489' href='#L_CALLS_489'><pre>489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_490' href='#L_CALLS_490'><pre>490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_491' href='#L_CALLS_491'><pre>491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_492' href='#L_CALLS_492'><pre>492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *COp = dyn_cast_or_null<ConstantInt>(CElt);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_493' href='#L_CALLS_493'><pre>493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!COp</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_494' href='#L_CALLS_494'><pre>494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_495' href='#L_CALLS_495'><pre>495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_496' href='#L_CALLS_496'><pre>496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle out of range shifts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_497' href='#L_CALLS_497'><pre>497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If LogicalShift - set to BitWidth (special case).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_498' href='#L_CALLS_498'><pre>498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If ArithmeticShift - set to (BitWidth - 1) (sign splat).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_499' href='#L_CALLS_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt ShiftVal = COp->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_500' href='#L_CALLS_500'><pre>500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ShiftVal.uge(BitWidth)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_501' href='#L_CALLS_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AnyOutOfRange = LogicalShift;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_502' href='#L_CALLS_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftAmts.push_back(LogicalShift ? </span><div class='tooltip'><span class='red'>BitWidth</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>BitWidth - 1</span><span class='tooltip-content'>0</span></div><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_503' href='#L_CALLS_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_504' href='#L_CALLS_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_505' href='#L_CALLS_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_506' href='#L_CALLS_506'><pre>506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShiftAmts.push_back((int)ShiftVal.getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_507' href='#L_CALLS_507'><pre>507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_508' href='#L_CALLS_508'><pre>508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_509' href='#L_CALLS_509'><pre>509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If all elements out of range or UNDEF, return vector of zeros/undefs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_510' href='#L_CALLS_510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ArithmeticShift should only hit this if they are all UNDEF.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_511' href='#L_CALLS_511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>auto OutOfRange = [&](int Idx) </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>{ return (Idx < 0) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(BitWidth <= Idx)</span><span class='tooltip-content'>0</span></div><span class='red'>; }</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_512' href='#L_CALLS_512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>all_of(ShiftAmts, OutOfRange)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_513' href='#L_CALLS_513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 8> ConstantVec;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_514' href='#L_CALLS_514'><pre>514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int Idx : ShiftAmts) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_515' href='#L_CALLS_515'><pre>515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Idx < 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_516' href='#L_CALLS_516'><pre>516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVec.push_back(UndefValue::get(SVT));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_517' href='#L_CALLS_517'><pre>517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_518' href='#L_CALLS_518'><pre>518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(LogicalShift && "Logical shift expected");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_519' href='#L_CALLS_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVec.push_back(ConstantInt::getNullValue(SVT));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_520' href='#L_CALLS_520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_521' href='#L_CALLS_521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_522' href='#L_CALLS_522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantVector::get(ConstantVec);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_523' href='#L_CALLS_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_524' href='#L_CALLS_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_525' href='#L_CALLS_525'><pre>525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We can't handle only some out of range values with generic logical shifts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_526' href='#L_CALLS_526'><pre>526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AnyOutOfRange</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_527' href='#L_CALLS_527'><pre>527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_528' href='#L_CALLS_528'><pre>528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_529' href='#L_CALLS_529'><pre>529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Build the shift amount constant vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_530' href='#L_CALLS_530'><pre>530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SmallVector<Constant *, 8> ShiftVecAmts;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_531' href='#L_CALLS_531'><pre>531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int Idx : ShiftAmts) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_532' href='#L_CALLS_532'><pre>532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Idx < 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_533' href='#L_CALLS_533'><pre>533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShiftVecAmts.push_back(UndefValue::get(SVT))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_534' href='#L_CALLS_534'><pre>534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_535' href='#L_CALLS_535'><pre>535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShiftVecAmts.push_back(ConstantInt::get(SVT, Idx))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_536' href='#L_CALLS_536'><pre>536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_537' href='#L_CALLS_537'><pre>537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto ShiftVec = ConstantVector::get(ShiftVecAmts);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_538' href='#L_CALLS_538'><pre>538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_539' href='#L_CALLS_539'><pre>539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ShiftLeft</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_540' href='#L_CALLS_540'><pre>540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateShl(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_541' href='#L_CALLS_541'><pre>541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_542' href='#L_CALLS_542'><pre>542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LogicalShift</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_543' href='#L_CALLS_543'><pre>543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateLShr(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_544' href='#L_CALLS_544'><pre>544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_545' href='#L_CALLS_545'><pre>545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateAShr(Vec, ShiftVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_546' href='#L_CALLS_546'><pre>546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_547' href='#L_CALLS_547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_548' href='#L_CALLS_548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86muldq(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_549' href='#L_CALLS_549'><pre>549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_550' href='#L_CALLS_550'><pre>550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_551' href='#L_CALLS_551'><pre>551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_552' href='#L_CALLS_552'><pre>552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ResTy = II.getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_553' href='#L_CALLS_553'><pre>553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Arg0->getType()->getScalarSizeInBits() == 32 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_554' href='#L_CALLS_554'><pre>554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Arg1->getType()->getScalarSizeInBits() == 32 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_555' href='#L_CALLS_555'><pre>555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ResTy->getScalarSizeInBits() == 64 && "Unexpected muldq/muludq types");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_556' href='#L_CALLS_556'><pre>556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_557' href='#L_CALLS_557'><pre>557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // muldq/muludq(undef, undef) -> zero (matches generic mul behavior)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_558' href='#L_CALLS_558'><pre>558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<UndefValue>(Arg0) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_559' href='#L_CALLS_559'><pre>559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ConstantAggregateZero::get(ResTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_560' href='#L_CALLS_560'><pre>560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_561' href='#L_CALLS_561'><pre>561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant folding.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_562' href='#L_CALLS_562'><pre>562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PMULDQ = (mul(vXi64 sext(shuffle<0,2,..>(Arg0)),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_563' href='#L_CALLS_563'><pre>563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // vXi64 sext(shuffle<0,2,..>(Arg1))))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_564' href='#L_CALLS_564'><pre>564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PMULUDQ = (mul(vXi64 zext(shuffle<0,2,..>(Arg0)),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_565' href='#L_CALLS_565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // vXi64 zext(shuffle<0,2,..>(Arg1))))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_566' href='#L_CALLS_566'><pre>566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Arg0) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_567' href='#L_CALLS_567'><pre>567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_568' href='#L_CALLS_568'><pre>568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_569' href='#L_CALLS_569'><pre>569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned NumElts = ResTy->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_570' href='#L_CALLS_570'><pre>570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Arg0->getType()->getVectorNumElements() == (2 * NumElts) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_571' href='#L_CALLS_571'><pre>571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Arg1->getType()->getVectorNumElements() == (2 * NumElts) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_572' href='#L_CALLS_572'><pre>572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected muldq/muludq types");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_573' href='#L_CALLS_573'><pre>573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_574' href='#L_CALLS_574'><pre>574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned IntrinsicID = II.getIntrinsicID();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_575' href='#L_CALLS_575'><pre>575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool IsSigned = (Intrinsic::x86_sse41_pmuldq == IntrinsicID ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_576' href='#L_CALLS_576'><pre>576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Intrinsic::x86_avx2_pmul_dq == IntrinsicID</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_577' href='#L_CALLS_577'><pre>577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Intrinsic::x86_avx512_pmul_dq_512 == IntrinsicID</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_578' href='#L_CALLS_578'><pre>578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_579' href='#L_CALLS_579'><pre>579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<unsigned, 16> ShuffleMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_580' href='#L_CALLS_580'><pre>580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_581' href='#L_CALLS_581'><pre>581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(i * 2)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_582' href='#L_CALLS_582'><pre>582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_583' href='#L_CALLS_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *LHS = Builder.CreateShuffleVector(Arg0, Arg0, ShuffleMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_584' href='#L_CALLS_584'><pre>584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *RHS = Builder.CreateShuffleVector(Arg1, Arg1, ShuffleMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_585' href='#L_CALLS_585'><pre>585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_586' href='#L_CALLS_586'><pre>586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsSigned</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_587' href='#L_CALLS_587'><pre>587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LHS = Builder.CreateSExt(LHS, ResTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_588' href='#L_CALLS_588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHS = Builder.CreateSExt(RHS, ResTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_589' href='#L_CALLS_589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_590' href='#L_CALLS_590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LHS = Builder.CreateZExt(LHS, ResTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_591' href='#L_CALLS_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHS = Builder.CreateZExt(RHS, ResTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_592' href='#L_CALLS_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_593' href='#L_CALLS_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_594' href='#L_CALLS_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateMul(LHS, RHS)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_595' href='#L_CALLS_595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_596' href='#L_CALLS_596'><pre>596</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_597' href='#L_CALLS_597'><pre>597</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86pack(IntrinsicInst &II, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_598' href='#L_CALLS_598'><pre>598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder, bool IsSigned) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_599' href='#L_CALLS_599'><pre>599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_600' href='#L_CALLS_600'><pre>600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_601' href='#L_CALLS_601'><pre>601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ResTy = II.getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_602' href='#L_CALLS_602'><pre>602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_603' href='#L_CALLS_603'><pre>603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Fast all undef handling.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_604' href='#L_CALLS_604'><pre>604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<UndefValue>(Arg0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_605' href='#L_CALLS_605'><pre>605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return UndefValue::get(ResTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_606' href='#L_CALLS_606'><pre>606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_607' href='#L_CALLS_607'><pre>607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Type *ArgTy = Arg0->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_608' href='#L_CALLS_608'><pre>608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumLanes = ResTy->getPrimitiveSizeInBits() / 128;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_609' href='#L_CALLS_609'><pre>609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumDstElts = ResTy->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_610' href='#L_CALLS_610'><pre>610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumSrcElts = ArgTy->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_611' href='#L_CALLS_611'><pre>611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(NumDstElts == (2 * NumSrcElts) && "Unexpected packing types");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_612' href='#L_CALLS_612'><pre>612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_613' href='#L_CALLS_613'><pre>613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumDstEltsPerLane = NumDstElts / NumLanes;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_614' href='#L_CALLS_614'><pre>614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumSrcEltsPerLane = NumSrcElts / NumLanes;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_615' href='#L_CALLS_615'><pre>615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned DstScalarSizeInBits = ResTy->getScalarSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_616' href='#L_CALLS_616'><pre>616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(ArgTy->getScalarSizeInBits() == (2 * DstScalarSizeInBits) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_617' href='#L_CALLS_617'><pre>617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected packing types");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_618' href='#L_CALLS_618'><pre>618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_619' href='#L_CALLS_619'><pre>619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant folding.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_620' href='#L_CALLS_620'><pre>620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Cst0 = dyn_cast<Constant>(Arg0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_621' href='#L_CALLS_621'><pre>621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Cst1 = dyn_cast<Constant>(Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_622' href='#L_CALLS_622'><pre>622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Cst0 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!Cst1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_623' href='#L_CALLS_623'><pre>623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_624' href='#L_CALLS_624'><pre>624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_625' href='#L_CALLS_625'><pre>625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SmallVector<Constant *, 32> Vals;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_626' href='#L_CALLS_626'><pre>626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Lane = 0; </span><div class='tooltip'><span class='red'>Lane != NumLanes</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Lane</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_627' href='#L_CALLS_627'><pre>627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Elt = 0; </span><div class='tooltip'><span class='red'>Elt != NumDstEltsPerLane</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Elt</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_628' href='#L_CALLS_628'><pre>628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SrcIdx = Lane * NumSrcEltsPerLane + Elt % NumSrcEltsPerLane;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_629' href='#L_CALLS_629'><pre>629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Cst = (Elt >= NumSrcEltsPerLane) ? </span><div class='tooltip'><span class='red'>Cst1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Cst0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_630' href='#L_CALLS_630'><pre>630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *COp = Cst->getAggregateElement(SrcIdx);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_631' href='#L_CALLS_631'><pre>631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>COp && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_632' href='#L_CALLS_632'><pre>632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Vals.push_back(UndefValue::get(ResTy->getScalarType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_633' href='#L_CALLS_633'><pre>633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_634' href='#L_CALLS_634'><pre>634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_635' href='#L_CALLS_635'><pre>635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_636' href='#L_CALLS_636'><pre>636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *CInt = dyn_cast_or_null<ConstantInt>(COp);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_637' href='#L_CALLS_637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CInt</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_638' href='#L_CALLS_638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_639' href='#L_CALLS_639'><pre>639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_640' href='#L_CALLS_640'><pre>640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Val = CInt->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_641' href='#L_CALLS_641'><pre>641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Val.getBitWidth() == ArgTy->getScalarSizeInBits() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_642' href='#L_CALLS_642'><pre>642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected constant bitwidth");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_643' href='#L_CALLS_643'><pre>643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_644' href='#L_CALLS_644'><pre>644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsSigned</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_645' href='#L_CALLS_645'><pre>645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PACKSS: Truncate signed value with signed saturation.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_646' href='#L_CALLS_646'><pre>646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Source values less than dst minint are saturated to minint.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_647' href='#L_CALLS_647'><pre>647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Source values greater than dst maxint are saturated to maxint.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_648' href='#L_CALLS_648'><pre>648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Val.isSignedIntN(DstScalarSizeInBits)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_649' href='#L_CALLS_649'><pre>649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = Val.trunc(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_650' href='#L_CALLS_650'><pre>650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_651' href='#L_CALLS_651'><pre>651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = APInt::getSignedMinValue(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_652' href='#L_CALLS_652'><pre>652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_653' href='#L_CALLS_653'><pre>653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = APInt::getSignedMaxValue(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_654' href='#L_CALLS_654'><pre>654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_655' href='#L_CALLS_655'><pre>655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PACKUS: Truncate signed value with unsigned saturation.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_656' href='#L_CALLS_656'><pre>656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Source values less than zero are saturated to zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_657' href='#L_CALLS_657'><pre>657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Source values greater than dst maxuint are saturated to maxuint.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_658' href='#L_CALLS_658'><pre>658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Val.isIntN(DstScalarSizeInBits)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_659' href='#L_CALLS_659'><pre>659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = Val.trunc(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_660' href='#L_CALLS_660'><pre>660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_661' href='#L_CALLS_661'><pre>661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = APInt::getNullValue(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_662' href='#L_CALLS_662'><pre>662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_663' href='#L_CALLS_663'><pre>663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Val = APInt::getAllOnesValue(DstScalarSizeInBits)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_664' href='#L_CALLS_664'><pre>664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_665' href='#L_CALLS_665'><pre>665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_666' href='#L_CALLS_666'><pre>666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Vals.push_back(ConstantInt::get(ResTy->getScalarType(), Val));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_667' href='#L_CALLS_667'><pre>667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_668' href='#L_CALLS_668'><pre>668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_669' href='#L_CALLS_669'><pre>669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_670' href='#L_CALLS_670'><pre>670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ConstantVector::get(Vals)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_671' href='#L_CALLS_671'><pre>671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_672' href='#L_CALLS_672'><pre>672</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_673' href='#L_CALLS_673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86movmsk(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_674' href='#L_CALLS_674'><pre>674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_675' href='#L_CALLS_675'><pre>675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_676' href='#L_CALLS_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ResTy = II.getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_677' href='#L_CALLS_677'><pre>677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ArgTy = Arg->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_678' href='#L_CALLS_678'><pre>678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_679' href='#L_CALLS_679'><pre>679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // movmsk(undef) -> zero as we must ensure the upper bits are zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_680' href='#L_CALLS_680'><pre>680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<UndefValue>(Arg)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_681' href='#L_CALLS_681'><pre>681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Constant::getNullValue(ResTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_682' href='#L_CALLS_682'><pre>682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_683' href='#L_CALLS_683'><pre>683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We can't easily peek through x86_mmx types.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_684' href='#L_CALLS_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!ArgTy->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_685' href='#L_CALLS_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_686' href='#L_CALLS_686'><pre>686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_687' href='#L_CALLS_687'><pre>687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *C = dyn_cast<Constant>(Arg);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_688' href='#L_CALLS_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!C</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_689' href='#L_CALLS_689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_690' href='#L_CALLS_690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_691' href='#L_CALLS_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Extract signbits of the vector input and pack into integer result.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_692' href='#L_CALLS_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Result(ResTy->getPrimitiveSizeInBits(), 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_693' href='#L_CALLS_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = ArgTy->getVectorNumElements(); </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_694' href='#L_CALLS_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *COp = C->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_695' href='#L_CALLS_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!COp</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_696' href='#L_CALLS_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_697' href='#L_CALLS_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_698' href='#L_CALLS_698'><pre>698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_699' href='#L_CALLS_699'><pre>699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_700' href='#L_CALLS_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *CInt = dyn_cast<ConstantInt>(COp);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_701' href='#L_CALLS_701'><pre>701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CFp = dyn_cast<ConstantFP>(COp);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_702' href='#L_CALLS_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CInt && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CFp</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_703' href='#L_CALLS_703'><pre>703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_704' href='#L_CALLS_704'><pre>704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_705' href='#L_CALLS_705'><pre>705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(CInt && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CInt->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>) || </span><div class='tooltip'><span class='red'>(CFp && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CFp->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_706' href='#L_CALLS_706'><pre>706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Result.setBit(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_707' href='#L_CALLS_707'><pre>707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_708' href='#L_CALLS_708'><pre>708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_709' href='#L_CALLS_709'><pre>709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Constant::getIntegerValue(ResTy, Result)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_710' href='#L_CALLS_710'><pre>710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_711' href='#L_CALLS_711'><pre>711</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_712' href='#L_CALLS_712'><pre>712</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86insertps(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_713' href='#L_CALLS_713'><pre>713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_714' href='#L_CALLS_714'><pre>714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CInt = dyn_cast<ConstantInt>(II.getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_715' href='#L_CALLS_715'><pre>715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CInt</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_716' href='#L_CALLS_716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_717' href='#L_CALLS_717'><pre>717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_718' href='#L_CALLS_718'><pre>718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>VectorType *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_719' href='#L_CALLS_719'><pre>719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(VecTy->getNumElements() == 4 && "insertps with wrong vector type");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_720' href='#L_CALLS_720'><pre>720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_721' href='#L_CALLS_721'><pre>721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The immediate permute control byte looks like this:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_722' href='#L_CALLS_722'><pre>722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [3:0] - zero mask for each 32-bit lane</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_723' href='#L_CALLS_723'><pre>723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [5:4] - select one 32-bit destination lane</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_724' href='#L_CALLS_724'><pre>724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [7:6] - select one 32-bit source lane</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_725' href='#L_CALLS_725'><pre>725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_726' href='#L_CALLS_726'><pre>726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint8_t Imm = CInt->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_727' href='#L_CALLS_727'><pre>727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint8_t ZMask = Imm & 0xf;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_728' href='#L_CALLS_728'><pre>728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint8_t DestLane = (Imm >> 4) & 0x3;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_729' href='#L_CALLS_729'><pre>729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint8_t SourceLane = (Imm >> 6) & 0x3;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_730' href='#L_CALLS_730'><pre>730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_731' href='#L_CALLS_731'><pre>731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantAggregateZero *ZeroVector = ConstantAggregateZero::get(VecTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_732' href='#L_CALLS_732'><pre>732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_733' href='#L_CALLS_733'><pre>733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If all zero mask bits are set, this was just a weird way to</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_734' href='#L_CALLS_734'><pre>734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // generate a zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_735' href='#L_CALLS_735'><pre>735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ZMask == 0xf</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_736' href='#L_CALLS_736'><pre>736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ZeroVector</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_737' href='#L_CALLS_737'><pre>737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_738' href='#L_CALLS_738'><pre>738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Initialize by passing all of the first source bits through.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_739' href='#L_CALLS_739'><pre>739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>uint32_t ShuffleMask[4] = { 0, 1, 2, 3 };</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_740' href='#L_CALLS_740'><pre>740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_741' href='#L_CALLS_741'><pre>741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We may replace the second operand with the zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_742' href='#L_CALLS_742'><pre>742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V1 = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_743' href='#L_CALLS_743'><pre>743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_744' href='#L_CALLS_744'><pre>744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ZMask</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_745' href='#L_CALLS_745'><pre>745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the zero mask is being used with a single input or the zero mask</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_746' href='#L_CALLS_746'><pre>746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // overrides the destination lane, this is a shuffle with the zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_747' href='#L_CALLS_747'><pre>747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>(II.getArgOperand(0) == II.getArgOperand(1)) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_748' href='#L_CALLS_748'><pre>748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(ZMask & (1 << DestLane))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_749' href='#L_CALLS_749'><pre>749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V1 = ZeroVector;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_750' href='#L_CALLS_750'><pre>750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We may still move 32-bits of the first source vector from one lane</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_751' href='#L_CALLS_751'><pre>751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to another.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_752' href='#L_CALLS_752'><pre>752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShuffleMask[DestLane] = SourceLane;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_753' href='#L_CALLS_753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The zero mask may override the previous insert operation.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_754' href='#L_CALLS_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < 4</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_755' href='#L_CALLS_755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(ZMask >> i) & 0x1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_756' href='#L_CALLS_756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask[i] = i + 4</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_757' href='#L_CALLS_757'><pre>757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_758' href='#L_CALLS_758'><pre>758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Model this case as 2 shuffles or a 'logical and' plus shuffle?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_759' href='#L_CALLS_759'><pre>759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_760' href='#L_CALLS_760'><pre>760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_761' href='#L_CALLS_761'><pre>761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_762' href='#L_CALLS_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace the selected destination lane with the selected source lane.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_763' href='#L_CALLS_763'><pre>763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShuffleMask[DestLane] = SourceLane + 4;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_764' href='#L_CALLS_764'><pre>764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_765' href='#L_CALLS_765'><pre>765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_766' href='#L_CALLS_766'><pre>766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateShuffleVector(II.getArgOperand(0), V1, ShuffleMask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_767' href='#L_CALLS_767'><pre>767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_768' href='#L_CALLS_768'><pre>768</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_769' href='#L_CALLS_769'><pre>769</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to simplify SSE4A EXTRQ/EXTRQI instructions using constant folding</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_770' href='#L_CALLS_770'><pre>770</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// or conversion to a shuffle vector.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_771' href='#L_CALLS_771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86extrq(IntrinsicInst &II, Value *Op0,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_772' href='#L_CALLS_772'><pre>772</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *CILength, ConstantInt *CIIndex,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_773' href='#L_CALLS_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_774' href='#L_CALLS_774'><pre>774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto LowConstantHighUndef = [&](uint64_t Val) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_775' href='#L_CALLS_775'><pre>775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy64 = Type::getInt64Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_776' href='#L_CALLS_776'><pre>776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Args[] = {ConstantInt::get(IntTy64, Val),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_777' href='#L_CALLS_777'><pre>777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(IntTy64)};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_778' href='#L_CALLS_778'><pre>778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantVector::get(Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_779' href='#L_CALLS_779'><pre>779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_780' href='#L_CALLS_780'><pre>780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_781' href='#L_CALLS_781'><pre>781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_782' href='#L_CALLS_782'><pre>782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C0 = dyn_cast<Constant>(Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_783' href='#L_CALLS_783'><pre>783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI0 =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_784' href='#L_CALLS_784'><pre>784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C0 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C0->getAggregateElement((unsigned)0))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_785' href='#L_CALLS_785'><pre>785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_786' href='#L_CALLS_786'><pre>786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_787' href='#L_CALLS_787'><pre>787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to constant fold.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_788' href='#L_CALLS_788'><pre>788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CILength && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CIIndex</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_789' href='#L_CALLS_789'><pre>789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "The bit index and field length are each six</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_790' href='#L_CALLS_790'><pre>790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bits in length other bits of the field are ignored."</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_791' href='#L_CALLS_791'><pre>791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt APIndex = CIIndex->getValue().zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_792' href='#L_CALLS_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt APLength = CILength->getValue().zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_793' href='#L_CALLS_793'><pre>793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_794' href='#L_CALLS_794'><pre>794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Index = APIndex.getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_795' href='#L_CALLS_795'><pre>795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_796' href='#L_CALLS_796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "a value of zero in the field length is</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_797' href='#L_CALLS_797'><pre>797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // defined as length of 64".</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_798' href='#L_CALLS_798'><pre>798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Length = APLength == 0 ? </span><div class='tooltip'><span class='red'>64</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>APLength.getZExtValue()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_799' href='#L_CALLS_799'><pre>799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_800' href='#L_CALLS_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "If the sum of the bit index + length field</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_801' href='#L_CALLS_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is greater than 64, the results are undefined".</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_802' href='#L_CALLS_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned End = Index + Length;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_803' href='#L_CALLS_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_804' href='#L_CALLS_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that both field index and field length are 8-bit quantities.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_805' href='#L_CALLS_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Since variables 'Index' and 'Length' are unsigned values</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_806' href='#L_CALLS_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // obtained from zero-extending field index and field length</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_807' href='#L_CALLS_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // respectively, their sum should never wrap around.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_808' href='#L_CALLS_808'><pre>808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>End > 64</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_809' href='#L_CALLS_809'><pre>809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return UndefValue::get(II.getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_810' href='#L_CALLS_810'><pre>810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_811' href='#L_CALLS_811'><pre>811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we are inserting whole bytes, we can convert this to a shuffle.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_812' href='#L_CALLS_812'><pre>812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Lowering can recognize EXTRQI shuffle masks.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_813' href='#L_CALLS_813'><pre>813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Length % 8) == 0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Index % 8) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_814' href='#L_CALLS_814'><pre>814</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Convert bit indices to byte indices.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_815' href='#L_CALLS_815'><pre>815</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Length /= 8;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_816' href='#L_CALLS_816'><pre>816</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index /= 8;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_817' href='#L_CALLS_817'><pre>817</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_818' href='#L_CALLS_818'><pre>818</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy8 = Type::getInt8Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_819' href='#L_CALLS_819'><pre>819</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy32 = Type::getInt32Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_820' href='#L_CALLS_820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *ShufTy = VectorType::get(IntTy8, 16);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_821' href='#L_CALLS_821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_822' href='#L_CALLS_822'><pre>822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> ShuffleMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_823' href='#L_CALLS_823'><pre>823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 0; </span><div class='tooltip'><span class='red'>i != (int)Length</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_824' href='#L_CALLS_824'><pre>824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_825' href='#L_CALLS_825'><pre>825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getIntegerValue(IntTy32, APInt(32, i + Index)))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_826' href='#L_CALLS_826'><pre>826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = Length; </span><div class='tooltip'><span class='red'>i != 8</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_827' href='#L_CALLS_827'><pre>827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_828' href='#L_CALLS_828'><pre>828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getIntegerValue(IntTy32, APInt(32, i + 16)))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_829' href='#L_CALLS_829'><pre>829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 8; </span><div class='tooltip'><span class='red'>i != 16</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_830' href='#L_CALLS_830'><pre>830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(UndefValue::get(IntTy32))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_831' href='#L_CALLS_831'><pre>831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_832' href='#L_CALLS_832'><pre>832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SV = Builder.CreateShuffleVector(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_833' href='#L_CALLS_833'><pre>833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder.CreateBitCast(Op0, ShufTy),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_834' href='#L_CALLS_834'><pre>834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantAggregateZero::get(ShufTy), ConstantVector::get(ShuffleMask));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_835' href='#L_CALLS_835'><pre>835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateBitCast(SV, II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_836' href='#L_CALLS_836'><pre>836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_837' href='#L_CALLS_837'><pre>837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_838' href='#L_CALLS_838'><pre>838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant Fold - shift Index'th bit to lowest position and mask off</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_839' href='#L_CALLS_839'><pre>839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Length bits.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_840' href='#L_CALLS_840'><pre>840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_841' href='#L_CALLS_841'><pre>841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Elt = CI0->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_842' href='#L_CALLS_842'><pre>842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Elt = Elt.lshr(Index).zextOrTrunc(Length);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_843' href='#L_CALLS_843'><pre>843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LowConstantHighUndef(Elt.getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_844' href='#L_CALLS_844'><pre>844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_845' href='#L_CALLS_845'><pre>845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_846' href='#L_CALLS_846'><pre>846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we were an EXTRQ call, we'll save registers if we convert to EXTRQI.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_847' href='#L_CALLS_847'><pre>847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II.getIntrinsicID() == Intrinsic::x86_sse4a_extrq</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_848' href='#L_CALLS_848'><pre>848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Args[] = {Op0, CILength, CIIndex};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_849' href='#L_CALLS_849'><pre>849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Module *M = II.getModule();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_850' href='#L_CALLS_850'><pre>850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *F = Intrinsic::getDeclaration(M, Intrinsic::x86_sse4a_extrqi);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_851' href='#L_CALLS_851'><pre>851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateCall(F, Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_852' href='#L_CALLS_852'><pre>852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_853' href='#L_CALLS_853'><pre>853</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_854' href='#L_CALLS_854'><pre>854</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_855' href='#L_CALLS_855'><pre>855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant Fold - extraction from zero is always {zero, undef}.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_856' href='#L_CALLS_856'><pre>856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI0->equalsInt(0)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_857' href='#L_CALLS_857'><pre>857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return LowConstantHighUndef(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_858' href='#L_CALLS_858'><pre>858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_859' href='#L_CALLS_859'><pre>859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_860' href='#L_CALLS_860'><pre>860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_861' href='#L_CALLS_861'><pre>861</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_862' href='#L_CALLS_862'><pre>862</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to simplify SSE4A INSERTQ/INSERTQI instructions using constant</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_863' href='#L_CALLS_863'><pre>863</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// folding or conversion to a shuffle vector.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_864' href='#L_CALLS_864'><pre>864</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86insertq(IntrinsicInst &II, Value *Op0, Value *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_865' href='#L_CALLS_865'><pre>865</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt APLength, APInt APIndex,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_866' href='#L_CALLS_866'><pre>866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_867' href='#L_CALLS_867'><pre>867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "The bit index and field length are each six bits</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_868' href='#L_CALLS_868'><pre>868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // in length other bits of the field are ignored."</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_869' href='#L_CALLS_869'><pre>869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APIndex = APIndex.zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_870' href='#L_CALLS_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APLength = APLength.zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_871' href='#L_CALLS_871'><pre>871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_872' href='#L_CALLS_872'><pre>872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to constant fold.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_873' href='#L_CALLS_873'><pre>873</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Index = APIndex.getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_874' href='#L_CALLS_874'><pre>874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_875' href='#L_CALLS_875'><pre>875</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "a value of zero in the field length is</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_876' href='#L_CALLS_876'><pre>876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // defined as length of 64".</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_877' href='#L_CALLS_877'><pre>877</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Length = APLength == 0 ? </span><div class='tooltip'><span class='red'>64</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>APLength.getZExtValue()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_878' href='#L_CALLS_878'><pre>878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_879' href='#L_CALLS_879'><pre>879</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From AMD documentation: "If the sum of the bit index + length field</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_880' href='#L_CALLS_880'><pre>880</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is greater than 64, the results are undefined".</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_881' href='#L_CALLS_881'><pre>881</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned End = Index + Length;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_882' href='#L_CALLS_882'><pre>882</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_883' href='#L_CALLS_883'><pre>883</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that both field index and field length are 8-bit quantities.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_884' href='#L_CALLS_884'><pre>884</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Since variables 'Index' and 'Length' are unsigned values</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_885' href='#L_CALLS_885'><pre>885</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // obtained from zero-extending field index and field length</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_886' href='#L_CALLS_886'><pre>886</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // respectively, their sum should never wrap around.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_887' href='#L_CALLS_887'><pre>887</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>End > 64</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_888' href='#L_CALLS_888'><pre>888</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return UndefValue::get(II.getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_889' href='#L_CALLS_889'><pre>889</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_890' href='#L_CALLS_890'><pre>890</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we are inserting whole bytes, we can convert this to a shuffle.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_891' href='#L_CALLS_891'><pre>891</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Lowering can recognize INSERTQI shuffle masks.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_892' href='#L_CALLS_892'><pre>892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Length % 8) == 0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Index % 8) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_893' href='#L_CALLS_893'><pre>893</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Convert bit indices to byte indices.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_894' href='#L_CALLS_894'><pre>894</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Length /= 8;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_895' href='#L_CALLS_895'><pre>895</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index /= 8;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_896' href='#L_CALLS_896'><pre>896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_897' href='#L_CALLS_897'><pre>897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy8 = Type::getInt8Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_898' href='#L_CALLS_898'><pre>898</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy32 = Type::getInt32Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_899' href='#L_CALLS_899'><pre>899</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *ShufTy = VectorType::get(IntTy8, 16);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_900' href='#L_CALLS_900'><pre>900</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_901' href='#L_CALLS_901'><pre>901</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> ShuffleMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_902' href='#L_CALLS_902'><pre>902</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 0; </span><div class='tooltip'><span class='red'>i != (int)Index</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_903' href='#L_CALLS_903'><pre>903</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(Constant::getIntegerValue(IntTy32, APInt(32, i)))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_904' href='#L_CALLS_904'><pre>904</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 0; </span><div class='tooltip'><span class='red'>i != (int)Length</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_905' href='#L_CALLS_905'><pre>905</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_906' href='#L_CALLS_906'><pre>906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getIntegerValue(IntTy32, APInt(32, i + 16)))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_907' href='#L_CALLS_907'><pre>907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = Index + Length; </span><div class='tooltip'><span class='red'>i != 8</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_908' href='#L_CALLS_908'><pre>908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(Constant::getIntegerValue(IntTy32, APInt(32, i)))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_909' href='#L_CALLS_909'><pre>909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 8; </span><div class='tooltip'><span class='red'>i != 16</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_910' href='#L_CALLS_910'><pre>910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(UndefValue::get(IntTy32))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_911' href='#L_CALLS_911'><pre>911</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_912' href='#L_CALLS_912'><pre>912</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SV = Builder.CreateShuffleVector(Builder.CreateBitCast(Op0, ShufTy),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_913' href='#L_CALLS_913'><pre>913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder.CreateBitCast(Op1, ShufTy),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_914' href='#L_CALLS_914'><pre>914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(ShuffleMask));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_915' href='#L_CALLS_915'><pre>915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateBitCast(SV, II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_916' href='#L_CALLS_916'><pre>916</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_917' href='#L_CALLS_917'><pre>917</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_918' href='#L_CALLS_918'><pre>918</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_919' href='#L_CALLS_919'><pre>919</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Constant *C0 = dyn_cast<Constant>(Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_920' href='#L_CALLS_920'><pre>920</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_921' href='#L_CALLS_921'><pre>921</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI00 =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_922' href='#L_CALLS_922'><pre>922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C0 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C0->getAggregateElement((unsigned)0))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_923' href='#L_CALLS_923'><pre>923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_924' href='#L_CALLS_924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI10 =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_925' href='#L_CALLS_925'><pre>925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C1 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C1->getAggregateElement((unsigned)0))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_926' href='#L_CALLS_926'><pre>926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_927' href='#L_CALLS_927'><pre>927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_928' href='#L_CALLS_928'><pre>928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant Fold - insert bottom Length bits starting at the Index'th bit.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_929' href='#L_CALLS_929'><pre>929</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CI00 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI10</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_930' href='#L_CALLS_930'><pre>930</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt V00 = CI00->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_931' href='#L_CALLS_931'><pre>931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt V10 = CI10->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_932' href='#L_CALLS_932'><pre>932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Mask = APInt::getLowBitsSet(64, Length).shl(Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_933' href='#L_CALLS_933'><pre>933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V00 = V00 & ~Mask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_934' href='#L_CALLS_934'><pre>934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V10 = V10.zextOrTrunc(Length).zextOrTrunc(64).shl(Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_935' href='#L_CALLS_935'><pre>935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Val = V00 | V10;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_936' href='#L_CALLS_936'><pre>936</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy64 = Type::getInt64Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_937' href='#L_CALLS_937'><pre>937</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Args[] = {ConstantInt::get(IntTy64, Val.getZExtValue()),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_938' href='#L_CALLS_938'><pre>938</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(IntTy64)};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_939' href='#L_CALLS_939'><pre>939</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantVector::get(Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_940' href='#L_CALLS_940'><pre>940</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_941' href='#L_CALLS_941'><pre>941</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_942' href='#L_CALLS_942'><pre>942</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we were an INSERTQ call, we'll save demanded elements if we convert to</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_943' href='#L_CALLS_943'><pre>943</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // INSERTQI.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_944' href='#L_CALLS_944'><pre>944</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II.getIntrinsicID() == Intrinsic::x86_sse4a_insertq</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_945' href='#L_CALLS_945'><pre>945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntTy8 = Type::getInt8Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_946' href='#L_CALLS_946'><pre>946</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *CILength = ConstantInt::get(IntTy8, Length, false);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_947' href='#L_CALLS_947'><pre>947</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *CIIndex = ConstantInt::get(IntTy8, Index, false);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_948' href='#L_CALLS_948'><pre>948</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_949' href='#L_CALLS_949'><pre>949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Args[] = {Op0, Op1, CILength, CIIndex};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_950' href='#L_CALLS_950'><pre>950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Module *M = II.getModule();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_951' href='#L_CALLS_951'><pre>951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *F = Intrinsic::getDeclaration(M, Intrinsic::x86_sse4a_insertqi);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_952' href='#L_CALLS_952'><pre>952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateCall(F, Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_953' href='#L_CALLS_953'><pre>953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_954' href='#L_CALLS_954'><pre>954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_955' href='#L_CALLS_955'><pre>955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_956' href='#L_CALLS_956'><pre>956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_957' href='#L_CALLS_957'><pre>957</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_958' href='#L_CALLS_958'><pre>958</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to convert pshufb* to shufflevector if the mask is constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_959' href='#L_CALLS_959'><pre>959</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86pshufb(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_960' href='#L_CALLS_960'><pre>960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_961' href='#L_CALLS_961'><pre>961</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *V = dyn_cast<Constant>(II.getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_962' href='#L_CALLS_962'><pre>962</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!V</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_963' href='#L_CALLS_963'><pre>963</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_964' href='#L_CALLS_964'><pre>964</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_965' href='#L_CALLS_965'><pre>965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_966' href='#L_CALLS_966'><pre>966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *MaskEltTy = Type::getInt32Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_967' href='#L_CALLS_967'><pre>967</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumElts = VecTy->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_968' href='#L_CALLS_968'><pre>968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((NumElts == 16 || NumElts == 32 || NumElts == 64) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_969' href='#L_CALLS_969'><pre>969</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected number of elements in shuffle mask!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_970' href='#L_CALLS_970'><pre>970</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_971' href='#L_CALLS_971'><pre>971</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Construct a shuffle mask from constant integers or UNDEFs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_972' href='#L_CALLS_972'><pre>972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Indexes[64] = {nullptr};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_973' href='#L_CALLS_973'><pre>973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_974' href='#L_CALLS_974'><pre>974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Each byte in the shuffle control mask forms an index to permute the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_975' href='#L_CALLS_975'><pre>975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // corresponding byte in the destination operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_976' href='#L_CALLS_976'><pre>976</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0; </span><div class='tooltip'><span class='red'>I < NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_977' href='#L_CALLS_977'><pre>977</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *COp = V->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_978' href='#L_CALLS_978'><pre>978</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!COp || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(!isa<UndefValue>(COp) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<ConstantInt>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_979' href='#L_CALLS_979'><pre>979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_980' href='#L_CALLS_980'><pre>980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_981' href='#L_CALLS_981'><pre>981</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_982' href='#L_CALLS_982'><pre>982</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = UndefValue::get(MaskEltTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_983' href='#L_CALLS_983'><pre>983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_984' href='#L_CALLS_984'><pre>984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_985' href='#L_CALLS_985'><pre>985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_986' href='#L_CALLS_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>int8_t Index = cast<ConstantInt>(COp)->getValue().getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_987' href='#L_CALLS_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_988' href='#L_CALLS_988'><pre>988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the most significant bit (bit[7]) of each byte of the shuffle</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_989' href='#L_CALLS_989'><pre>989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // control mask is set, then zero is written in the result byte.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_990' href='#L_CALLS_990'><pre>990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The zero vector is in the right-hand side of the resulting</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_991' href='#L_CALLS_991'><pre>991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shufflevector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_992' href='#L_CALLS_992'><pre>992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_993' href='#L_CALLS_993'><pre>993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The value of each index for the high 128-bit lane is the least</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_994' href='#L_CALLS_994'><pre>994</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // significant 4 bits of the respective shuffle control byte.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_995' href='#L_CALLS_995'><pre>995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index = ((Index < 0) ? </span><div class='tooltip'><span class='red'>NumElts</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Index & 0x0F</span><span class='tooltip-content'>0</span></div><span class='red'>) + (I & 0xF0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_996' href='#L_CALLS_996'><pre>996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = ConstantInt::get(MaskEltTy, Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_997' href='#L_CALLS_997'><pre>997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_998' href='#L_CALLS_998'><pre>998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_999' href='#L_CALLS_999'><pre>999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto ShuffleMask = ConstantVector::get(makeArrayRef(Indexes, NumElts));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1000' href='#L_CALLS_1000'><pre>1000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V1 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1001' href='#L_CALLS_1001'><pre>1001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V2 = Constant::getNullValue(VecTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1002' href='#L_CALLS_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateShuffleVector(V1, V2, ShuffleMask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1003' href='#L_CALLS_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1004' href='#L_CALLS_1004'><pre>1004</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1005' href='#L_CALLS_1005'><pre>1005</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to convert vpermilvar* to shufflevector if the mask is constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1006' href='#L_CALLS_1006'><pre>1006</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86vpermilvar(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1007' href='#L_CALLS_1007'><pre>1007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1008' href='#L_CALLS_1008'><pre>1008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *V = dyn_cast<Constant>(II.getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1009' href='#L_CALLS_1009'><pre>1009</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!V</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1010' href='#L_CALLS_1010'><pre>1010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1011' href='#L_CALLS_1011'><pre>1011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1012' href='#L_CALLS_1012'><pre>1012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1013' href='#L_CALLS_1013'><pre>1013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *MaskEltTy = Type::getInt32Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1014' href='#L_CALLS_1014'><pre>1014</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumElts = VecTy->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1015' href='#L_CALLS_1015'><pre>1015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool IsPD = VecTy->getScalarType()->isDoubleTy();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1016' href='#L_CALLS_1016'><pre>1016</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumLaneElts = IsPD ? </span><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>4</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1017' href='#L_CALLS_1017'><pre>1017</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(NumElts == 16 || NumElts == 8 || NumElts == 4 || NumElts == 2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1018' href='#L_CALLS_1018'><pre>1018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1019' href='#L_CALLS_1019'><pre>1019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Construct a shuffle mask from constant integers or UNDEFs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1020' href='#L_CALLS_1020'><pre>1020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Indexes[16] = {nullptr};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1021' href='#L_CALLS_1021'><pre>1021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1022' href='#L_CALLS_1022'><pre>1022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The intrinsics only read one or two bits, clear the rest.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1023' href='#L_CALLS_1023'><pre>1023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0; </span><div class='tooltip'><span class='red'>I < NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1024' href='#L_CALLS_1024'><pre>1024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *COp = V->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1025' href='#L_CALLS_1025'><pre>1025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!COp || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(!isa<UndefValue>(COp) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<ConstantInt>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1026' href='#L_CALLS_1026'><pre>1026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1027' href='#L_CALLS_1027'><pre>1027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1028' href='#L_CALLS_1028'><pre>1028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1029' href='#L_CALLS_1029'><pre>1029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = UndefValue::get(MaskEltTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1030' href='#L_CALLS_1030'><pre>1030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1031' href='#L_CALLS_1031'><pre>1031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1032' href='#L_CALLS_1032'><pre>1032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1033' href='#L_CALLS_1033'><pre>1033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt Index = cast<ConstantInt>(COp)->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1034' href='#L_CALLS_1034'><pre>1034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index = Index.zextOrTrunc(32).getLoBits(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1035' href='#L_CALLS_1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1036' href='#L_CALLS_1036'><pre>1036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The PD variants uses bit 1 to select per-lane element index, so</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1037' href='#L_CALLS_1037'><pre>1037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shift down to convert to generic shuffle mask index.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1038' href='#L_CALLS_1038'><pre>1038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>IsPD</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1039' href='#L_CALLS_1039'><pre>1039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Index = Index.lshr(1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1040' href='#L_CALLS_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1041' href='#L_CALLS_1041'><pre>1041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The _256 variants are a bit trickier since the mask bits always index</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1042' href='#L_CALLS_1042'><pre>1042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // into the corresponding 128 half. In order to convert to a generic</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1043' href='#L_CALLS_1043'><pre>1043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shuffle, we have to make that explicit.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1044' href='#L_CALLS_1044'><pre>1044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index += APInt(32, (I / NumLaneElts) * NumLaneElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1045' href='#L_CALLS_1045'><pre>1045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1046' href='#L_CALLS_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = ConstantInt::get(MaskEltTy, Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1047' href='#L_CALLS_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1048' href='#L_CALLS_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1049' href='#L_CALLS_1049'><pre>1049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto ShuffleMask = ConstantVector::get(makeArrayRef(Indexes, NumElts));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1050' href='#L_CALLS_1050'><pre>1050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V1 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1051' href='#L_CALLS_1051'><pre>1051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V2 = UndefValue::get(V1->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1052' href='#L_CALLS_1052'><pre>1052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateShuffleVector(V1, V2, ShuffleMask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1053' href='#L_CALLS_1053'><pre>1053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1054' href='#L_CALLS_1054'><pre>1054</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1055' href='#L_CALLS_1055'><pre>1055</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to convert vpermd/vpermps to shufflevector if the mask is constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1056' href='#L_CALLS_1056'><pre>1056</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86vpermv(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1057' href='#L_CALLS_1057'><pre>1057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1058' href='#L_CALLS_1058'><pre>1058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *V = dyn_cast<Constant>(II.getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1059' href='#L_CALLS_1059'><pre>1059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!V</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1060' href='#L_CALLS_1060'><pre>1060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1061' href='#L_CALLS_1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1062' href='#L_CALLS_1062'><pre>1062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1063' href='#L_CALLS_1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *MaskEltTy = Type::getInt32Ty(II.getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1064' href='#L_CALLS_1064'><pre>1064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Size = VecTy->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1065' href='#L_CALLS_1065'><pre>1065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((Size == 4 || Size == 8 || Size == 16 || Size == 32 || Size == 64) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1066' href='#L_CALLS_1066'><pre>1066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected shuffle mask size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1067' href='#L_CALLS_1067'><pre>1067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1068' href='#L_CALLS_1068'><pre>1068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Construct a shuffle mask from constant integers or UNDEFs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1069' href='#L_CALLS_1069'><pre>1069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Indexes[64] = {nullptr};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1070' href='#L_CALLS_1070'><pre>1070</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1071' href='#L_CALLS_1071'><pre>1071</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0; </span><div class='tooltip'><span class='red'>I < Size</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1072' href='#L_CALLS_1072'><pre>1072</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *COp = V->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1073' href='#L_CALLS_1073'><pre>1073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!COp || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(!isa<UndefValue>(COp) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<ConstantInt>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1074' href='#L_CALLS_1074'><pre>1074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1075' href='#L_CALLS_1075'><pre>1075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1076' href='#L_CALLS_1076'><pre>1076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(COp)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1077' href='#L_CALLS_1077'><pre>1077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = UndefValue::get(MaskEltTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1078' href='#L_CALLS_1078'><pre>1078</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1079' href='#L_CALLS_1079'><pre>1079</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1080' href='#L_CALLS_1080'><pre>1080</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1081' href='#L_CALLS_1081'><pre>1081</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>uint32_t Index = cast<ConstantInt>(COp)->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1082' href='#L_CALLS_1082'><pre>1082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Index &= Size - 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1083' href='#L_CALLS_1083'><pre>1083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indexes[I] = ConstantInt::get(MaskEltTy, Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1084' href='#L_CALLS_1084'><pre>1084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1085' href='#L_CALLS_1085'><pre>1085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1086' href='#L_CALLS_1086'><pre>1086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto ShuffleMask = ConstantVector::get(makeArrayRef(Indexes, Size));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1087' href='#L_CALLS_1087'><pre>1087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V1 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1088' href='#L_CALLS_1088'><pre>1088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto V2 = UndefValue::get(VecTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1089' href='#L_CALLS_1089'><pre>1089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateShuffleVector(V1, V2, ShuffleMask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1090' href='#L_CALLS_1090'><pre>1090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1091' href='#L_CALLS_1091'><pre>1091</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1092' href='#L_CALLS_1092'><pre>1092</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The shuffle mask for a perm2*128 selects any two halves of two 256-bit</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1093' href='#L_CALLS_1093'><pre>1093</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// source vectors, unless a zero bit is set. If a zero bit is set,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1094' href='#L_CALLS_1094'><pre>1094</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// then ignore that half of the mask and clear that half of the vector.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1095' href='#L_CALLS_1095'><pre>1095</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86vperm2(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1096' href='#L_CALLS_1096'><pre>1096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1097' href='#L_CALLS_1097'><pre>1097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CInt = dyn_cast<ConstantInt>(II.getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1098' href='#L_CALLS_1098'><pre>1098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CInt</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1099' href='#L_CALLS_1099'><pre>1099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1100' href='#L_CALLS_1100'><pre>1100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1101' href='#L_CALLS_1101'><pre>1101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>VectorType *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1102' href='#L_CALLS_1102'><pre>1102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantAggregateZero *ZeroVector = ConstantAggregateZero::get(VecTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1103' href='#L_CALLS_1103'><pre>1103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1104' href='#L_CALLS_1104'><pre>1104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The immediate permute control byte looks like this:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1105' href='#L_CALLS_1105'><pre>1105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [1:0] - select 128 bits from sources for low half of destination</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1106' href='#L_CALLS_1106'><pre>1106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [2] - ignore</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1107' href='#L_CALLS_1107'><pre>1107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [3] - zero low half of destination</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1108' href='#L_CALLS_1108'><pre>1108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [5:4] - select 128 bits from sources for high half of destination</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1109' href='#L_CALLS_1109'><pre>1109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [6] - ignore</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1110' href='#L_CALLS_1110'><pre>1110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [7] - zero high half of destination</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1111' href='#L_CALLS_1111'><pre>1111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1112' href='#L_CALLS_1112'><pre>1112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint8_t Imm = CInt->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1113' href='#L_CALLS_1113'><pre>1113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1114' href='#L_CALLS_1114'><pre>1114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LowHalfZero = Imm & 0x08;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1115' href='#L_CALLS_1115'><pre>1115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool HighHalfZero = Imm & 0x80;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1116' href='#L_CALLS_1116'><pre>1116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1117' href='#L_CALLS_1117'><pre>1117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If both zero mask bits are set, this was just a weird way to</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1118' href='#L_CALLS_1118'><pre>1118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // generate a zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1119' href='#L_CALLS_1119'><pre>1119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>LowHalfZero && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>HighHalfZero</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1120' href='#L_CALLS_1120'><pre>1120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ZeroVector</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1121' href='#L_CALLS_1121'><pre>1121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1122' href='#L_CALLS_1122'><pre>1122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If 0 or 1 zero mask bits are set, this is a simple shuffle.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1123' href='#L_CALLS_1123'><pre>1123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned NumElts = VecTy->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1124' href='#L_CALLS_1124'><pre>1124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned HalfSize = NumElts / 2;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1125' href='#L_CALLS_1125'><pre>1125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<uint32_t, 8> ShuffleMask(NumElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1126' href='#L_CALLS_1126'><pre>1126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1127' href='#L_CALLS_1127'><pre>1127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The high bit of the selection field chooses the 1st or 2nd operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1128' href='#L_CALLS_1128'><pre>1128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LowInputSelect = Imm & 0x02;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1129' href='#L_CALLS_1129'><pre>1129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool HighInputSelect = Imm & 0x20;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1130' href='#L_CALLS_1130'><pre>1130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1131' href='#L_CALLS_1131'><pre>1131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The low bit of the selection field chooses the low or high half</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1132' href='#L_CALLS_1132'><pre>1132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // of the selected operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1133' href='#L_CALLS_1133'><pre>1133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LowHalfSelect = Imm & 0x01;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1134' href='#L_CALLS_1134'><pre>1134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool HighHalfSelect = Imm & 0x10;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1135' href='#L_CALLS_1135'><pre>1135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1136' href='#L_CALLS_1136'><pre>1136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Determine which operand(s) are actually in use for this instruction.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1137' href='#L_CALLS_1137'><pre>1137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V0 = LowInputSelect ? </span><div class='tooltip'><span class='red'>II.getArgOperand(1)</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>II.getArgOperand(0)</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1138' href='#L_CALLS_1138'><pre>1138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V1 = HighInputSelect ? </span><div class='tooltip'><span class='red'>II.getArgOperand(1)</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>II.getArgOperand(0)</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1139' href='#L_CALLS_1139'><pre>1139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1140' href='#L_CALLS_1140'><pre>1140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If needed, replace operands based on zero mask.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1141' href='#L_CALLS_1141'><pre>1141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V0 = LowHalfZero ? </span><div class='tooltip'><span class='red'>ZeroVector</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>V0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1142' href='#L_CALLS_1142'><pre>1142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V1 = HighHalfZero ? </span><div class='tooltip'><span class='red'>ZeroVector</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>V1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1143' href='#L_CALLS_1143'><pre>1143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1144' href='#L_CALLS_1144'><pre>1144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Permute low half of result.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1145' href='#L_CALLS_1145'><pre>1145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned StartIndex = LowHalfSelect ? </span><div class='tooltip'><span class='red'>HalfSize</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1146' href='#L_CALLS_1146'><pre>1146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < HalfSize</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1147' href='#L_CALLS_1147'><pre>1147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask[i] = StartIndex + i</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1148' href='#L_CALLS_1148'><pre>1148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1149' href='#L_CALLS_1149'><pre>1149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Permute high half of result.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1150' href='#L_CALLS_1150'><pre>1150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> StartIndex = HighHalfSelect ? </span><div class='tooltip'><span class='red'>HalfSize</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1151' href='#L_CALLS_1151'><pre>1151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> StartIndex += NumElts;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1152' href='#L_CALLS_1152'><pre>1152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < HalfSize</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1153' href='#L_CALLS_1153'><pre>1153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask[i + HalfSize] = StartIndex + i</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1154' href='#L_CALLS_1154'><pre>1154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1155' href='#L_CALLS_1155'><pre>1155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateShuffleVector(V0, V1, ShuffleMask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1156' href='#L_CALLS_1156'><pre>1156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1157' href='#L_CALLS_1157'><pre>1157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1158' href='#L_CALLS_1158'><pre>1158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Decode XOP integer vector comparison intrinsics.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1159' href='#L_CALLS_1159'><pre>1159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyX86vpcom(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1160' href='#L_CALLS_1160'><pre>1160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InstCombiner::BuilderTy &Builder,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1161' href='#L_CALLS_1161'><pre>1161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool IsSigned) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1162' href='#L_CALLS_1162'><pre>1162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>CInt</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(II.getArgOperand(2))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1163' href='#L_CALLS_1163'><pre>1163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint64_t Imm = CInt->getZExtValue() & 0x7;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1164' href='#L_CALLS_1164'><pre>1164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *VecTy = cast<VectorType>(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1165' href='#L_CALLS_1165'><pre>1165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpInst::Predicate Pred = ICmpInst::BAD_ICMP_PREDICATE;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1166' href='#L_CALLS_1166'><pre>1166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1167' href='#L_CALLS_1167'><pre>1167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (Imm) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1168' href='#L_CALLS_1168'><pre>1168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x0:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1169' href='#L_CALLS_1169'><pre>1169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = IsSigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1170' href='#L_CALLS_1170'><pre>1170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1171' href='#L_CALLS_1171'><pre>1171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x1:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1172' href='#L_CALLS_1172'><pre>1172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = IsSigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLE</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_ULE</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1173' href='#L_CALLS_1173'><pre>1173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1174' href='#L_CALLS_1174'><pre>1174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x2:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1175' href='#L_CALLS_1175'><pre>1175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = IsSigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1176' href='#L_CALLS_1176'><pre>1176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1177' href='#L_CALLS_1177'><pre>1177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x3:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1178' href='#L_CALLS_1178'><pre>1178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = IsSigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_UGE</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1179' href='#L_CALLS_1179'><pre>1179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1180' href='#L_CALLS_1180'><pre>1180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x4:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1181' href='#L_CALLS_1181'><pre>1181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::ICMP_EQ; break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1182' href='#L_CALLS_1182'><pre>1182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x5:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1183' href='#L_CALLS_1183'><pre>1183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::ICMP_NE; break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1184' href='#L_CALLS_1184'><pre>1184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x6:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1185' href='#L_CALLS_1185'><pre>1185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantInt::getSigned(VecTy, 0)</span><span class='red'>; // FALSE</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1186' href='#L_CALLS_1186'><pre>1186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case 0x7:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1187' href='#L_CALLS_1187'><pre>1187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantInt::getSigned(VecTy, -1)</span><span class='red'>; // TRUE</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1188' href='#L_CALLS_1188'><pre>1188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1189' href='#L_CALLS_1189'><pre>1189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1190' href='#L_CALLS_1190'><pre>1190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Cmp</span><span class='tooltip-content'>0</span></div><span class='red'> = Builder.CreateICmp(Pred, II.getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1191' href='#L_CALLS_1191'><pre>1191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II.getArgOperand(1)))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1192' href='#L_CALLS_1192'><pre>1192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Builder.CreateSExtOrTrunc(Cmp, VecTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1193' href='#L_CALLS_1193'><pre>1193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1194' href='#L_CALLS_1194'><pre>1194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1195' href='#L_CALLS_1195'><pre>1195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1196' href='#L_CALLS_1196'><pre>1196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1197' href='#L_CALLS_1197'><pre>1197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Emit a select instruction and appropriate bitcasts to help simplify</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1198' href='#L_CALLS_1198'><pre>1198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// masked intrinsics.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1199' href='#L_CALLS_1199'><pre>1199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *emitX86MaskSelect(Value *Mask, Value *Op0, Value *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1200' href='#L_CALLS_1200'><pre>1200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1201' href='#L_CALLS_1201'><pre>1201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1202' href='#L_CALLS_1202'><pre>1202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1203' href='#L_CALLS_1203'><pre>1203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all ones we don't need the select. But we need to check</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1204' href='#L_CALLS_1204'><pre>1204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // only the bit thats will be used in case VWidth is less than 8.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1205' href='#L_CALLS_1205'><pre>1205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><span class='red'>C</span><span class='red'> = dyn_cast<ConstantInt>(Mask))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1206' href='#L_CALLS_1206'><pre>1206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C->getValue().zextOrTrunc(VWidth).isAllOnesValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1207' href='#L_CALLS_1207'><pre>1207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Op0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1208' href='#L_CALLS_1208'><pre>1208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1209' href='#L_CALLS_1209'><pre>1209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *MaskTy = VectorType::get(Builder.getInt1Ty(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1210' href='#L_CALLS_1210'><pre>1210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<IntegerType>(Mask->getType())->getBitWidth());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1211' href='#L_CALLS_1211'><pre>1211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask = Builder.CreateBitCast(Mask, MaskTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1212' href='#L_CALLS_1212'><pre>1212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1213' href='#L_CALLS_1213'><pre>1213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we have less than 8 elements, then the starting mask was an i8 and</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1214' href='#L_CALLS_1214'><pre>1214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // we need to extract down to the right number of elements.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1215' href='#L_CALLS_1215'><pre>1215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>VWidth < 8</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1216' href='#L_CALLS_1216'><pre>1216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint32_t Indices[4];</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1217' href='#L_CALLS_1217'><pre>1217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1218' href='#L_CALLS_1218'><pre>1218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Indices[i] = i</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1219' href='#L_CALLS_1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask = Builder.CreateShuffleVector(Mask, Mask,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1220' href='#L_CALLS_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> makeArrayRef(Indices, VWidth),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1221' href='#L_CALLS_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "extract");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1222' href='#L_CALLS_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1223' href='#L_CALLS_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1224' href='#L_CALLS_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateSelect(Mask, Op0, Op1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1225' href='#L_CALLS_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1226' href='#L_CALLS_1226'><pre>1226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1227' href='#L_CALLS_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Value *simplifyMinnumMaxnum(const IntrinsicInst &II) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1228' href='#L_CALLS_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1229' href='#L_CALLS_1229'><pre>1229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1230' href='#L_CALLS_1230'><pre>1230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1231' href='#L_CALLS_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(x, x) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1232' href='#L_CALLS_1232'><pre>1232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Arg0 == Arg1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1233' href='#L_CALLS_1233'><pre>1233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1234' href='#L_CALLS_1234'><pre>1234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1235' href='#L_CALLS_1235'><pre>1235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const auto *C1 = dyn_cast<ConstantFP>(Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1236' href='#L_CALLS_1236'><pre>1236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1237' href='#L_CALLS_1237'><pre>1237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(x, nan) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1238' href='#L_CALLS_1238'><pre>1238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1->isNaN()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1239' href='#L_CALLS_1239'><pre>1239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1240' href='#L_CALLS_1240'><pre>1240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1241' href='#L_CALLS_1241'><pre>1241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is the value because if undef were NaN, we would return the other</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1242' href='#L_CALLS_1242'><pre>1242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // value and cannot return a NaN unless both operands are.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1243' href='#L_CALLS_1243'><pre>1243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1244' href='#L_CALLS_1244'><pre>1244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(undef, x) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1245' href='#L_CALLS_1245'><pre>1245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Arg0)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1246' href='#L_CALLS_1246'><pre>1246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1247' href='#L_CALLS_1247'><pre>1247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1248' href='#L_CALLS_1248'><pre>1248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(x, undef) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1249' href='#L_CALLS_1249'><pre>1249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1250' href='#L_CALLS_1250'><pre>1250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1251' href='#L_CALLS_1251'><pre>1251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1252' href='#L_CALLS_1252'><pre>1252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *X = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1253' href='#L_CALLS_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Y = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1254' href='#L_CALLS_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>II.getIntrinsicID() == Intrinsic::minnum</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1255' href='#L_CALLS_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(x, fmin(x, y)) -> fmin(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1256' href='#L_CALLS_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(y, fmin(x, y)) -> fmin(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1257' href='#L_CALLS_1257'><pre>1257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>match(Arg1, m_FMin(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1258' href='#L_CALLS_1258'><pre>1258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Arg0 == X || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Arg0 == Y</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1259' href='#L_CALLS_1259'><pre>1259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1260' href='#L_CALLS_1260'><pre>1260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1261' href='#L_CALLS_1261'><pre>1261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1262' href='#L_CALLS_1262'><pre>1262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(fmin(x, y), x) -> fmin(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1263' href='#L_CALLS_1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(fmin(x, y), y) -> fmin(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1264' href='#L_CALLS_1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Arg0, m_FMin(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1265' href='#L_CALLS_1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Arg1 == X || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Arg1 == Y</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1266' href='#L_CALLS_1266'><pre>1266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1267' href='#L_CALLS_1267'><pre>1267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1268' href='#L_CALLS_1268'><pre>1268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1269' href='#L_CALLS_1269'><pre>1269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: fmin(nnan x, inf) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1270' href='#L_CALLS_1270'><pre>1270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: fmin(nnan ninf x, flt_max) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1271' href='#L_CALLS_1271'><pre>1271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1->isInfinity()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1272' href='#L_CALLS_1272'><pre>1272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmin(x, -inf) -> -inf</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1273' href='#L_CALLS_1273'><pre>1273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>C1->isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1274' href='#L_CALLS_1274'><pre>1274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1275' href='#L_CALLS_1275'><pre>1275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1276' href='#L_CALLS_1276'><pre>1276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1277' href='#L_CALLS_1277'><pre>1277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(II.getIntrinsicID() == Intrinsic::maxnum);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1278' href='#L_CALLS_1278'><pre>1278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmax(x, fmax(x, y)) -> fmax(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1279' href='#L_CALLS_1279'><pre>1279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmax(y, fmax(x, y)) -> fmax(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1280' href='#L_CALLS_1280'><pre>1280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>match(Arg1, m_FMax(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1281' href='#L_CALLS_1281'><pre>1281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Arg0 == X || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Arg0 == Y</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1282' href='#L_CALLS_1282'><pre>1282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1283' href='#L_CALLS_1283'><pre>1283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1284' href='#L_CALLS_1284'><pre>1284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1285' href='#L_CALLS_1285'><pre>1285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmax(fmax(x, y), x) -> fmax(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1286' href='#L_CALLS_1286'><pre>1286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmax(fmax(x, y), y) -> fmax(x, y)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1287' href='#L_CALLS_1287'><pre>1287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Arg0, m_FMax(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1288' href='#L_CALLS_1288'><pre>1288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Arg1 == X || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Arg1 == Y</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1289' href='#L_CALLS_1289'><pre>1289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1290' href='#L_CALLS_1290'><pre>1290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1291' href='#L_CALLS_1291'><pre>1291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1292' href='#L_CALLS_1292'><pre>1292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: fmax(nnan x, -inf) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1293' href='#L_CALLS_1293'><pre>1293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: fmax(nnan ninf x, -flt_max) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1294' href='#L_CALLS_1294'><pre>1294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1->isInfinity()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1295' href='#L_CALLS_1295'><pre>1295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmax(x, inf) -> inf</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1296' href='#L_CALLS_1296'><pre>1296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!C1->isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1297' href='#L_CALLS_1297'><pre>1297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Arg1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1298' href='#L_CALLS_1298'><pre>1298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1299' href='#L_CALLS_1299'><pre>1299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1300' href='#L_CALLS_1300'><pre>1300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1301' href='#L_CALLS_1301'><pre>1301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1302' href='#L_CALLS_1302'><pre>1302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1303' href='#L_CALLS_1303'><pre>1303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool maskIsAllOneOrUndef(Value *Mask) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1304' href='#L_CALLS_1304'><pre>1304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ConstMask = dyn_cast<Constant>(Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1305' href='#L_CALLS_1305'><pre>1305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!ConstMask</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1306' href='#L_CALLS_1306'><pre>1306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1307' href='#L_CALLS_1307'><pre>1307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstMask->isAllOnesValue() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(ConstMask)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1308' href='#L_CALLS_1308'><pre>1308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1309' href='#L_CALLS_1309'><pre>1309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>for (unsigned I = 0, E = ConstMask->getType()->getVectorNumElements(); </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1310' href='#L_CALLS_1310'><pre>1310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1311' href='#L_CALLS_1311'><pre>1311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><span class='red'>MaskElt</span><span class='red'> = ConstMask->getAggregateElement(I))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1312' href='#L_CALLS_1312'><pre>1312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>MaskElt->isAllOnesValue() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(MaskElt)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1313' href='#L_CALLS_1313'><pre>1313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1314' href='#L_CALLS_1314'><pre>1314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1315' href='#L_CALLS_1315'><pre>1315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1316' href='#L_CALLS_1316'><pre>1316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1317' href='#L_CALLS_1317'><pre>1317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1318' href='#L_CALLS_1318'><pre>1318</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1319' href='#L_CALLS_1319'><pre>1319</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyMaskedLoad(const IntrinsicInst &II,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1320' href='#L_CALLS_1320'><pre>1320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1321' href='#L_CALLS_1321'><pre>1321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all ones or undefs, this is a plain vector load of the 1st</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1322' href='#L_CALLS_1322'><pre>1322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1323' href='#L_CALLS_1323'><pre>1323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>maskIsAllOneOrUndef(II.getArgOperand(2))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1324' href='#L_CALLS_1324'><pre>1324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LoadPtr = II.getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1325' href='#L_CALLS_1325'><pre>1325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Alignment = cast<ConstantInt>(II.getArgOperand(1))->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1326' href='#L_CALLS_1326'><pre>1326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder.CreateAlignedLoad(LoadPtr, Alignment, "unmaskedload");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1327' href='#L_CALLS_1327'><pre>1327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1328' href='#L_CALLS_1328'><pre>1328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1329' href='#L_CALLS_1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1330' href='#L_CALLS_1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1331' href='#L_CALLS_1331'><pre>1331</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1332' href='#L_CALLS_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Instruction *simplifyMaskedStore(IntrinsicInst &II, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1333' href='#L_CALLS_1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ConstMask = dyn_cast<Constant>(II.getArgOperand(3));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1334' href='#L_CALLS_1334'><pre>1334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!ConstMask</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1335' href='#L_CALLS_1335'><pre>1335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1336' href='#L_CALLS_1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1337' href='#L_CALLS_1337'><pre>1337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all zeros, this instruction does nothing.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1338' href='#L_CALLS_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstMask->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1339' href='#L_CALLS_1339'><pre>1339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IC.eraseInstFromFunction(II)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1340' href='#L_CALLS_1340'><pre>1340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1341' href='#L_CALLS_1341'><pre>1341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all ones, this is a plain vector store of the 1st argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1342' href='#L_CALLS_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstMask->isAllOnesValue()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1343' href='#L_CALLS_1343'><pre>1343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *StorePtr = II.getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1344' href='#L_CALLS_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Alignment = cast<ConstantInt>(II.getArgOperand(2))->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1345' href='#L_CALLS_1345'><pre>1345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new StoreInst(II.getArgOperand(0), StorePtr, false, Alignment);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1346' href='#L_CALLS_1346'><pre>1346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1347' href='#L_CALLS_1347'><pre>1347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1348' href='#L_CALLS_1348'><pre>1348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1349' href='#L_CALLS_1349'><pre>1349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1350' href='#L_CALLS_1350'><pre>1350</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1351' href='#L_CALLS_1351'><pre>1351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Instruction *simplifyMaskedGather(IntrinsicInst &II, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1352' href='#L_CALLS_1352'><pre>1352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all zeros, return the "passthru" argument of the gather.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1353' href='#L_CALLS_1353'><pre>1353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ConstMask = dyn_cast<Constant>(II.getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1354' href='#L_CALLS_1354'><pre>1354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ConstMask && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstMask->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1355' href='#L_CALLS_1355'><pre>1355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IC.replaceInstUsesWith(II, II.getArgOperand(3))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1356' href='#L_CALLS_1356'><pre>1356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1357' href='#L_CALLS_1357'><pre>1357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1358' href='#L_CALLS_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1359' href='#L_CALLS_1359'><pre>1359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1360' href='#L_CALLS_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Instruction *simplifyMaskedScatter(IntrinsicInst &II, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1361' href='#L_CALLS_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the mask is all zeros, a scatter does nothing.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1362' href='#L_CALLS_1362'><pre>1362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ConstMask = dyn_cast<Constant>(II.getArgOperand(3));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1363' href='#L_CALLS_1363'><pre>1363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ConstMask && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstMask->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1364' href='#L_CALLS_1364'><pre>1364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IC.eraseInstFromFunction(II)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1365' href='#L_CALLS_1365'><pre>1365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1366' href='#L_CALLS_1366'><pre>1366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1367' href='#L_CALLS_1367'><pre>1367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1368' href='#L_CALLS_1368'><pre>1368</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1369' href='#L_CALLS_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre>static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1370' href='#L_CALLS_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> assert((II.getIntrinsicID() == Intrinsic::cttz ||</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1371' href='#L_CALLS_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> II.getIntrinsicID() == Intrinsic::ctlz) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1372' href='#L_CALLS_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> "Expected cttz or ctlz intrinsic");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1373' href='#L_CALLS_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> Value *Op0 = II.getArgOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1374' href='#L_CALLS_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // FIXME: Try to simplify vectors of integers.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1375' href='#L_CALLS_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> auto *IT = dyn_cast<IntegerType>(Op0->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1376' href='#L_CALLS_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> if (!IT)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1377' href='#L_CALLS_1377'><pre>1377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1378' href='#L_CALLS_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1379' href='#L_CALLS_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> unsigned BitWidth = IT->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1380' href='#L_CALLS_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> APInt KnownZero(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1381' href='#L_CALLS_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> APInt KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1382' href='#L_CALLS_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> IC.computeKnownBits(Op0, KnownZero, KnownOne, 0, &II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1383' href='#L_CALLS_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1384' href='#L_CALLS_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // Create a mask for bits above (ctlz) or below (cttz) the first known one.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1385' href='#L_CALLS_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> bool IsTZ = II.getIntrinsicID() == Intrinsic::cttz;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1386' href='#L_CALLS_1386'><pre>1386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> unsigned NumMaskBits = IsTZ ? <span class='red'>KnownOne.countTrailingZeros()</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1387' href='#L_CALLS_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> : KnownOne.countLeadingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1388' href='#L_CALLS_1388'><pre>1388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> APInt Mask = IsTZ ? <span class='red'>APInt::getLowBitsSet(BitWidth, NumMaskBits)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1389' href='#L_CALLS_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> : APInt::getHighBitsSet(BitWidth, NumMaskBits);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1390' href='#L_CALLS_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1391' href='#L_CALLS_1391'><pre>1391</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // If all bits above (ctlz) or below (cttz) the first known one are known</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1392' href='#L_CALLS_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // zero, this value is constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1393' href='#L_CALLS_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // FIXME: This should be in InstSimplify because we're replacing an</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1394' href='#L_CALLS_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // instruction with a constant.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1395' href='#L_CALLS_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> if (<div class='tooltip'>(Mask & KnownZero) == Mask<span class='tooltip-content'>19</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1396' href='#L_CALLS_1396'><pre>1396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *C = ConstantInt::get(IT, APInt(BitWidth, NumMaskBits));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1397' href='#L_CALLS_1397'><pre>1397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.replaceInstUsesWith(II, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1398' href='#L_CALLS_1398'><pre>1398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1399' href='#L_CALLS_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1400' href='#L_CALLS_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // If the input to cttz/ctlz is known to be non-zero,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1401' href='#L_CALLS_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // then change the 'ZeroIsUndef' parameter to 'true'</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1402' href='#L_CALLS_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // because we know the zero behavior can't affect the result.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1403' href='#L_CALLS_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>19</span></div><div class='tooltip'>KnownOne != 0 || <span class='tooltip-content'>19</span></div><div class='tooltip'>isKnownNonZero(Op0, IC.getDataLayout())<span class='tooltip-content'>19</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1404' href='#L_CALLS_1404'><pre>1404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!match(II.getArgOperand(1), m_One())</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1405' href='#L_CALLS_1405'><pre>1405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II.setOperand(1, IC.Builder->getTrue());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1406' href='#L_CALLS_1406'><pre>1406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1407' href='#L_CALLS_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1408' href='#L_CALLS_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1409' href='#L_CALLS_1409'><pre>1409</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1410' href='#L_CALLS_1410'><pre>1410</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1411' href='#L_CALLS_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1412' href='#L_CALLS_1412'><pre>1412</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1413' href='#L_CALLS_1413'><pre>1413</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// TODO: If the x86 backend knew how to convert a bool vector mask back to an</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1414' href='#L_CALLS_1414'><pre>1414</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// XMM register mask efficiently, we could transform all x86 masked intrinsics</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1415' href='#L_CALLS_1415'><pre>1415</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// to LLVM masked intrinsics and remove the x86 masked intrinsic defs.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1416' href='#L_CALLS_1416'><pre>1416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Instruction *simplifyX86MaskedLoad(IntrinsicInst &II, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1417' href='#L_CALLS_1417'><pre>1417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = II.getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1418' href='#L_CALLS_1418'><pre>1418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Mask = II.getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1419' href='#L_CALLS_1419'><pre>1419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *ZeroVec = Constant::getNullValue(II.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1420' href='#L_CALLS_1420'><pre>1420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1421' href='#L_CALLS_1421'><pre>1421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Special case a zero mask since that's not a ConstantDataVector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1422' href='#L_CALLS_1422'><pre>1422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This masked load instruction creates a zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1423' href='#L_CALLS_1423'><pre>1423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<ConstantAggregateZero>(Mask)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1424' href='#L_CALLS_1424'><pre>1424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IC.replaceInstUsesWith(II, ZeroVec)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1425' href='#L_CALLS_1425'><pre>1425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1426' href='#L_CALLS_1426'><pre>1426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *ConstMask = dyn_cast<ConstantDataVector>(Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1427' href='#L_CALLS_1427'><pre>1427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!ConstMask</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1428' href='#L_CALLS_1428'><pre>1428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1429' href='#L_CALLS_1429'><pre>1429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1430' href='#L_CALLS_1430'><pre>1430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The mask is constant. Convert this x86 intrinsic to the LLVM instrinsic</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1431' href='#L_CALLS_1431'><pre>1431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to allow target-independent optimizations.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1432' href='#L_CALLS_1432'><pre>1432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1433' href='#L_CALLS_1433'><pre>1433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // First, cast the x86 intrinsic scalar pointer to a vector pointer to match</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1434' href='#L_CALLS_1434'><pre>1434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the LLVM intrinsic definition for the pointer argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1435' href='#L_CALLS_1435'><pre>1435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned AddrSpace = cast<PointerType>(Ptr->getType())->getAddressSpace();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1436' href='#L_CALLS_1436'><pre>1436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *VecPtrTy = PointerType::get(II.getType(), AddrSpace);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1437' href='#L_CALLS_1437'><pre>1437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *PtrCast = IC.Builder->CreateBitCast(Ptr, VecPtrTy, "castvec");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1438' href='#L_CALLS_1438'><pre>1438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1439' href='#L_CALLS_1439'><pre>1439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Second, convert the x86 XMM integer vector mask to a vector of bools based</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1440' href='#L_CALLS_1440'><pre>1440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // on each element's most significant bit (the sign bit).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1441' href='#L_CALLS_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *BoolMask = getNegativeIsTrueBoolVec(ConstMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1442' href='#L_CALLS_1442'><pre>1442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1443' href='#L_CALLS_1443'><pre>1443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The pass-through vector for an x86 masked load is a zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1444' href='#L_CALLS_1444'><pre>1444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewMaskedLoad =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1445' href='#L_CALLS_1445'><pre>1445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Builder->CreateMaskedLoad(PtrCast, 1, BoolMask, ZeroVec);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1446' href='#L_CALLS_1446'><pre>1446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.replaceInstUsesWith(II, NewMaskedLoad)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1447' href='#L_CALLS_1447'><pre>1447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1448' href='#L_CALLS_1448'><pre>1448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1449' href='#L_CALLS_1449'><pre>1449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// TODO: If the x86 backend knew how to convert a bool vector mask back to an</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1450' href='#L_CALLS_1450'><pre>1450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// XMM register mask efficiently, we could transform all x86 masked intrinsics</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1451' href='#L_CALLS_1451'><pre>1451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// to LLVM masked intrinsics and remove the x86 masked intrinsic defs.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1452' href='#L_CALLS_1452'><pre>1452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool simplifyX86MaskedStore(IntrinsicInst &II, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1453' href='#L_CALLS_1453'><pre>1453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = II.getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1454' href='#L_CALLS_1454'><pre>1454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Mask = II.getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1455' href='#L_CALLS_1455'><pre>1455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Vec = II.getOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1456' href='#L_CALLS_1456'><pre>1456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1457' href='#L_CALLS_1457'><pre>1457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Special case a zero mask since that's not a ConstantDataVector:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1458' href='#L_CALLS_1458'><pre>1458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // this masked store instruction does nothing.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1459' href='#L_CALLS_1459'><pre>1459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(Mask)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1460' href='#L_CALLS_1460'><pre>1460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.eraseInstFromFunction(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1461' href='#L_CALLS_1461'><pre>1461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1462' href='#L_CALLS_1462'><pre>1462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1463' href='#L_CALLS_1463'><pre>1463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1464' href='#L_CALLS_1464'><pre>1464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The SSE2 version is too weird (eg, unaligned but non-temporal) to do</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1465' href='#L_CALLS_1465'><pre>1465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // anything else at this level.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1466' href='#L_CALLS_1466'><pre>1466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II.getIntrinsicID() == Intrinsic::x86_sse2_maskmov_dqu</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1467' href='#L_CALLS_1467'><pre>1467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1468' href='#L_CALLS_1468'><pre>1468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1469' href='#L_CALLS_1469'><pre>1469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *ConstMask = dyn_cast<ConstantDataVector>(Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1470' href='#L_CALLS_1470'><pre>1470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!ConstMask</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1471' href='#L_CALLS_1471'><pre>1471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1472' href='#L_CALLS_1472'><pre>1472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1473' href='#L_CALLS_1473'><pre>1473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The mask is constant. Convert this x86 intrinsic to the LLVM instrinsic</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1474' href='#L_CALLS_1474'><pre>1474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to allow target-independent optimizations.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1475' href='#L_CALLS_1475'><pre>1475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1476' href='#L_CALLS_1476'><pre>1476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // First, cast the x86 intrinsic scalar pointer to a vector pointer to match</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1477' href='#L_CALLS_1477'><pre>1477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the LLVM intrinsic definition for the pointer argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1478' href='#L_CALLS_1478'><pre>1478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned AddrSpace = cast<PointerType>(Ptr->getType())->getAddressSpace();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1479' href='#L_CALLS_1479'><pre>1479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *VecPtrTy = PointerType::get(Vec->getType(), AddrSpace);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1480' href='#L_CALLS_1480'><pre>1480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *PtrCast = IC.Builder->CreateBitCast(Ptr, VecPtrTy, "castvec");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1481' href='#L_CALLS_1481'><pre>1481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1482' href='#L_CALLS_1482'><pre>1482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Second, convert the x86 XMM integer vector mask to a vector of bools based</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1483' href='#L_CALLS_1483'><pre>1483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // on each element's most significant bit (the sign bit).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1484' href='#L_CALLS_1484'><pre>1484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *BoolMask = getNegativeIsTrueBoolVec(ConstMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1485' href='#L_CALLS_1485'><pre>1485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1486' href='#L_CALLS_1486'><pre>1486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Builder->CreateMaskedStore(Vec, PtrCast, 1, BoolMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1487' href='#L_CALLS_1487'><pre>1487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1488' href='#L_CALLS_1488'><pre>1488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // 'Replace uses' doesn't work for stores. Erase the original masked store.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1489' href='#L_CALLS_1489'><pre>1489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.eraseInstFromFunction(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1490' href='#L_CALLS_1490'><pre>1490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1491' href='#L_CALLS_1491'><pre>1491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1492' href='#L_CALLS_1492'><pre>1492</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1493' href='#L_CALLS_1493'><pre>1493</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Constant fold llvm.amdgcn.fmed3 intrinsics for standard inputs.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1494' href='#L_CALLS_1494'><pre>1494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1495' href='#L_CALLS_1495'><pre>1495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// A single NaN input is folded to minnum, so we rely on that folding for</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1496' href='#L_CALLS_1496'><pre>1496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// handling NaNs.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1497' href='#L_CALLS_1497'><pre>1497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static APFloat fmed3AMDGCN(const APFloat &Src0, const APFloat &Src1,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1498' href='#L_CALLS_1498'><pre>1498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const APFloat &Src2) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1499' href='#L_CALLS_1499'><pre>1499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Max3 = maxnum(maxnum(Src0, Src1), Src2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1500' href='#L_CALLS_1500'><pre>1500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1501' href='#L_CALLS_1501'><pre>1501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::cmpResult Cmp0 = Max3.compare(Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1502' href='#L_CALLS_1502'><pre>1502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Cmp0 != APFloat::cmpUnordered && "nans handled separately");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1503' href='#L_CALLS_1503'><pre>1503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Cmp0 == APFloat::cmpEqual</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1504' href='#L_CALLS_1504'><pre>1504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return maxnum(Src1, Src2)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1505' href='#L_CALLS_1505'><pre>1505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1506' href='#L_CALLS_1506'><pre>1506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APFloat::cmpResult Cmp1 = Max3.compare(Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1507' href='#L_CALLS_1507'><pre>1507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Cmp1 != APFloat::cmpUnordered && "nans handled separately");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1508' href='#L_CALLS_1508'><pre>1508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Cmp1 == APFloat::cmpEqual</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1509' href='#L_CALLS_1509'><pre>1509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return maxnum(Src0, Src2)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1510' href='#L_CALLS_1510'><pre>1510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1511' href='#L_CALLS_1511'><pre>1511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return maxnum(Src0, Src1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1512' href='#L_CALLS_1512'><pre>1512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1513' href='#L_CALLS_1513'><pre>1513</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1514' href='#L_CALLS_1514'><pre>1514</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Returns true iff the 2 intrinsics have the same operands, limiting the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1515' href='#L_CALLS_1515'><pre>1515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// comparison to the first NumOperands.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1516' href='#L_CALLS_1516'><pre>1516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool haveSameOperands(const IntrinsicInst &I, const IntrinsicInst &E,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1517' href='#L_CALLS_1517'><pre>1517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> unsigned NumOperands) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1518' href='#L_CALLS_1518'><pre>1518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(I.getNumArgOperands() >= NumOperands && "Not enough operands");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1519' href='#L_CALLS_1519'><pre>1519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(E.getNumArgOperands() >= NumOperands && "Not enough operands");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1520' href='#L_CALLS_1520'><pre>1520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < NumOperands</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>i++</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1521' href='#L_CALLS_1521'><pre>1521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I.getArgOperand(i) != E.getArgOperand(i)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1522' href='#L_CALLS_1522'><pre>1522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1523' href='#L_CALLS_1523'><pre>1523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1524' href='#L_CALLS_1524'><pre>1524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1525' href='#L_CALLS_1525'><pre>1525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1526' href='#L_CALLS_1526'><pre>1526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Remove trivially empty start/end intrinsic ranges, i.e. a start</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1527' href='#L_CALLS_1527'><pre>1527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// immediately followed by an end (ignoring debuginfo or other</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1528' href='#L_CALLS_1528'><pre>1528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// start/end intrinsics in between). As this handles only the most trivial</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1529' href='#L_CALLS_1529'><pre>1529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// cases, tracking the nesting level is not needed:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1530' href='#L_CALLS_1530'><pre>1530</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1531' href='#L_CALLS_1531'><pre>1531</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// call @llvm.foo.start(i1 0) ; &I</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1532' href='#L_CALLS_1532'><pre>1532</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// call @llvm.foo.start(i1 0)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1533' href='#L_CALLS_1533'><pre>1533</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// call @llvm.foo.end(i1 0) ; This one will not be skipped: it will be removed</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1534' href='#L_CALLS_1534'><pre>1534</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// call @llvm.foo.end(i1 0)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1535' href='#L_CALLS_1535'><pre>1535</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool removeTriviallyEmptyRange(IntrinsicInst &I, unsigned StartID,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1536' href='#L_CALLS_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> unsigned EndID, InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1537' href='#L_CALLS_1537'><pre>1537</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> assert(I.getIntrinsicID() == StartID &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1538' href='#L_CALLS_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> "Start intrinsic does not have expected ID");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1539' href='#L_CALLS_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> BasicBlock::iterator BI(I), BE(I.getParent()->end());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1540' href='#L_CALLS_1540'><pre>1540</pre></a></td><td class='covered-line'><pre>160k</pre></td><td class='code'><pre> for (++BI; <div class='tooltip'>BI != BE<span class='tooltip-content'>160k</span></div>; <div class='tooltip'>++BI<span class='tooltip-content'>5.33k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>160k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1541' href='#L_CALLS_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>160k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>E<span class='tooltip-content'>160k</span></div> = dyn_cast<IntrinsicInst>(BI)) <div class='tooltip'>{<span class='tooltip-content'>11.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1542' href='#L_CALLS_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>11.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<DbgInfoIntrinsic>(E) || <span class='tooltip-content'>11.6k</span></div><div class='tooltip'>E->getIntrinsicID() == StartID<span class='tooltip-content'>11.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1543' href='#L_CALLS_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>5.33k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1544' href='#L_CALLS_1544'><pre>1544</pre></a></td><td class='covered-line'><pre>6.27k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.27k</span></div><div class='tooltip'>E->getIntrinsicID() == EndID &&<span class='tooltip-content'>6.27k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1545' href='#L_CALLS_1545'><pre>1545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>haveSameOperands(I, *E, E->getNumArgOperands())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1546' href='#L_CALLS_1546'><pre>1546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.eraseInstFromFunction(*E);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1547' href='#L_CALLS_1547'><pre>1547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.eraseInstFromFunction(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1548' href='#L_CALLS_1548'><pre>1548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1549' href='#L_CALLS_1549'><pre>1549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1550' href='#L_CALLS_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>6.27k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1551' href='#L_CALLS_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1552' href='#L_CALLS_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>160k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1553' href='#L_CALLS_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1554' href='#L_CALLS_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1555' href='#L_CALLS_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1556' href='#L_CALLS_1556'><pre>1556</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1557' href='#L_CALLS_1557'><pre>1557</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Convert NVVM intrinsics to target-generic LLVM code where possible.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1558' href='#L_CALLS_1558'><pre>1558</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre>static Instruction *SimplifyNVVMIntrinsic(IntrinsicInst *II, InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1559' href='#L_CALLS_1559'><pre>1559</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Each NVVM intrinsic we can simplify can be replaced with one of:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1560' href='#L_CALLS_1560'><pre>1560</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1561' href='#L_CALLS_1561'><pre>1561</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // * an LLVM intrinsic,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1562' href='#L_CALLS_1562'><pre>1562</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // * an LLVM cast operation,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1563' href='#L_CALLS_1563'><pre>1563</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // * an LLVM binary operation, or</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1564' href='#L_CALLS_1564'><pre>1564</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // * ad-hoc LLVM IR for the particular operation.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1565' href='#L_CALLS_1565'><pre>1565</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1566' href='#L_CALLS_1566'><pre>1566</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Some transformations are only valid when the module's</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1567' href='#L_CALLS_1567'><pre>1567</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // flush-denormals-to-zero (ftz) setting is true/false, whereas other</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1568' href='#L_CALLS_1568'><pre>1568</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // transformations are valid regardless of the module's ftz setting.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1569' href='#L_CALLS_1569'><pre>1569</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> enum FtzRequirementTy {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1570' href='#L_CALLS_1570'><pre>1570</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> FTZ_Any, // Any ftz setting is ok.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1571' href='#L_CALLS_1571'><pre>1571</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> FTZ_MustBeOn, // Transformation is valid only if ftz is on.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1572' href='#L_CALLS_1572'><pre>1572</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> FTZ_MustBeOff, // Transformation is valid only if ftz is off.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1573' href='#L_CALLS_1573'><pre>1573</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1574' href='#L_CALLS_1574'><pre>1574</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Classes of NVVM intrinsics that can't be replaced one-to-one with a</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1575' href='#L_CALLS_1575'><pre>1575</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // target-generic intrinsic, cast op, or binary op but that we can nonetheless</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1576' href='#L_CALLS_1576'><pre>1576</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // simplify.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1577' href='#L_CALLS_1577'><pre>1577</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> enum SpecialCase {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1578' href='#L_CALLS_1578'><pre>1578</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> SPC_Reciprocal,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1579' href='#L_CALLS_1579'><pre>1579</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1580' href='#L_CALLS_1580'><pre>1580</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1581' href='#L_CALLS_1581'><pre>1581</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // SimplifyAction is a poor-man's variant (plus an additional flag) that</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1582' href='#L_CALLS_1582'><pre>1582</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // represents how to replace an NVVM intrinsic with target-generic LLVM IR.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1583' href='#L_CALLS_1583'><pre>1583</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> struct SimplifyAction {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1584' href='#L_CALLS_1584'><pre>1584</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Invariant: At most one of these Optionals has a value.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1585' href='#L_CALLS_1585'><pre>1585</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> Optional<Intrinsic::ID> IID;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1586' href='#L_CALLS_1586'><pre>1586</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> Optional<Instruction::CastOps> CastOp;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1587' href='#L_CALLS_1587'><pre>1587</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> Optional<Instruction::BinaryOps> BinaryOp;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1588' href='#L_CALLS_1588'><pre>1588</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> Optional<SpecialCase> Special;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1589' href='#L_CALLS_1589'><pre>1589</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1590' href='#L_CALLS_1590'><pre>1590</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> FtzRequirementTy FtzRequirement = FTZ_Any;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1591' href='#L_CALLS_1591'><pre>1591</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1592' href='#L_CALLS_1592'><pre>1592</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> SimplifyAction() = default;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1593' href='#L_CALLS_1593'><pre>1593</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1594' href='#L_CALLS_1594'><pre>1594</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> SimplifyAction(Intrinsic::ID IID, FtzRequirementTy FtzReq)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1595' href='#L_CALLS_1595'><pre>1595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : IID(IID), FtzRequirement(FtzReq) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1596' href='#L_CALLS_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1597' href='#L_CALLS_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Cast operations don't have anything to do with FTZ, so we skip that</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1598' href='#L_CALLS_1598'><pre>1598</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // argument.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1599' href='#L_CALLS_1599'><pre>1599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> SimplifyAction(Instruction::CastOps CastOp) : CastOp(CastOp) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1600' href='#L_CALLS_1600'><pre>1600</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1601' href='#L_CALLS_1601'><pre>1601</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1602' href='#L_CALLS_1602'><pre>1602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : BinaryOp(BinaryOp), FtzRequirement(FtzReq) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1603' href='#L_CALLS_1603'><pre>1603</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1604' href='#L_CALLS_1604'><pre>1604</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> SimplifyAction(SpecialCase Special, FtzRequirementTy FtzReq)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1605' href='#L_CALLS_1605'><pre>1605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : Special(Special), FtzRequirement(FtzReq) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1606' href='#L_CALLS_1606'><pre>1606</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1607' href='#L_CALLS_1607'><pre>1607</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1608' href='#L_CALLS_1608'><pre>1608</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Try to generate a SimplifyAction describing how to replace our</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1609' href='#L_CALLS_1609'><pre>1609</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // IntrinsicInstr with target-generic LLVM IR.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1610' href='#L_CALLS_1610'><pre>1610</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> const SimplifyAction Action = [II]() -> SimplifyAction {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1611' href='#L_CALLS_1611'><pre>1611</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> switch (II->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1612' href='#L_CALLS_1612'><pre>1612</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1613' href='#L_CALLS_1613'><pre>1613</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // NVVM intrinsics that map directly to LLVM intrinsics.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1614' href='#L_CALLS_1614'><pre>1614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::nvvm_ceil_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1615' href='#L_CALLS_1615'><pre>1615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::ceil, FTZ_Any};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1616' href='#L_CALLS_1616'><pre>1616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ceil_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1617' href='#L_CALLS_1617'><pre>1617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::ceil, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1618' href='#L_CALLS_1618'><pre>1618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ceil_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1619' href='#L_CALLS_1619'><pre>1619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::ceil, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1620' href='#L_CALLS_1620'><pre>1620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fabs_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1621' href='#L_CALLS_1621'><pre>1621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fabs, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1622' href='#L_CALLS_1622'><pre>1622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fabs_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1623' href='#L_CALLS_1623'><pre>1623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fabs, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1624' href='#L_CALLS_1624'><pre>1624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fabs_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1625' href='#L_CALLS_1625'><pre>1625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fabs, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1626' href='#L_CALLS_1626'><pre>1626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_floor_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1627' href='#L_CALLS_1627'><pre>1627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::floor, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1628' href='#L_CALLS_1628'><pre>1628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_floor_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1629' href='#L_CALLS_1629'><pre>1629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::floor, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1630' href='#L_CALLS_1630'><pre>1630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_floor_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1631' href='#L_CALLS_1631'><pre>1631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::floor, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1632' href='#L_CALLS_1632'><pre>1632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fma_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1633' href='#L_CALLS_1633'><pre>1633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fma, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1634' href='#L_CALLS_1634'><pre>1634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fma_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1635' href='#L_CALLS_1635'><pre>1635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fma, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1636' href='#L_CALLS_1636'><pre>1636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fma_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1637' href='#L_CALLS_1637'><pre>1637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::fma, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1638' href='#L_CALLS_1638'><pre>1638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmax_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1639' href='#L_CALLS_1639'><pre>1639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::maxnum, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1640' href='#L_CALLS_1640'><pre>1640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmax_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1641' href='#L_CALLS_1641'><pre>1641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::maxnum, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1642' href='#L_CALLS_1642'><pre>1642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmax_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1643' href='#L_CALLS_1643'><pre>1643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::maxnum, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1644' href='#L_CALLS_1644'><pre>1644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmin_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1645' href='#L_CALLS_1645'><pre>1645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::minnum, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1646' href='#L_CALLS_1646'><pre>1646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmin_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1647' href='#L_CALLS_1647'><pre>1647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::minnum, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1648' href='#L_CALLS_1648'><pre>1648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_fmin_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1649' href='#L_CALLS_1649'><pre>1649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::minnum, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1650' href='#L_CALLS_1650'><pre>1650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_round_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1651' href='#L_CALLS_1651'><pre>1651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::round, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1652' href='#L_CALLS_1652'><pre>1652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_round_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1653' href='#L_CALLS_1653'><pre>1653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::round, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1654' href='#L_CALLS_1654'><pre>1654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_round_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1655' href='#L_CALLS_1655'><pre>1655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::round, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1656' href='#L_CALLS_1656'><pre>1656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_sqrt_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1657' href='#L_CALLS_1657'><pre>1657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::sqrt, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1658' href='#L_CALLS_1658'><pre>1658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_sqrt_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1659' href='#L_CALLS_1659'><pre>1659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // nvvm_sqrt_f is a special case. For most intrinsics, foo_ftz_f is the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1660' href='#L_CALLS_1660'><pre>1660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ftz version, and foo_f is the non-ftz version. But nvvm_sqrt_f adopts</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1661' href='#L_CALLS_1661'><pre>1661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the ftz-ness of the surrounding code. sqrt_rn_f and sqrt_rn_ftz_f are</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1662' href='#L_CALLS_1662'><pre>1662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the versions with explicit ftz-ness.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1663' href='#L_CALLS_1663'><pre>1663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::sqrt, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1664' href='#L_CALLS_1664'><pre>1664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_sqrt_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1665' href='#L_CALLS_1665'><pre>1665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::sqrt, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1666' href='#L_CALLS_1666'><pre>1666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_sqrt_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1667' href='#L_CALLS_1667'><pre>1667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::sqrt, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1668' href='#L_CALLS_1668'><pre>1668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_trunc_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1669' href='#L_CALLS_1669'><pre>1669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::trunc, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1670' href='#L_CALLS_1670'><pre>1670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_trunc_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1671' href='#L_CALLS_1671'><pre>1671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::trunc, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1672' href='#L_CALLS_1672'><pre>1672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_trunc_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1673' href='#L_CALLS_1673'><pre>1673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Intrinsic::trunc, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1674' href='#L_CALLS_1674'><pre>1674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1675' href='#L_CALLS_1675'><pre>1675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // NVVM intrinsics that map to LLVM cast operations.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1676' href='#L_CALLS_1676'><pre>1676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1677' href='#L_CALLS_1677'><pre>1677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that llvm's target-generic conversion operators correspond to the rz</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1678' href='#L_CALLS_1678'><pre>1678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (round to zero) versions of the nvvm conversion intrinsics, even though</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1679' href='#L_CALLS_1679'><pre>1679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // most everything else here uses the rn (round to nearest even) nvvm ops.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1680' href='#L_CALLS_1680'><pre>1680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_d2i_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1681' href='#L_CALLS_1681'><pre>1681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_f2i_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1682' href='#L_CALLS_1682'><pre>1682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_d2ll_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1683' href='#L_CALLS_1683'><pre>1683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_f2ll_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1684' href='#L_CALLS_1684'><pre>1684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FPToSI}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1685' href='#L_CALLS_1685'><pre>1685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_d2ui_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1686' href='#L_CALLS_1686'><pre>1686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_f2ui_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1687' href='#L_CALLS_1687'><pre>1687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_d2ull_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1688' href='#L_CALLS_1688'><pre>1688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_f2ull_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1689' href='#L_CALLS_1689'><pre>1689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FPToUI}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1690' href='#L_CALLS_1690'><pre>1690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_i2d_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1691' href='#L_CALLS_1691'><pre>1691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_i2f_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1692' href='#L_CALLS_1692'><pre>1692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ll2d_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1693' href='#L_CALLS_1693'><pre>1693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ll2f_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1694' href='#L_CALLS_1694'><pre>1694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::SIToFP}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1695' href='#L_CALLS_1695'><pre>1695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ui2d_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1696' href='#L_CALLS_1696'><pre>1696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ui2f_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1697' href='#L_CALLS_1697'><pre>1697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ull2d_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1698' href='#L_CALLS_1698'><pre>1698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_ull2f_rz:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1699' href='#L_CALLS_1699'><pre>1699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::UIToFP}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1700' href='#L_CALLS_1700'><pre>1700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1701' href='#L_CALLS_1701'><pre>1701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // NVVM intrinsics that map to LLVM binary ops.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1702' href='#L_CALLS_1702'><pre>1702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_add_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1703' href='#L_CALLS_1703'><pre>1703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FAdd, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1704' href='#L_CALLS_1704'><pre>1704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_add_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1705' href='#L_CALLS_1705'><pre>1705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FAdd, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1706' href='#L_CALLS_1706'><pre>1706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_add_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1707' href='#L_CALLS_1707'><pre>1707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FAdd, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1708' href='#L_CALLS_1708'><pre>1708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_mul_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1709' href='#L_CALLS_1709'><pre>1709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FMul, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1710' href='#L_CALLS_1710'><pre>1710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_mul_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1711' href='#L_CALLS_1711'><pre>1711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FMul, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1712' href='#L_CALLS_1712'><pre>1712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_mul_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1713' href='#L_CALLS_1713'><pre>1713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FMul, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1714' href='#L_CALLS_1714'><pre>1714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_div_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1715' href='#L_CALLS_1715'><pre>1715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FDiv, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1716' href='#L_CALLS_1716'><pre>1716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_div_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1717' href='#L_CALLS_1717'><pre>1717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FDiv, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1718' href='#L_CALLS_1718'><pre>1718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_div_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1719' href='#L_CALLS_1719'><pre>1719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {Instruction::FDiv, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1720' href='#L_CALLS_1720'><pre>1720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1721' href='#L_CALLS_1721'><pre>1721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The remainder of cases are NVVM intrinsics that map to LLVM idioms, but</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1722' href='#L_CALLS_1722'><pre>1722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // need special handling.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1723' href='#L_CALLS_1723'><pre>1723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1724' href='#L_CALLS_1724'><pre>1724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We seem to be mising intrinsics for rcp.approx.{ftz.}f32, which is just</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1725' href='#L_CALLS_1725'><pre>1725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // as well.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1726' href='#L_CALLS_1726'><pre>1726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_rcp_rn_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1727' href='#L_CALLS_1727'><pre>1727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {SPC_Reciprocal, FTZ_Any}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1728' href='#L_CALLS_1728'><pre>1728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_rcp_rn_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1729' href='#L_CALLS_1729'><pre>1729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {SPC_Reciprocal, FTZ_MustBeOff}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1730' href='#L_CALLS_1730'><pre>1730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nvvm_rcp_rn_ftz_f:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1731' href='#L_CALLS_1731'><pre>1731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return {SPC_Reciprocal, FTZ_MustBeOn}</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1732' href='#L_CALLS_1732'><pre>1732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1733' href='#L_CALLS_1733'><pre>1733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We do not currently simplify intrinsics that give an approximate answer.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1734' href='#L_CALLS_1734'><pre>1734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These include:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1735' href='#L_CALLS_1735'><pre>1735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1736' href='#L_CALLS_1736'><pre>1736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_cos_approx_{f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1737' href='#L_CALLS_1737'><pre>1737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_ex2_approx_{d,f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1738' href='#L_CALLS_1738'><pre>1738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_lg2_approx_{d,f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1739' href='#L_CALLS_1739'><pre>1739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_sin_approx_{f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1740' href='#L_CALLS_1740'><pre>1740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_sqrt_approx_{f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1741' href='#L_CALLS_1741'><pre>1741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_rsqrt_approx_{d,f,ftz_f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1742' href='#L_CALLS_1742'><pre>1742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_div_approx_{ftz_d,ftz_f,f}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1743' href='#L_CALLS_1743'><pre>1743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // - nvvm_rcp_approx_ftz_d</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1744' href='#L_CALLS_1744'><pre>1744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1745' href='#L_CALLS_1745'><pre>1745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Ideally we'd encode them as e.g. "fast call @llvm.cos", where "fast"</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1746' href='#L_CALLS_1746'><pre>1746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // means that fastmath is enabled in the intrinsic. Unfortunately only</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1747' href='#L_CALLS_1747'><pre>1747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // binary operators (currently) have a fastmath bit in SelectionDAG, so this</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1748' href='#L_CALLS_1748'><pre>1748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // information gets lost and we can't select on it.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1749' href='#L_CALLS_1749'><pre>1749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1750' href='#L_CALLS_1750'><pre>1750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: div and rcp are lowered to a binary op, so these we could in theory</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1751' href='#L_CALLS_1751'><pre>1751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // lower them to "fast fdiv".</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1752' href='#L_CALLS_1752'><pre>1752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1753' href='#L_CALLS_1753'><pre>1753</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre><span class='red'> </span>default:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1754' href='#L_CALLS_1754'><pre>1754</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> return {};</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1755' href='#L_CALLS_1755'><pre>1755</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1756' href='#L_CALLS_1756'><pre>1756</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> }();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1757' href='#L_CALLS_1757'><pre>1757</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1758' href='#L_CALLS_1758'><pre>1758</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // If Action.FtzRequirementTy is not satisfied by the module's ftz state, we</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1759' href='#L_CALLS_1759'><pre>1759</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // can bail out now. (Notice that in the case that IID is not an NVVM</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1760' href='#L_CALLS_1760'><pre>1760</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // intrinsic, we don't have to look up any module metadata, as</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1761' href='#L_CALLS_1761'><pre>1761</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // FtzRequirementTy will be FTZ_Any.)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1762' href='#L_CALLS_1762'><pre>1762</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> if (<div class='tooltip'>Action.FtzRequirement != FTZ_Any<span class='tooltip-content'>451k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1763' href='#L_CALLS_1763'><pre>1763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool FtzEnabled =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1764' href='#L_CALLS_1764'><pre>1764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getFunction()->getFnAttribute("nvptx-f32ftz").getValueAsString() ==</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1765' href='#L_CALLS_1765'><pre>1765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "true";</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1766' href='#L_CALLS_1766'><pre>1766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1767' href='#L_CALLS_1767'><pre>1767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>FtzEnabled != (Action.FtzRequirement == FTZ_MustBeOn)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1768' href='#L_CALLS_1768'><pre>1768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1769' href='#L_CALLS_1769'><pre>1769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1770' href='#L_CALLS_1770'><pre>1770</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1771' href='#L_CALLS_1771'><pre>1771</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Simplify to target-generic intrinsic.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1772' href='#L_CALLS_1772'><pre>1772</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>451k</span></div><div class='tooltip'>Action.IID<span class='tooltip-content'>451k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1773' href='#L_CALLS_1773'><pre>1773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Value *, 4> Args(II->arg_operands());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1774' href='#L_CALLS_1774'><pre>1774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // All the target-generic intrinsics currently of interest to us have one</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1775' href='#L_CALLS_1775'><pre>1775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // type argument, equal to that of the nvvm intrinsic's argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1776' href='#L_CALLS_1776'><pre>1776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Tys[] = {II->getArgOperand(0)->getType()};</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1777' href='#L_CALLS_1777'><pre>1777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CallInst::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1778' href='#L_CALLS_1778'><pre>1778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Intrinsic::getDeclaration(II->getModule(), *Action.IID, Tys), Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1779' href='#L_CALLS_1779'><pre>1779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1780' href='#L_CALLS_1780'><pre>1780</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1781' href='#L_CALLS_1781'><pre>1781</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Simplify to target-generic binary op.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1782' href='#L_CALLS_1782'><pre>1782</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>451k</span></div><div class='tooltip'>Action.BinaryOp<span class='tooltip-content'>451k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1783' href='#L_CALLS_1783'><pre>1783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::Create(*Action.BinaryOp, II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1784' href='#L_CALLS_1784'><pre>1784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getArgOperand(1), II->getName())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1785' href='#L_CALLS_1785'><pre>1785</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1786' href='#L_CALLS_1786'><pre>1786</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // Simplify to target-generic cast op.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1787' href='#L_CALLS_1787'><pre>1787</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>451k</span></div><div class='tooltip'>Action.CastOp<span class='tooltip-content'>451k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1788' href='#L_CALLS_1788'><pre>1788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return CastInst::Create(*Action.CastOp, II->getArgOperand(0), II->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1789' href='#L_CALLS_1789'><pre>1789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getName())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1790' href='#L_CALLS_1790'><pre>1790</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1791' href='#L_CALLS_1791'><pre>1791</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> // All that's left are the special cases.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1792' href='#L_CALLS_1792'><pre>1792</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>451k</span></div><div class='tooltip'>!Action.Special<span class='tooltip-content'>451k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1793' href='#L_CALLS_1793'><pre>1793</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1794' href='#L_CALLS_1794'><pre>1794</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1795' href='#L_CALLS_1795'><pre>1795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>switch (*Action.Special) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1796' href='#L_CALLS_1796'><pre>1796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPC_Reciprocal:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1797' href='#L_CALLS_1797'><pre>1797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplify reciprocal.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1798' href='#L_CALLS_1798'><pre>1798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1799' href='#L_CALLS_1799'><pre>1799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction::FDiv, ConstantFP::get(II->getArgOperand(0)->getType(), 1),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1800' href='#L_CALLS_1800'><pre>1800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getArgOperand(0), II->getName())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1801' href='#L_CALLS_1801'><pre>1801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1802' href='#L_CALLS_1802'><pre>1802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>("All SpecialCase enumerators should be handled in switch.");</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1803' href='#L_CALLS_1803'><pre>1803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1804' href='#L_CALLS_1804'><pre>1804</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1805' href='#L_CALLS_1805'><pre>1805</pre></a></td><td class='covered-line'><pre>225</pre></td><td class='code'><pre>Instruction *InstCombiner::visitVAStartInst(VAStartInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1806' href='#L_CALLS_1806'><pre>1806</pre></a></td><td class='covered-line'><pre>225</pre></td><td class='code'><pre> removeTriviallyEmptyRange(I, Intrinsic::vastart, Intrinsic::vaend, *this);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1807' href='#L_CALLS_1807'><pre>1807</pre></a></td><td class='covered-line'><pre>225</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1808' href='#L_CALLS_1808'><pre>1808</pre></a></td><td class='covered-line'><pre>225</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1809' href='#L_CALLS_1809'><pre>1809</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1810' href='#L_CALLS_1810'><pre>1810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Instruction *InstCombiner::visitVACopyInst(VACopyInst &I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1811' href='#L_CALLS_1811'><pre>1811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> removeTriviallyEmptyRange(I, Intrinsic::vacopy, Intrinsic::vaend, *this);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1812' href='#L_CALLS_1812'><pre>1812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1813' href='#L_CALLS_1813'><pre>1813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1814' href='#L_CALLS_1814'><pre>1814</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1815' href='#L_CALLS_1815'><pre>1815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// CallInst simplification. This mostly only handles folding of intrinsic</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1816' href='#L_CALLS_1816'><pre>1816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instructions. For normal calls, it allows visitCallSite to do the heavy</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1817' href='#L_CALLS_1817'><pre>1817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// lifting.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1818' href='#L_CALLS_1818'><pre>1818</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitCallInst(CallInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1819' href='#L_CALLS_1819'><pre>1819</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> auto Args = CI.arg_operands();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1820' href='#L_CALLS_1820'><pre>1820</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> if (Value *V = SimplifyCall(CI.getCalledValue(), Args.begin(), Args.end(), DL,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1821' href='#L_CALLS_1821'><pre>1821</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1822' href='#L_CALLS_1822'><pre>1822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(CI, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1823' href='#L_CALLS_1823'><pre>1823</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1824' href='#L_CALLS_1824'><pre>1824</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.77M</span></div><div class='tooltip'>isFreeCall(&CI, &TLI)<span class='tooltip-content'>1.77M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1825' href='#L_CALLS_1825'><pre>1825</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> return visitFree(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1826' href='#L_CALLS_1826'><pre>1826</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1827' href='#L_CALLS_1827'><pre>1827</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> // If the caller function is nounwind, mark the call as nounwind, even if the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1828' href='#L_CALLS_1828'><pre>1828</pre></a></td><td class='covered-line'><pre>1.77M</pre></td><td class='code'><pre> // callee isn't.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1829' href='#L_CALLS_1829'><pre>1829</pre></a></td><td class='covered-line'><pre>1.66M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.66M</span></div><div class='tooltip'>CI.getFunction()->doesNotThrow() && <span class='tooltip-content'>1.66M</span></div><div class='tooltip'>!CI.doesNotThrow()<span class='tooltip-content'>1.02M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1830' href='#L_CALLS_1830'><pre>1830</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> CI.setDoesNotThrow();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1831' href='#L_CALLS_1831'><pre>1831</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> return &CI;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1832' href='#L_CALLS_1832'><pre>1832</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1833' href='#L_CALLS_1833'><pre>1833</pre></a></td><td class='covered-line'><pre>1.66M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1834' href='#L_CALLS_1834'><pre>1834</pre></a></td><td class='covered-line'><pre>1.65M</pre></td><td class='code'><pre> IntrinsicInst *II = dyn_cast<IntrinsicInst>(&CI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1835' href='#L_CALLS_1835'><pre>1835</pre></a></td><td class='covered-line'><pre>1.65M</pre></td><td class='code'><pre> if (<div class='tooltip'>!II<span class='tooltip-content'>1.65M</span></div>) <div class='tooltip'>return visitCallSite(&CI)<span class='tooltip-content'>1.20M</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1836' href='#L_CALLS_1836'><pre>1836</pre></a></td><td class='covered-line'><pre>1.65M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1837' href='#L_CALLS_1837'><pre>1837</pre></a></td><td class='covered-line'><pre>1.65M</pre></td><td class='code'><pre> // Intrinsics cannot occur in an invoke, so handle them here instead of in</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1838' href='#L_CALLS_1838'><pre>1838</pre></a></td><td class='covered-line'><pre>1.65M</pre></td><td class='code'><pre> // visitCallSite.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1839' href='#L_CALLS_1839'><pre>1839</pre></a></td><td class='covered-line'><pre>452k</pre></td><td class='code'><pre> <div class='tooltip'>if (MemIntrinsic *<span class='tooltip-content'>452k</span></div><div class='tooltip'>MI<span class='tooltip-content'>452k</span></div> = dyn_cast<MemIntrinsic>(II)) <div class='tooltip'>{<span class='tooltip-content'>78.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1840' href='#L_CALLS_1840'><pre>1840</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre> bool Changed = false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1841' href='#L_CALLS_1841'><pre>1841</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1842' href='#L_CALLS_1842'><pre>1842</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre> // memmove/cpy/set of zero bytes is a noop.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1843' href='#L_CALLS_1843'><pre>1843</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>NumBytes<span class='tooltip-content'>78.7k</span></div> = dyn_cast<Constant>(MI->getLength())) <div class='tooltip'>{<span class='tooltip-content'>73.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1844' href='#L_CALLS_1844'><pre>1844</pre></a></td><td class='covered-line'><pre>73.2k</pre></td><td class='code'><pre> if (NumBytes->isNullValue())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1845' href='#L_CALLS_1845'><pre>1845</pre></a></td><td class='covered-line'><pre>379</pre></td><td class='code'><pre> return eraseInstFromFunction(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1846' href='#L_CALLS_1846'><pre>1846</pre></a></td><td class='covered-line'><pre>73.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1847' href='#L_CALLS_1847'><pre>1847</pre></a></td><td class='covered-line'><pre>72.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>72.8k</span></div><div class='tooltip'>CI<span class='tooltip-content'>72.8k</span></div> = dyn_cast<ConstantInt>(NumBytes))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1848' href='#L_CALLS_1848'><pre>1848</pre></a></td><td class='covered-line'><pre>72.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>72.8k</span></div><div class='tooltip'>CI->getZExtValue() == 1<span class='tooltip-content'>72.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1849' href='#L_CALLS_1849'><pre>1849</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // Replace the instruction with just byte operations. We would</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1850' href='#L_CALLS_1850'><pre>1850</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // transform other cases to loads/stores, but we don't know if</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1851' href='#L_CALLS_1851'><pre>1851</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // alignment is sufficient.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1852' href='#L_CALLS_1852'><pre>1852</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1853' href='#L_CALLS_1853'><pre>1853</pre></a></td><td class='covered-line'><pre>72.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1854' href='#L_CALLS_1854'><pre>1854</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1855' href='#L_CALLS_1855'><pre>1855</pre></a></td><td class='covered-line'><pre>78.7k</pre></td><td class='code'><pre> // No other transformations apply to volatile transfers.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1856' href='#L_CALLS_1856'><pre>1856</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>78.4k</span></div><div class='tooltip'>MI->isVolatile()<span class='tooltip-content'>78.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1857' href='#L_CALLS_1857'><pre>1857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1858' href='#L_CALLS_1858'><pre>1858</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1859' href='#L_CALLS_1859'><pre>1859</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // If we have a memmove and the source operation is a constant global,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1860' href='#L_CALLS_1860'><pre>1860</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // then the source and dest pointers can't alias, so we can change this</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1861' href='#L_CALLS_1861'><pre>1861</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // into a call to memcpy.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1862' href='#L_CALLS_1862'><pre>1862</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (MemMoveInst *<span class='tooltip-content'>78.4k</span></div><div class='tooltip'>MMI<span class='tooltip-content'>78.4k</span></div> = dyn_cast<MemMoveInst>(MI)) <div class='tooltip'>{<span class='tooltip-content'>2.25k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1863' href='#L_CALLS_1863'><pre>1863</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> if (GlobalVariable *GVSrc = dyn_cast<GlobalVariable>(MMI->getSource()))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1864' href='#L_CALLS_1864'><pre>1864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>GVSrc->isConstant()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1865' href='#L_CALLS_1865'><pre>1865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Module *M = CI.getModule();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1866' href='#L_CALLS_1866'><pre>1866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Intrinsic::ID MemCpyID = Intrinsic::memcpy;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1867' href='#L_CALLS_1867'><pre>1867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Tys[3] = { CI.getArgOperand(0)->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1868' href='#L_CALLS_1868'><pre>1868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getArgOperand(1)->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1869' href='#L_CALLS_1869'><pre>1869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getArgOperand(2)->getType() };</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1870' href='#L_CALLS_1870'><pre>1870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.setCalledFunction(Intrinsic::getDeclaration(M, MemCpyID, Tys));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1871' href='#L_CALLS_1871'><pre>1871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Changed = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1872' href='#L_CALLS_1872'><pre>1872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1873' href='#L_CALLS_1873'><pre>1873</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1874' href='#L_CALLS_1874'><pre>1874</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1875' href='#L_CALLS_1875'><pre>1875</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> if (MemTransferInst *<div class='tooltip'>MTI<span class='tooltip-content'>78.4k</span></div> = dyn_cast<MemTransferInst>(MI)) <div class='tooltip'>{<span class='tooltip-content'>34.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1876' href='#L_CALLS_1876'><pre>1876</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> // memmove(x,x,size) -> noop.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1877' href='#L_CALLS_1877'><pre>1877</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> if (MTI->getSource() == MTI->getDest())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1878' href='#L_CALLS_1878'><pre>1878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return eraseInstFromFunction(CI)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1879' href='#L_CALLS_1879'><pre>1879</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1880' href='#L_CALLS_1880'><pre>1880</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1881' href='#L_CALLS_1881'><pre>1881</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // If we can determine a pointer alignment that is bigger than currently</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1882' href='#L_CALLS_1882'><pre>1882</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // set, update the alignment.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1883' href='#L_CALLS_1883'><pre>1883</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>78.4k</span></div><div class='tooltip'>isa<MemTransferInst>(MI)<span class='tooltip-content'>78.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1884' href='#L_CALLS_1884'><pre>1884</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> if (Instruction *I = SimplifyMemTransfer(MI))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1885' href='#L_CALLS_1885'><pre>1885</pre></a></td><td class='covered-line'><pre>374</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1886' href='#L_CALLS_1886'><pre>1886</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (MemSetInst *<span class='tooltip-content'>44.1k</span></div><div class='tooltip'>MSI<span class='tooltip-content'>44.1k</span></div> = dyn_cast<MemSetInst>(MI)) <div class='tooltip'>{<span class='tooltip-content'>44.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1887' href='#L_CALLS_1887'><pre>1887</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> if (Instruction *I = SimplifyMemSet(MSI))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1888' href='#L_CALLS_1888'><pre>1888</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1889' href='#L_CALLS_1889'><pre>1889</pre></a></td><td class='covered-line'><pre>44.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1890' href='#L_CALLS_1890'><pre>1890</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1891' href='#L_CALLS_1891'><pre>1891</pre></a></td><td class='covered-line'><pre>77.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>77.8k</span></div><div class='tooltip'>Changed<span class='tooltip-content'>77.8k</span></div>) <div class='tooltip'><span class='red'>return II</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1892' href='#L_CALLS_1892'><pre>1892</pre></a></td><td class='covered-line'><pre>77.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1893' href='#L_CALLS_1893'><pre>1893</pre></a></td><td class='covered-line'><pre>452k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1894' href='#L_CALLS_1894'><pre>1894</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>451k</span></div><div class='tooltip'>AMI<span class='tooltip-content'>451k</span></div> = dyn_cast<ElementAtomicMemCpyInst>(II)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1895' href='#L_CALLS_1895'><pre>1895</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Constant *</span><span class='red'>C</span><span class='red'> = dyn_cast<Constant>(AMI->getNumElements()))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1896' href='#L_CALLS_1896'><pre>1896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1897' href='#L_CALLS_1897'><pre>1897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(*AMI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1898' href='#L_CALLS_1898'><pre>1898</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1899' href='#L_CALLS_1899'><pre>1899</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Instruction *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyElementAtomicMemCpy(AMI))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1900' href='#L_CALLS_1900'><pre>1900</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return I</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1901' href='#L_CALLS_1901'><pre>1901</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1902' href='#L_CALLS_1902'><pre>1902</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1903' href='#L_CALLS_1903'><pre>1903</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>451k</span></div><div class='tooltip'>I<span class='tooltip-content'>451k</span></div> = SimplifyNVVMIntrinsic(II, *this))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1904' href='#L_CALLS_1904'><pre>1904</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1905' href='#L_CALLS_1905'><pre>1905</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1906' href='#L_CALLS_1906'><pre>1906</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> auto SimplifyDemandedVectorEltsLow = [this](Value *Op, unsigned Width,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1907' href='#L_CALLS_1907'><pre>1907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> unsigned DemandedWidth) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1908' href='#L_CALLS_1908'><pre>1908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt UndefElts(Width, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1909' href='#L_CALLS_1909'><pre>1909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt DemandedElts = APInt::getLowBitsSet(Width, DemandedWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1910' href='#L_CALLS_1910'><pre>1910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SimplifyDemandedVectorElts(Op, DemandedElts, UndefElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1911' href='#L_CALLS_1911'><pre>1911</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1912' href='#L_CALLS_1912'><pre>1912</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1913' href='#L_CALLS_1913'><pre>1913</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> switch (II->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1914' href='#L_CALLS_1914'><pre>1914</pre></a></td><td class='covered-line'><pre>275k</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1915' href='#L_CALLS_1915'><pre>1915</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> case Intrinsic::objectsize:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1916' href='#L_CALLS_1916'><pre>1916</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> if (ConstantInt *N =</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1917' href='#L_CALLS_1917'><pre>1917</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre> lowerObjectSizeCall(II, DL, &TLI, /*MustSucceed=*/false))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1918' href='#L_CALLS_1918'><pre>1918</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, N);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1919' href='#L_CALLS_1919'><pre>1919</pre></a></td><td class='covered-line'><pre>11.9k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1920' href='#L_CALLS_1920'><pre>1920</pre></a></td><td class='covered-line'><pre>12.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1921' href='#L_CALLS_1921'><pre>1921</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> case Intrinsic::bswap: {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1922' href='#L_CALLS_1922'><pre>1922</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> Value *IIOperand = II->getArgOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1923' href='#L_CALLS_1923'><pre>1923</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> Value *X = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1924' href='#L_CALLS_1924'><pre>1924</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1925' href='#L_CALLS_1925'><pre>1925</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // bswap(bswap(x)) -> x</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1926' href='#L_CALLS_1926'><pre>1926</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> if (match(IIOperand, m_BSwap(m_Value(X))))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1927' href='#L_CALLS_1927'><pre>1927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(CI, X)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1928' href='#L_CALLS_1928'><pre>1928</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1929' href='#L_CALLS_1929'><pre>1929</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // bswap(trunc(bswap(x))) -> trunc(lshr(x, c))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1930' href='#L_CALLS_1930'><pre>1930</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.31k</span></div><div class='tooltip'>match(IIOperand, m_Trunc(m_BSwap(m_Value(X))))<span class='tooltip-content'>1.31k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1931' href='#L_CALLS_1931'><pre>1931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned C = X->getType()->getPrimitiveSizeInBits() -</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1932' href='#L_CALLS_1932'><pre>1932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IIOperand->getType()->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1933' href='#L_CALLS_1933'><pre>1933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CV = ConstantInt::get(X->getType(), C);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1934' href='#L_CALLS_1934'><pre>1934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Builder->CreateLShr(X, CV);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1935' href='#L_CALLS_1935'><pre>1935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new TruncInst(V, IIOperand->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1936' href='#L_CALLS_1936'><pre>1936</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1937' href='#L_CALLS_1937'><pre>1937</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1938' href='#L_CALLS_1938'><pre>1938</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1939' href='#L_CALLS_1939'><pre>1939</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1940' href='#L_CALLS_1940'><pre>1940</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::bitreverse: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1941' href='#L_CALLS_1941'><pre>1941</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *IIOperand = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1942' href='#L_CALLS_1942'><pre>1942</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *X = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1943' href='#L_CALLS_1943'><pre>1943</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1944' href='#L_CALLS_1944'><pre>1944</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bitreverse(bitreverse(x)) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1945' href='#L_CALLS_1945'><pre>1945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(IIOperand, m_Intrinsic<Intrinsic::bitreverse>(m_Value(X)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1946' href='#L_CALLS_1946'><pre>1946</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, X)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1947' href='#L_CALLS_1947'><pre>1947</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1948' href='#L_CALLS_1948'><pre>1948</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1949' href='#L_CALLS_1949'><pre>1949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1950' href='#L_CALLS_1950'><pre>1950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::masked_load:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1951' href='#L_CALLS_1951'><pre>1951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>SimplifiedMaskedOp</span><span class='red'> = simplifyMaskedLoad(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1952' href='#L_CALLS_1952'><pre>1952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, SimplifiedMaskedOp)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1953' href='#L_CALLS_1953'><pre>1953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1954' href='#L_CALLS_1954'><pre>1954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::masked_store:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1955' href='#L_CALLS_1955'><pre>1955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return simplifyMaskedStore(*II, *this)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1956' href='#L_CALLS_1956'><pre>1956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::masked_gather:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1957' href='#L_CALLS_1957'><pre>1957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return simplifyMaskedGather(*II, *this)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1958' href='#L_CALLS_1958'><pre>1958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::masked_scatter:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1959' href='#L_CALLS_1959'><pre>1959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return simplifyMaskedScatter(*II, *this)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1960' href='#L_CALLS_1960'><pre>1960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1961' href='#L_CALLS_1961'><pre>1961</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::powi:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1962' href='#L_CALLS_1962'><pre>1962</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>Power</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(II->getArgOperand(1))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1963' href='#L_CALLS_1963'><pre>1963</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // powi(x, 0) -> 1.0</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1964' href='#L_CALLS_1964'><pre>1964</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Power->isZero()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1965' href='#L_CALLS_1965'><pre>1965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, ConstantFP::get(CI.getType(), 1.0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1966' href='#L_CALLS_1966'><pre>1966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // powi(x, 1) -> x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1967' href='#L_CALLS_1967'><pre>1967</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Power->isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1968' href='#L_CALLS_1968'><pre>1968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, II->getArgOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1969' href='#L_CALLS_1969'><pre>1969</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // powi(x, -1) -> 1/x</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1970' href='#L_CALLS_1970'><pre>1970</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Power->isAllOnesValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1971' href='#L_CALLS_1971'><pre>1971</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateFDiv(ConstantFP::get(CI.getType(), 1.0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1972' href='#L_CALLS_1972'><pre>1972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getArgOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1973' href='#L_CALLS_1973'><pre>1973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1974' href='#L_CALLS_1974'><pre>1974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1975' href='#L_CALLS_1975'><pre>1975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1976' href='#L_CALLS_1976'><pre>1976</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre><span class='red'> </span>case Intrinsic::cttz:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1977' href='#L_CALLS_1977'><pre>1977</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> case Intrinsic::ctlz:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1978' href='#L_CALLS_1978'><pre>1978</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> if (auto *I = foldCttzCtlz(*II, *this))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1979' href='#L_CALLS_1979'><pre>1979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1980' href='#L_CALLS_1980'><pre>1980</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1981' href='#L_CALLS_1981'><pre>1981</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1982' href='#L_CALLS_1982'><pre>1982</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::uadd_with_overflow:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1983' href='#L_CALLS_1983'><pre>1983</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::sadd_with_overflow:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1984' href='#L_CALLS_1984'><pre>1984</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::umul_with_overflow:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1985' href='#L_CALLS_1985'><pre>1985</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::smul_with_overflow:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1986' href='#L_CALLS_1986'><pre>1986</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> if (isa<Constant>(II->getArgOperand(0)) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1987' href='#L_CALLS_1987'><pre>1987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>!isa<Constant>(II->getArgOperand(1))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1988' href='#L_CALLS_1988'><pre>1988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize constants into the RHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1989' href='#L_CALLS_1989'><pre>1989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LHS = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1990' href='#L_CALLS_1990'><pre>1990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, II->getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1991' href='#L_CALLS_1991'><pre>1991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, LHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1992' href='#L_CALLS_1992'><pre>1992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1993' href='#L_CALLS_1993'><pre>1993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1994' href='#L_CALLS_1994'><pre>1994</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>911</span></div><div class='tooltip'>;<span class='tooltip-content'>911</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1995' href='#L_CALLS_1995'><pre>1995</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1996' href='#L_CALLS_1996'><pre>1996</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::usub_with_overflow:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1997' href='#L_CALLS_1997'><pre>1997</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> case Intrinsic::ssub_with_overflow: {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1998' href='#L_CALLS_1998'><pre>1998</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> OverflowCheckFlavor OCF =</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_1999' href='#L_CALLS_1999'><pre>1999</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> IntrinsicIDToOverflowCheckFlavor(II->getIntrinsicID());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2000' href='#L_CALLS_2000'><pre>2000</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> assert(OCF != OCF_INVALID && "unexpected!");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2001' href='#L_CALLS_2001'><pre>2001</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2002' href='#L_CALLS_2002'><pre>2002</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> Value *OperationResult = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2003' href='#L_CALLS_2003'><pre>2003</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> Constant *OverflowResult = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2004' href='#L_CALLS_2004'><pre>2004</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> if (OptimizeOverflowCheck(OCF, II->getArgOperand(0), II->getArgOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2005' href='#L_CALLS_2005'><pre>2005</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> *II, OperationResult, OverflowResult))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2006' href='#L_CALLS_2006'><pre>2006</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return CreateOverflowTuple(II, OperationResult, OverflowResult);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2007' href='#L_CALLS_2007'><pre>2007</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2008' href='#L_CALLS_2008'><pre>2008</pre></a></td><td class='covered-line'><pre>898</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2009' href='#L_CALLS_2009'><pre>2009</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2010' href='#L_CALLS_2010'><pre>2010</pre></a></td><td class='covered-line'><pre>911</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2011' href='#L_CALLS_2011'><pre>2011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::minnum:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2012' href='#L_CALLS_2012'><pre>2012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::maxnum: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2013' href='#L_CALLS_2013'><pre>2013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2014' href='#L_CALLS_2014'><pre>2014</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2015' href='#L_CALLS_2015'><pre>2015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize constants to the RHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2016' href='#L_CALLS_2016'><pre>2016</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<ConstantFP>(Arg0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<ConstantFP>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2017' href='#L_CALLS_2017'><pre>2017</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2018' href='#L_CALLS_2018'><pre>2018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, Arg0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2019' href='#L_CALLS_2019'><pre>2019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2020' href='#L_CALLS_2020'><pre>2020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2021' href='#L_CALLS_2021'><pre>2021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = simplifyMinnumMaxnum(*II))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2022' href='#L_CALLS_2022'><pre>2022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2023' href='#L_CALLS_2023'><pre>2023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2024' href='#L_CALLS_2024'><pre>2024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2025' href='#L_CALLS_2025'><pre>2025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::fmuladd: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2026' href='#L_CALLS_2026'><pre>2026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize fast fmuladd to the separate fmul + fadd.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2027' href='#L_CALLS_2027'><pre>2027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>II->hasUnsafeAlgebra()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2028' href='#L_CALLS_2028'><pre>2028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BuilderTy::FastMathFlagGuard Guard(*Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2029' href='#L_CALLS_2029'><pre>2029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->setFastMathFlags(II->getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2030' href='#L_CALLS_2030'><pre>2030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Mul = Builder->CreateFMul(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2031' href='#L_CALLS_2031'><pre>2031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2032' href='#L_CALLS_2032'><pre>2032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Add = Builder->CreateFAdd(Mul, II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2033' href='#L_CALLS_2033'><pre>2033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Add->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2034' href='#L_CALLS_2034'><pre>2034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, Add);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2035' href='#L_CALLS_2035'><pre>2035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2036' href='#L_CALLS_2036'><pre>2036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2037' href='#L_CALLS_2037'><pre>2037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>LLVM_FALLTHROUGH</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>;</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2038' href='#L_CALLS_2038'><pre>2038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2039' href='#L_CALLS_2039'><pre>2039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::fma: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2040' href='#L_CALLS_2040'><pre>2040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2041' href='#L_CALLS_2041'><pre>2041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2042' href='#L_CALLS_2042'><pre>2042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2043' href='#L_CALLS_2043'><pre>2043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize constants into the RHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2044' href='#L_CALLS_2044'><pre>2044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<Constant>(Src0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Src1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2045' href='#L_CALLS_2045'><pre>2045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2046' href='#L_CALLS_2046'><pre>2046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2047' href='#L_CALLS_2047'><pre>2047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Src0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2048' href='#L_CALLS_2048'><pre>2048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2049' href='#L_CALLS_2049'><pre>2049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2050' href='#L_CALLS_2050'><pre>2050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LHS = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2051' href='#L_CALLS_2051'><pre>2051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RHS = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2052' href='#L_CALLS_2052'><pre>2052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2053' href='#L_CALLS_2053'><pre>2053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fma fneg(x), fneg(y), z -> fma x, y, z</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2054' href='#L_CALLS_2054'><pre>2054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(Src0, m_FNeg(m_Value(LHS))) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2055' href='#L_CALLS_2055'><pre>2055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>match(Src1, m_FNeg(m_Value(RHS)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2056' href='#L_CALLS_2056'><pre>2056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, LHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2057' href='#L_CALLS_2057'><pre>2057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2058' href='#L_CALLS_2058'><pre>2058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2059' href='#L_CALLS_2059'><pre>2059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2060' href='#L_CALLS_2060'><pre>2060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2061' href='#L_CALLS_2061'><pre>2061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fma fabs(x), fabs(x), z -> fma x, x, z</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2062' href='#L_CALLS_2062'><pre>2062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Src0, m_Intrinsic<Intrinsic::fabs>(m_Value(LHS))) &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2063' href='#L_CALLS_2063'><pre>2063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>match(Src1, m_Intrinsic<Intrinsic::fabs>(m_Value(RHS)))</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>LHS == RHS</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2064' href='#L_CALLS_2064'><pre>2064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, LHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2065' href='#L_CALLS_2065'><pre>2065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2066' href='#L_CALLS_2066'><pre>2066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2067' href='#L_CALLS_2067'><pre>2067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2068' href='#L_CALLS_2068'><pre>2068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2069' href='#L_CALLS_2069'><pre>2069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fma x, 1, z -> fadd x, z</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2070' href='#L_CALLS_2070'><pre>2070</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Src1, m_FPOne())</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2071' href='#L_CALLS_2071'><pre>2071</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *RI = BinaryOperator::CreateFAdd(Src0, II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2072' href='#L_CALLS_2072'><pre>2072</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RI->copyFastMathFlags(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2073' href='#L_CALLS_2073'><pre>2073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RI;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2074' href='#L_CALLS_2074'><pre>2074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2075' href='#L_CALLS_2075'><pre>2075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2076' href='#L_CALLS_2076'><pre>2076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2077' href='#L_CALLS_2077'><pre>2077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2078' href='#L_CALLS_2078'><pre>2078</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre><span class='red'> </span>case Intrinsic::fabs: {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2079' href='#L_CALLS_2079'><pre>2079</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> Value *Cond;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2080' href='#L_CALLS_2080'><pre>2080</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> Constant *LHS, *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2081' href='#L_CALLS_2081'><pre>2081</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> if (match(II->getArgOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2082' href='#L_CALLS_2082'><pre>2082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> m_Select(m_Value(Cond), m_Constant(LHS), m_Constant(RHS)))) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2083' href='#L_CALLS_2083'><pre>2083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *Call0 = Builder->CreateCall(II->getCalledFunction(), {LHS});</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2084' href='#L_CALLS_2084'><pre>2084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *Call1 = Builder->CreateCall(II->getCalledFunction(), {RHS});</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2085' href='#L_CALLS_2085'><pre>2085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(Cond, Call0, Call1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2086' href='#L_CALLS_2086'><pre>2086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2087' href='#L_CALLS_2087'><pre>2087</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2088' href='#L_CALLS_2088'><pre>2088</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>5.54k</span></div><div class='tooltip'>;<span class='tooltip-content'>5.54k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2089' href='#L_CALLS_2089'><pre>2089</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2090' href='#L_CALLS_2090'><pre>2090</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> case Intrinsic::ceil:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2091' href='#L_CALLS_2091'><pre>2091</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> case Intrinsic::floor:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2092' href='#L_CALLS_2092'><pre>2092</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> case Intrinsic::round:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2093' href='#L_CALLS_2093'><pre>2093</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> case Intrinsic::nearbyint:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2094' href='#L_CALLS_2094'><pre>2094</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> case Intrinsic::trunc: {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2095' href='#L_CALLS_2095'><pre>2095</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> Value *ExtSrc;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2096' href='#L_CALLS_2096'><pre>2096</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> if (match(II->getArgOperand(0), m_FPExt(m_Value(ExtSrc))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2097' href='#L_CALLS_2097'><pre>2097</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>II->getArgOperand(0)->hasOneUse()<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2098' href='#L_CALLS_2098'><pre>2098</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // fabs (fpext x) -> fpext (fabs x)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2099' href='#L_CALLS_2099'><pre>2099</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *F = Intrinsic::getDeclaration(II->getModule(), II->getIntrinsicID(),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2100' href='#L_CALLS_2100'><pre>2100</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> { ExtSrc->getType() });</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2101' href='#L_CALLS_2101'><pre>2101</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> CallInst *NewFabs = Builder->CreateCall(F, ExtSrc);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2102' href='#L_CALLS_2102'><pre>2102</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> NewFabs->copyFastMathFlags(II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2103' href='#L_CALLS_2103'><pre>2103</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> NewFabs->takeName(II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2104' href='#L_CALLS_2104'><pre>2104</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return new FPExtInst(NewFabs, II->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2105' href='#L_CALLS_2105'><pre>2105</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2106' href='#L_CALLS_2106'><pre>2106</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2107' href='#L_CALLS_2107'><pre>2107</pre></a></td><td class='covered-line'><pre>5.91k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2108' href='#L_CALLS_2108'><pre>2108</pre></a></td><td class='covered-line'><pre>5.92k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2109' href='#L_CALLS_2109'><pre>2109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::cos:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2110' href='#L_CALLS_2110'><pre>2110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_cos: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2111' href='#L_CALLS_2111'><pre>2111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SrcSrc;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2112' href='#L_CALLS_2112'><pre>2112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2113' href='#L_CALLS_2113'><pre>2113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(Src, m_FNeg(m_Value(SrcSrc))) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2114' href='#L_CALLS_2114'><pre>2114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>match(Src, m_Intrinsic<Intrinsic::fabs>(m_Value(SrcSrc)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2115' href='#L_CALLS_2115'><pre>2115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cos(-x) -> cos(x)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2116' href='#L_CALLS_2116'><pre>2116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cos(fabs(x)) -> cos(x)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2117' href='#L_CALLS_2117'><pre>2117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, SrcSrc);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2118' href='#L_CALLS_2118'><pre>2118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2119' href='#L_CALLS_2119'><pre>2119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2120' href='#L_CALLS_2120'><pre>2120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2121' href='#L_CALLS_2121'><pre>2121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2122' href='#L_CALLS_2122'><pre>2122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2123' href='#L_CALLS_2123'><pre>2123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_altivec_lvx:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2124' href='#L_CALLS_2124'><pre>2124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_altivec_lvxl:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2125' href='#L_CALLS_2125'><pre>2125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC lvx -> load if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2126' href='#L_CALLS_2126'><pre>2126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2127' href='#L_CALLS_2127'><pre>2127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 16</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2128' href='#L_CALLS_2128'><pre>2128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2129' href='#L_CALLS_2129'><pre>2129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2130' href='#L_CALLS_2130'><pre>2130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new LoadInst(Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2131' href='#L_CALLS_2131'><pre>2131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2132' href='#L_CALLS_2132'><pre>2132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2133' href='#L_CALLS_2133'><pre>2133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_vsx_lxvw4x:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2134' href='#L_CALLS_2134'><pre>2134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_vsx_lxvd2x: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2135' href='#L_CALLS_2135'><pre>2135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC VSX loads into normal loads.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2136' href='#L_CALLS_2136'><pre>2136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2137' href='#L_CALLS_2137'><pre>2137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2138' href='#L_CALLS_2138'><pre>2138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new LoadInst(Ptr, Twine(""), false, 1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2139' href='#L_CALLS_2139'><pre>2139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2140' href='#L_CALLS_2140'><pre>2140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_altivec_stvx:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2141' href='#L_CALLS_2141'><pre>2141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_altivec_stvxl:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2142' href='#L_CALLS_2142'><pre>2142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn stvx -> store if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2143' href='#L_CALLS_2143'><pre>2143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2144' href='#L_CALLS_2144'><pre>2144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 16</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2145' href='#L_CALLS_2145'><pre>2145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *OpPtrTy =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2146' href='#L_CALLS_2146'><pre>2146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(II->getArgOperand(0)->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2147' href='#L_CALLS_2147'><pre>2147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(1), OpPtrTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2148' href='#L_CALLS_2148'><pre>2148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new StoreInst(II->getArgOperand(0), Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2149' href='#L_CALLS_2149'><pre>2149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2150' href='#L_CALLS_2150'><pre>2150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2151' href='#L_CALLS_2151'><pre>2151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_vsx_stxvw4x:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2152' href='#L_CALLS_2152'><pre>2152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_vsx_stxvd2x: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2153' href='#L_CALLS_2153'><pre>2153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC VSX stores into normal stores.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2154' href='#L_CALLS_2154'><pre>2154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *OpPtrTy = PointerType::getUnqual(II->getArgOperand(0)->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2155' href='#L_CALLS_2155'><pre>2155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(1), OpPtrTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2156' href='#L_CALLS_2156'><pre>2156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new StoreInst(II->getArgOperand(0), Ptr, false, 1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2157' href='#L_CALLS_2157'><pre>2157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2158' href='#L_CALLS_2158'><pre>2158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_qpx_qvlfs:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2159' href='#L_CALLS_2159'><pre>2159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC QPX qvlfs -> load if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2160' href='#L_CALLS_2160'><pre>2160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2161' href='#L_CALLS_2161'><pre>2161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 16</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2162' href='#L_CALLS_2162'><pre>2162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *VTy = VectorType::get(Builder->getFloatTy(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2163' href='#L_CALLS_2163'><pre>2163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getType()->getVectorNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2164' href='#L_CALLS_2164'><pre>2164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2165' href='#L_CALLS_2165'><pre>2165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(VTy));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2166' href='#L_CALLS_2166'><pre>2166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Load = Builder->CreateLoad(Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2167' href='#L_CALLS_2167'><pre>2167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new FPExtInst(Load, II->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2168' href='#L_CALLS_2168'><pre>2168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2169' href='#L_CALLS_2169'><pre>2169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2170' href='#L_CALLS_2170'><pre>2170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_qpx_qvlfd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2171' href='#L_CALLS_2171'><pre>2171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC QPX qvlfd -> load if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2172' href='#L_CALLS_2172'><pre>2172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(0), 32, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2173' href='#L_CALLS_2173'><pre>2173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 32</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2174' href='#L_CALLS_2174'><pre>2174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2175' href='#L_CALLS_2175'><pre>2175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2176' href='#L_CALLS_2176'><pre>2176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new LoadInst(Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2177' href='#L_CALLS_2177'><pre>2177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2178' href='#L_CALLS_2178'><pre>2178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2179' href='#L_CALLS_2179'><pre>2179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_qpx_qvstfs:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2180' href='#L_CALLS_2180'><pre>2180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC QPX qvstfs -> store if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2181' href='#L_CALLS_2181'><pre>2181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2182' href='#L_CALLS_2182'><pre>2182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 16</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2183' href='#L_CALLS_2183'><pre>2183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *VTy = VectorType::get(Builder->getFloatTy(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2184' href='#L_CALLS_2184'><pre>2184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getArgOperand(0)->getType()->getVectorNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2185' href='#L_CALLS_2185'><pre>2185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *TOp = Builder->CreateFPTrunc(II->getArgOperand(0), VTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2186' href='#L_CALLS_2186'><pre>2186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *OpPtrTy = PointerType::getUnqual(VTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2187' href='#L_CALLS_2187'><pre>2187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(1), OpPtrTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2188' href='#L_CALLS_2188'><pre>2188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new StoreInst(TOp, Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2189' href='#L_CALLS_2189'><pre>2189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2190' href='#L_CALLS_2190'><pre>2190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2191' href='#L_CALLS_2191'><pre>2191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_qpx_qvstfd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2192' href='#L_CALLS_2192'><pre>2192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn PPC QPX qvstfd -> store if the pointer is known aligned.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2193' href='#L_CALLS_2193'><pre>2193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getOrEnforceKnownAlignment(II->getArgOperand(1), 32, DL, II, &AC,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2194' href='#L_CALLS_2194'><pre>2194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &DT) >= 32</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2195' href='#L_CALLS_2195'><pre>2195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *OpPtrTy =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2196' href='#L_CALLS_2196'><pre>2196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(II->getArgOperand(0)->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2197' href='#L_CALLS_2197'><pre>2197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ptr = Builder->CreateBitCast(II->getArgOperand(1), OpPtrTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2198' href='#L_CALLS_2198'><pre>2198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new StoreInst(II->getArgOperand(0), Ptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2199' href='#L_CALLS_2199'><pre>2199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2200' href='#L_CALLS_2200'><pre>2200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2201' href='#L_CALLS_2201'><pre>2201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2202' href='#L_CALLS_2202'><pre>2202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_vcvtph2ps_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2203' href='#L_CALLS_2203'><pre>2203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_vcvtph2ps_256: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2204' href='#L_CALLS_2204'><pre>2204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Arg = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2205' href='#L_CALLS_2205'><pre>2205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto ArgType = cast<VectorType>(Arg->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2206' href='#L_CALLS_2206'><pre>2206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto RetType = cast<VectorType>(II->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2207' href='#L_CALLS_2207'><pre>2207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ArgWidth = ArgType->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2208' href='#L_CALLS_2208'><pre>2208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned RetWidth = RetType->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2209' href='#L_CALLS_2209'><pre>2209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(RetWidth <= ArgWidth && "Unexpected input/return vector widths");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2210' href='#L_CALLS_2210'><pre>2210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(ArgType->isIntOrIntVectorTy() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2211' href='#L_CALLS_2211'><pre>2211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ArgType->getScalarSizeInBits() == 16 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2212' href='#L_CALLS_2212'><pre>2212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "CVTPH2PS input type should be 16-bit integer vector");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2213' href='#L_CALLS_2213'><pre>2213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(RetType->getScalarType()->isFloatTy() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2214' href='#L_CALLS_2214'><pre>2214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "CVTPH2PS output type should be 32-bit float vector");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2215' href='#L_CALLS_2215'><pre>2215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2216' href='#L_CALLS_2216'><pre>2216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant folding: Convert to generic half to single conversion.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2217' href='#L_CALLS_2217'><pre>2217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<ConstantAggregateZero>(Arg)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2218' href='#L_CALLS_2218'><pre>2218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantAggregateZero::get(RetType))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2219' href='#L_CALLS_2219'><pre>2219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2220' href='#L_CALLS_2220'><pre>2220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ConstantDataVector>(Arg)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2221' href='#L_CALLS_2221'><pre>2221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VectorHalfAsShorts = Arg;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2222' href='#L_CALLS_2222'><pre>2222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>RetWidth < ArgWidth</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2223' href='#L_CALLS_2223'><pre>2223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<uint32_t, 8> SubVecMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2224' href='#L_CALLS_2224'><pre>2224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != RetWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2225' href='#L_CALLS_2225'><pre>2225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SubVecMask.push_back((int)i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2226' href='#L_CALLS_2226'><pre>2226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorHalfAsShorts = Builder->CreateShuffleVector(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2227' href='#L_CALLS_2227'><pre>2227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Arg, UndefValue::get(ArgType), SubVecMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2228' href='#L_CALLS_2228'><pre>2228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2229' href='#L_CALLS_2229'><pre>2229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2230' href='#L_CALLS_2230'><pre>2230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VectorHalfType =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2231' href='#L_CALLS_2231'><pre>2231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType::get(Type::getHalfTy(II->getContext()), RetWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2232' href='#L_CALLS_2232'><pre>2232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VectorHalfs =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2233' href='#L_CALLS_2233'><pre>2233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateBitCast(VectorHalfAsShorts, VectorHalfType);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2234' href='#L_CALLS_2234'><pre>2234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto VectorFloats = Builder->CreateFPExt(VectorHalfs, RetType);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2235' href='#L_CALLS_2235'><pre>2235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, VectorFloats);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2236' href='#L_CALLS_2236'><pre>2236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2237' href='#L_CALLS_2237'><pre>2237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2238' href='#L_CALLS_2238'><pre>2238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We only use the lowest lanes of the argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2239' href='#L_CALLS_2239'><pre>2239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Arg, ArgWidth, RetWidth)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2240' href='#L_CALLS_2240'><pre>2240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2241' href='#L_CALLS_2241'><pre>2241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2242' href='#L_CALLS_2242'><pre>2242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2243' href='#L_CALLS_2243'><pre>2243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2244' href='#L_CALLS_2244'><pre>2244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2245' href='#L_CALLS_2245'><pre>2245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2246' href='#L_CALLS_2246'><pre>2246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cvtss2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2247' href='#L_CALLS_2247'><pre>2247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cvtss2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2248' href='#L_CALLS_2248'><pre>2248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cvttss2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2249' href='#L_CALLS_2249'><pre>2249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cvttss2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2250' href='#L_CALLS_2250'><pre>2250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cvtsd2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2251' href='#L_CALLS_2251'><pre>2251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cvtsd2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2252' href='#L_CALLS_2252'><pre>2252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cvttsd2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2253' href='#L_CALLS_2253'><pre>2253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cvttsd2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2254' href='#L_CALLS_2254'><pre>2254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtss2si32:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2255' href='#L_CALLS_2255'><pre>2255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtss2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2256' href='#L_CALLS_2256'><pre>2256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtss2usi32:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2257' href='#L_CALLS_2257'><pre>2257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtss2usi64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2258' href='#L_CALLS_2258'><pre>2258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtsd2si32:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2259' href='#L_CALLS_2259'><pre>2259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtsd2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2260' href='#L_CALLS_2260'><pre>2260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtsd2usi32:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2261' href='#L_CALLS_2261'><pre>2261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcvtsd2usi64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2262' href='#L_CALLS_2262'><pre>2262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttss2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2263' href='#L_CALLS_2263'><pre>2263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttss2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2264' href='#L_CALLS_2264'><pre>2264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttss2usi:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2265' href='#L_CALLS_2265'><pre>2265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttss2usi64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2266' href='#L_CALLS_2266'><pre>2266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttsd2si:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2267' href='#L_CALLS_2267'><pre>2267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttsd2si64:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2268' href='#L_CALLS_2268'><pre>2268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttsd2usi:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2269' href='#L_CALLS_2269'><pre>2269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_cvttsd2usi64: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2270' href='#L_CALLS_2270'><pre>2270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These intrinsics only demand the 0th element of their input vectors. If</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2271' href='#L_CALLS_2271'><pre>2271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // we can simplify the input based on that, do so now.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2272' href='#L_CALLS_2272'><pre>2272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2273' href='#L_CALLS_2273'><pre>2273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Arg->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2274' href='#L_CALLS_2274'><pre>2274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Arg, VWidth, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2275' href='#L_CALLS_2275'><pre>2275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2276' href='#L_CALLS_2276'><pre>2276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2277' href='#L_CALLS_2277'><pre>2277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2278' href='#L_CALLS_2278'><pre>2278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2279' href='#L_CALLS_2279'><pre>2279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2280' href='#L_CALLS_2280'><pre>2280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2281' href='#L_CALLS_2281'><pre>2281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_mmx_pmovmskb:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2282' href='#L_CALLS_2282'><pre>2282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_movmsk_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2283' href='#L_CALLS_2283'><pre>2283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_movmsk_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2284' href='#L_CALLS_2284'><pre>2284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pmovmskb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2285' href='#L_CALLS_2285'><pre>2285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_movmsk_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2286' href='#L_CALLS_2286'><pre>2286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_movmsk_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2287' href='#L_CALLS_2287'><pre>2287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmovmskb: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2288' href='#L_CALLS_2288'><pre>2288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86movmsk(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2289' href='#L_CALLS_2289'><pre>2289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2290' href='#L_CALLS_2290'><pre>2290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2291' href='#L_CALLS_2291'><pre>2291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2292' href='#L_CALLS_2292'><pre>2292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2293' href='#L_CALLS_2293'><pre>2293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comieq_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2294' href='#L_CALLS_2294'><pre>2294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comige_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2295' href='#L_CALLS_2295'><pre>2295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comigt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2296' href='#L_CALLS_2296'><pre>2296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comile_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2297' href='#L_CALLS_2297'><pre>2297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comilt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2298' href='#L_CALLS_2298'><pre>2298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_comineq_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2299' href='#L_CALLS_2299'><pre>2299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomieq_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2300' href='#L_CALLS_2300'><pre>2300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomige_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2301' href='#L_CALLS_2301'><pre>2301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomigt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2302' href='#L_CALLS_2302'><pre>2302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomile_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2303' href='#L_CALLS_2303'><pre>2303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomilt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2304' href='#L_CALLS_2304'><pre>2304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_ucomineq_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2305' href='#L_CALLS_2305'><pre>2305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comieq_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2306' href='#L_CALLS_2306'><pre>2306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comige_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2307' href='#L_CALLS_2307'><pre>2307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comigt_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2308' href='#L_CALLS_2308'><pre>2308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comile_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2309' href='#L_CALLS_2309'><pre>2309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comilt_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2310' href='#L_CALLS_2310'><pre>2310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_comineq_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2311' href='#L_CALLS_2311'><pre>2311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomieq_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2312' href='#L_CALLS_2312'><pre>2312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomige_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2313' href='#L_CALLS_2313'><pre>2313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomigt_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2314' href='#L_CALLS_2314'><pre>2314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomile_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2315' href='#L_CALLS_2315'><pre>2315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomilt_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2316' href='#L_CALLS_2316'><pre>2316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_ucomineq_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2317' href='#L_CALLS_2317'><pre>2317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcomi_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2318' href='#L_CALLS_2318'><pre>2318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vcomi_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2319' href='#L_CALLS_2319'><pre>2319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_cmp_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2320' href='#L_CALLS_2320'><pre>2320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_cmp_sd: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2321' href='#L_CALLS_2321'><pre>2321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These intrinsics only demand the 0th element of their input vectors. If</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2322' href='#L_CALLS_2322'><pre>2322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // we can simplify the input based on that, do so now.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2323' href='#L_CALLS_2323'><pre>2323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool MadeChange = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2324' href='#L_CALLS_2324'><pre>2324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2325' href='#L_CALLS_2325'><pre>2325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2326' href='#L_CALLS_2326'><pre>2326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Arg0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2327' href='#L_CALLS_2327'><pre>2327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Arg0, VWidth, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2328' href='#L_CALLS_2328'><pre>2328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2329' href='#L_CALLS_2329'><pre>2329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2330' href='#L_CALLS_2330'><pre>2330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2331' href='#L_CALLS_2331'><pre>2331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Arg1, VWidth, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2332' href='#L_CALLS_2332'><pre>2332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2333' href='#L_CALLS_2333'><pre>2333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2334' href='#L_CALLS_2334'><pre>2334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2335' href='#L_CALLS_2335'><pre>2335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MadeChange</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2336' href='#L_CALLS_2336'><pre>2336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2337' href='#L_CALLS_2337'><pre>2337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2338' href='#L_CALLS_2338'><pre>2338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2339' href='#L_CALLS_2339'><pre>2339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2340' href='#L_CALLS_2340'><pre>2340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2341' href='#L_CALLS_2341'><pre>2341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2342' href='#L_CALLS_2342'><pre>2342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2343' href='#L_CALLS_2343'><pre>2343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2344' href='#L_CALLS_2344'><pre>2344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2345' href='#L_CALLS_2345'><pre>2345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2346' href='#L_CALLS_2346'><pre>2346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2347' href='#L_CALLS_2347'><pre>2347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2348' href='#L_CALLS_2348'><pre>2348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the rounding mode is CUR_DIRECTION(4) we can turn these into regular</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2349' href='#L_CALLS_2349'><pre>2349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // IR operations.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2350' href='#L_CALLS_2350'><pre>2350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>R</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(II->getArgOperand(4))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2351' href='#L_CALLS_2351'><pre>2351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>R->getValue() == 4</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2352' href='#L_CALLS_2352'><pre>2352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2353' href='#L_CALLS_2353'><pre>2353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2354' href='#L_CALLS_2354'><pre>2354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2355' href='#L_CALLS_2355'><pre>2355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2356' href='#L_CALLS_2356'><pre>2356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (II->getIntrinsicID()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2357' href='#L_CALLS_2357'><pre>2357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Case stmts out of sync!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2358' href='#L_CALLS_2358'><pre>2358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2359' href='#L_CALLS_2359'><pre>2359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2360' href='#L_CALLS_2360'><pre>2360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFAdd(Arg0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2361' href='#L_CALLS_2361'><pre>2361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2362' href='#L_CALLS_2362'><pre>2362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2363' href='#L_CALLS_2363'><pre>2363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2364' href='#L_CALLS_2364'><pre>2364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFSub(Arg0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2365' href='#L_CALLS_2365'><pre>2365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2366' href='#L_CALLS_2366'><pre>2366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2367' href='#L_CALLS_2367'><pre>2367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2368' href='#L_CALLS_2368'><pre>2368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFMul(Arg0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2369' href='#L_CALLS_2369'><pre>2369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2370' href='#L_CALLS_2370'><pre>2370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2371' href='#L_CALLS_2371'><pre>2371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2372' href='#L_CALLS_2372'><pre>2372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFDiv(Arg0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2373' href='#L_CALLS_2373'><pre>2373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2374' href='#L_CALLS_2374'><pre>2374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2375' href='#L_CALLS_2375'><pre>2375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2376' href='#L_CALLS_2376'><pre>2376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Create a select for the masking.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2377' href='#L_CALLS_2377'><pre>2377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>V = emitX86MaskSelect(II->getArgOperand(3), V, II->getArgOperand(2),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2378' href='#L_CALLS_2378'><pre>2378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2379' href='#L_CALLS_2379'><pre>2379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2380' href='#L_CALLS_2380'><pre>2380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2381' href='#L_CALLS_2381'><pre>2381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2382' href='#L_CALLS_2382'><pre>2382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2383' href='#L_CALLS_2383'><pre>2383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2384' href='#L_CALLS_2384'><pre>2384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2385' href='#L_CALLS_2385'><pre>2385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2386' href='#L_CALLS_2386'><pre>2386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2387' href='#L_CALLS_2387'><pre>2387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2388' href='#L_CALLS_2388'><pre>2388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2389' href='#L_CALLS_2389'><pre>2389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2390' href='#L_CALLS_2390'><pre>2390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2391' href='#L_CALLS_2391'><pre>2391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2392' href='#L_CALLS_2392'><pre>2392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the rounding mode is CUR_DIRECTION(4) we can turn these into regular</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2393' href='#L_CALLS_2393'><pre>2393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // IR operations.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2394' href='#L_CALLS_2394'><pre>2394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>R</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(II->getArgOperand(4))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2395' href='#L_CALLS_2395'><pre>2395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>R->getValue() == 4</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2396' href='#L_CALLS_2396'><pre>2396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Extract the element as scalars.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2397' href='#L_CALLS_2397'><pre>2397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2398' href='#L_CALLS_2398'><pre>2398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2399' href='#L_CALLS_2399'><pre>2399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LHS = Builder->CreateExtractElement(Arg0, (uint64_t)0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2400' href='#L_CALLS_2400'><pre>2400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RHS = Builder->CreateExtractElement(Arg1, (uint64_t)0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2401' href='#L_CALLS_2401'><pre>2401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2402' href='#L_CALLS_2402'><pre>2402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2403' href='#L_CALLS_2403'><pre>2403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (II->getIntrinsicID()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2404' href='#L_CALLS_2404'><pre>2404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Case stmts out of sync!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2405' href='#L_CALLS_2405'><pre>2405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2406' href='#L_CALLS_2406'><pre>2406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2407' href='#L_CALLS_2407'><pre>2407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFAdd(LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2408' href='#L_CALLS_2408'><pre>2408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2409' href='#L_CALLS_2409'><pre>2409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2410' href='#L_CALLS_2410'><pre>2410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2411' href='#L_CALLS_2411'><pre>2411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFSub(LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2412' href='#L_CALLS_2412'><pre>2412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2413' href='#L_CALLS_2413'><pre>2413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2414' href='#L_CALLS_2414'><pre>2414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2415' href='#L_CALLS_2415'><pre>2415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFMul(LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2416' href='#L_CALLS_2416'><pre>2416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2417' href='#L_CALLS_2417'><pre>2417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2418' href='#L_CALLS_2418'><pre>2418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2419' href='#L_CALLS_2419'><pre>2419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateFDiv(LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2420' href='#L_CALLS_2420'><pre>2420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2421' href='#L_CALLS_2421'><pre>2421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2422' href='#L_CALLS_2422'><pre>2422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2423' href='#L_CALLS_2423'><pre>2423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle the masking aspect of the intrinsic.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2424' href='#L_CALLS_2424'><pre>2424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Mask = II->getArgOperand(3);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2425' href='#L_CALLS_2425'><pre>2425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *C = dyn_cast<ConstantInt>(Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2426' href='#L_CALLS_2426'><pre>2426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We don't need a select if we know the mask bit is a 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2427' href='#L_CALLS_2427'><pre>2427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!C || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!C->getValue()[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2428' href='#L_CALLS_2428'><pre>2428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Cast the mask to an i1 vector and then extract the lowest element.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2429' href='#L_CALLS_2429'><pre>2429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *MaskTy = VectorType::get(Builder->getInt1Ty(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2430' href='#L_CALLS_2430'><pre>2430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<IntegerType>(Mask->getType())->getBitWidth());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2431' href='#L_CALLS_2431'><pre>2431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask = Builder->CreateBitCast(Mask, MaskTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2432' href='#L_CALLS_2432'><pre>2432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask = Builder->CreateExtractElement(Mask, (uint64_t)0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2433' href='#L_CALLS_2433'><pre>2433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Extract the lowest element from the passthru operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2434' href='#L_CALLS_2434'><pre>2434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Passthru = Builder->CreateExtractElement(II->getArgOperand(2),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2435' href='#L_CALLS_2435'><pre>2435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> (uint64_t)0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2436' href='#L_CALLS_2436'><pre>2436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateSelect(Mask, V, Passthru);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2437' href='#L_CALLS_2437'><pre>2437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2438' href='#L_CALLS_2438'><pre>2438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2439' href='#L_CALLS_2439'><pre>2439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the result back into the original argument 0.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2440' href='#L_CALLS_2440'><pre>2440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateInsertElement(Arg0, V, (uint64_t)0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2441' href='#L_CALLS_2441'><pre>2441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2442' href='#L_CALLS_2442'><pre>2442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2443' href='#L_CALLS_2443'><pre>2443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2444' href='#L_CALLS_2444'><pre>2444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2445' href='#L_CALLS_2445'><pre>2445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>LLVM_FALLTHROUGH</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>;</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2446' href='#L_CALLS_2446'><pre>2446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2447' href='#L_CALLS_2447'><pre>2447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X86 scalar intrinsics simplified with SimplifyDemandedVectorElts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2448' href='#L_CALLS_2448'><pre>2448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_max_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2449' href='#L_CALLS_2449'><pre>2449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_min_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2450' href='#L_CALLS_2450'><pre>2450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_max_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2451' href='#L_CALLS_2451'><pre>2451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_min_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2452' href='#L_CALLS_2452'><pre>2452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2453' href='#L_CALLS_2453'><pre>2453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2454' href='#L_CALLS_2454'><pre>2454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_maskz_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2455' href='#L_CALLS_2455'><pre>2455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_maskz_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2456' href='#L_CALLS_2456'><pre>2456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2457' href='#L_CALLS_2457'><pre>2457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2458' href='#L_CALLS_2458'><pre>2458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2459' href='#L_CALLS_2459'><pre>2459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2460' href='#L_CALLS_2460'><pre>2460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfnmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2461' href='#L_CALLS_2461'><pre>2461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfnmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2462' href='#L_CALLS_2462'><pre>2462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2463' href='#L_CALLS_2463'><pre>2463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2464' href='#L_CALLS_2464'><pre>2464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2465' href='#L_CALLS_2465'><pre>2465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2466' href='#L_CALLS_2466'><pre>2466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2467' href='#L_CALLS_2467'><pre>2467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2468' href='#L_CALLS_2468'><pre>2468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2469' href='#L_CALLS_2469'><pre>2469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2470' href='#L_CALLS_2470'><pre>2470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cmp_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2471' href='#L_CALLS_2471'><pre>2471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_min_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2472' href='#L_CALLS_2472'><pre>2472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_max_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2473' href='#L_CALLS_2473'><pre>2473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cmp_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2474' href='#L_CALLS_2474'><pre>2474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_min_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2475' href='#L_CALLS_2475'><pre>2475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_max_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2476' href='#L_CALLS_2476'><pre>2476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_round_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2477' href='#L_CALLS_2477'><pre>2477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_round_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2478' href='#L_CALLS_2478'><pre>2478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vfrcz_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2479' href='#L_CALLS_2479'><pre>2479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vfrcz_sd: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2480' href='#L_CALLS_2480'><pre>2480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = II->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2481' href='#L_CALLS_2481'><pre>2481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt UndefElts(VWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2482' href='#L_CALLS_2482'><pre>2482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2483' href='#L_CALLS_2483'><pre>2483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorElts(II, AllOnesEltMask, UndefElts)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2484' href='#L_CALLS_2484'><pre>2484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>V != II</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2485' href='#L_CALLS_2485'><pre>2485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2486' href='#L_CALLS_2486'><pre>2486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2487' href='#L_CALLS_2487'><pre>2487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2488' href='#L_CALLS_2488'><pre>2488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2489' href='#L_CALLS_2489'><pre>2489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2490' href='#L_CALLS_2490'><pre>2490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2491' href='#L_CALLS_2491'><pre>2491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant fold ashr( <A x Bi>, Ci ).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2492' href='#L_CALLS_2492'><pre>2492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant fold lshr( <A x Bi>, Ci ).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2493' href='#L_CALLS_2493'><pre>2493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant fold shl( <A x Bi>, Ci ).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2494' href='#L_CALLS_2494'><pre>2494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrai_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2495' href='#L_CALLS_2495'><pre>2495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrai_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2496' href='#L_CALLS_2496'><pre>2496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrai_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2497' href='#L_CALLS_2497'><pre>2497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrai_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2498' href='#L_CALLS_2498'><pre>2498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2499' href='#L_CALLS_2499'><pre>2499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2500' href='#L_CALLS_2500'><pre>2500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2501' href='#L_CALLS_2501'><pre>2501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2502' href='#L_CALLS_2502'><pre>2502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrai_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2503' href='#L_CALLS_2503'><pre>2503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2504' href='#L_CALLS_2504'><pre>2504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2505' href='#L_CALLS_2505'><pre>2505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2506' href='#L_CALLS_2506'><pre>2506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2507' href='#L_CALLS_2507'><pre>2507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2508' href='#L_CALLS_2508'><pre>2508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2509' href='#L_CALLS_2509'><pre>2509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2510' href='#L_CALLS_2510'><pre>2510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2511' href='#L_CALLS_2511'><pre>2511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrli_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2512' href='#L_CALLS_2512'><pre>2512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2513' href='#L_CALLS_2513'><pre>2513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2514' href='#L_CALLS_2514'><pre>2514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pslli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2515' href='#L_CALLS_2515'><pre>2515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2516' href='#L_CALLS_2516'><pre>2516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2517' href='#L_CALLS_2517'><pre>2517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pslli_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2518' href='#L_CALLS_2518'><pre>2518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2519' href='#L_CALLS_2519'><pre>2519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2520' href='#L_CALLS_2520'><pre>2520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pslli_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2521' href='#L_CALLS_2521'><pre>2521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86immShift(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2522' href='#L_CALLS_2522'><pre>2522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2523' href='#L_CALLS_2523'><pre>2523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2524' href='#L_CALLS_2524'><pre>2524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2525' href='#L_CALLS_2525'><pre>2525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psra_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2526' href='#L_CALLS_2526'><pre>2526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psra_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2527' href='#L_CALLS_2527'><pre>2527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psra_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2528' href='#L_CALLS_2528'><pre>2528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psra_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2529' href='#L_CALLS_2529'><pre>2529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2530' href='#L_CALLS_2530'><pre>2530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2531' href='#L_CALLS_2531'><pre>2531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2532' href='#L_CALLS_2532'><pre>2532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2533' href='#L_CALLS_2533'><pre>2533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psra_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2534' href='#L_CALLS_2534'><pre>2534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2535' href='#L_CALLS_2535'><pre>2535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2536' href='#L_CALLS_2536'><pre>2536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psrl_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2537' href='#L_CALLS_2537'><pre>2537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2538' href='#L_CALLS_2538'><pre>2538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2539' href='#L_CALLS_2539'><pre>2539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrl_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2540' href='#L_CALLS_2540'><pre>2540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2541' href='#L_CALLS_2541'><pre>2541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2542' href='#L_CALLS_2542'><pre>2542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrl_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2543' href='#L_CALLS_2543'><pre>2543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2544' href='#L_CALLS_2544'><pre>2544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2545' href='#L_CALLS_2545'><pre>2545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_psll_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2546' href='#L_CALLS_2546'><pre>2546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2547' href='#L_CALLS_2547'><pre>2547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2548' href='#L_CALLS_2548'><pre>2548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psll_w:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2549' href='#L_CALLS_2549'><pre>2549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2550' href='#L_CALLS_2550'><pre>2550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2551' href='#L_CALLS_2551'><pre>2551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psll_w_512: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2552' href='#L_CALLS_2552'><pre>2552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86immShift(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2553' href='#L_CALLS_2553'><pre>2553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2554' href='#L_CALLS_2554'><pre>2554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2555' href='#L_CALLS_2555'><pre>2555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // SSE2/AVX2 uses only the first 64-bits of the 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2556' href='#L_CALLS_2556'><pre>2556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operand to compute the shift amount.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2557' href='#L_CALLS_2557'><pre>2557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2558' href='#L_CALLS_2558'><pre>2558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Arg1->getType()->getPrimitiveSizeInBits() == 128 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2559' href='#L_CALLS_2559'><pre>2559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected packed shift size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2560' href='#L_CALLS_2560'><pre>2560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Arg1->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2561' href='#L_CALLS_2561'><pre>2561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2562' href='#L_CALLS_2562'><pre>2562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Arg1, VWidth, VWidth / 2)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2563' href='#L_CALLS_2563'><pre>2563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2564' href='#L_CALLS_2564'><pre>2564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2565' href='#L_CALLS_2565'><pre>2565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2566' href='#L_CALLS_2566'><pre>2566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2567' href='#L_CALLS_2567'><pre>2567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2568' href='#L_CALLS_2568'><pre>2568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2569' href='#L_CALLS_2569'><pre>2569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2570' href='#L_CALLS_2570'><pre>2570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2571' href='#L_CALLS_2571'><pre>2571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2572' href='#L_CALLS_2572'><pre>2572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psllv_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2573' href='#L_CALLS_2573'><pre>2573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2574' href='#L_CALLS_2574'><pre>2574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2575' href='#L_CALLS_2575'><pre>2575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2576' href='#L_CALLS_2576'><pre>2576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2577' href='#L_CALLS_2577'><pre>2577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psllv_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2578' href='#L_CALLS_2578'><pre>2578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrav_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2579' href='#L_CALLS_2579'><pre>2579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrav_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2580' href='#L_CALLS_2580'><pre>2580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2581' href='#L_CALLS_2581'><pre>2581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2582' href='#L_CALLS_2582'><pre>2582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2583' href='#L_CALLS_2583'><pre>2583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2584' href='#L_CALLS_2584'><pre>2584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2585' href='#L_CALLS_2585'><pre>2585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2586' href='#L_CALLS_2586'><pre>2586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrav_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2587' href='#L_CALLS_2587'><pre>2587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2588' href='#L_CALLS_2588'><pre>2588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2589' href='#L_CALLS_2589'><pre>2589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2590' href='#L_CALLS_2590'><pre>2590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_psrlv_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2591' href='#L_CALLS_2591'><pre>2591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_d_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2592' href='#L_CALLS_2592'><pre>2592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_q_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2593' href='#L_CALLS_2593'><pre>2593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2594' href='#L_CALLS_2594'><pre>2594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2595' href='#L_CALLS_2595'><pre>2595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_psrlv_w_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2596' href='#L_CALLS_2596'><pre>2596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86varShift(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2597' href='#L_CALLS_2597'><pre>2597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2598' href='#L_CALLS_2598'><pre>2598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2599' href='#L_CALLS_2599'><pre>2599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2600' href='#L_CALLS_2600'><pre>2600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pmulu_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2601' href='#L_CALLS_2601'><pre>2601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_pmuldq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2602' href='#L_CALLS_2602'><pre>2602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmul_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2603' href='#L_CALLS_2603'><pre>2603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmulu_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2604' href='#L_CALLS_2604'><pre>2604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pmul_dq_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2605' href='#L_CALLS_2605'><pre>2605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pmulu_dq_512: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2606' href='#L_CALLS_2606'><pre>2606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86muldq(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2607' href='#L_CALLS_2607'><pre>2607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2608' href='#L_CALLS_2608'><pre>2608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2609' href='#L_CALLS_2609'><pre>2609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned VWidth = II->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2610' href='#L_CALLS_2610'><pre>2610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt UndefElts(VWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2611' href='#L_CALLS_2611'><pre>2611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt DemandedElts = APInt::getAllOnesValue(VWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2612' href='#L_CALLS_2612'><pre>2612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorElts(II, DemandedElts, UndefElts)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2613' href='#L_CALLS_2613'><pre>2613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>V != II</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2614' href='#L_CALLS_2614'><pre>2614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2615' href='#L_CALLS_2615'><pre>2615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2616' href='#L_CALLS_2616'><pre>2616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2617' href='#L_CALLS_2617'><pre>2617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2618' href='#L_CALLS_2618'><pre>2618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2619' href='#L_CALLS_2619'><pre>2619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2620' href='#L_CALLS_2620'><pre>2620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packssdw_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2621' href='#L_CALLS_2621'><pre>2621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packsswb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2622' href='#L_CALLS_2622'><pre>2622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packssdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2623' href='#L_CALLS_2623'><pre>2623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packsswb:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2624' href='#L_CALLS_2624'><pre>2624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packssdw_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2625' href='#L_CALLS_2625'><pre>2625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packsswb_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2626' href='#L_CALLS_2626'><pre>2626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86pack(*II, *this, *Builder, true))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2627' href='#L_CALLS_2627'><pre>2627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2628' href='#L_CALLS_2628'><pre>2628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2629' href='#L_CALLS_2629'><pre>2629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2630' href='#L_CALLS_2630'><pre>2630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packuswb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2631' href='#L_CALLS_2631'><pre>2631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_packusdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2632' href='#L_CALLS_2632'><pre>2632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packusdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2633' href='#L_CALLS_2633'><pre>2633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packuswb:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2634' href='#L_CALLS_2634'><pre>2634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packusdw_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2635' href='#L_CALLS_2635'><pre>2635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packuswb_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2636' href='#L_CALLS_2636'><pre>2636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86pack(*II, *this, *Builder, false))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2637' href='#L_CALLS_2637'><pre>2637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2638' href='#L_CALLS_2638'><pre>2638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2639' href='#L_CALLS_2639'><pre>2639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2640' href='#L_CALLS_2640'><pre>2640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_pclmulqdq: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2641' href='#L_CALLS_2641'><pre>2641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(II->getArgOperand(2))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2642' href='#L_CALLS_2642'><pre>2642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Imm = C->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2643' href='#L_CALLS_2643'><pre>2643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2644' href='#L_CALLS_2644'><pre>2644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool MadeChange = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2645' href='#L_CALLS_2645'><pre>2645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2646' href='#L_CALLS_2646'><pre>2646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2647' href='#L_CALLS_2647'><pre>2647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Arg0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2648' href='#L_CALLS_2648'><pre>2648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt DemandedElts(VWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2649' href='#L_CALLS_2649'><pre>2649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2650' href='#L_CALLS_2650'><pre>2650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt UndefElts1(VWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2651' href='#L_CALLS_2651'><pre>2651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DemandedElts = (Imm & 0x01) ? </span><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2652' href='#L_CALLS_2652'><pre>2652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = SimplifyDemandedVectorElts(Arg0, DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2653' href='#L_CALLS_2653'><pre>2653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts1)) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2654' href='#L_CALLS_2654'><pre>2654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2655' href='#L_CALLS_2655'><pre>2655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2656' href='#L_CALLS_2656'><pre>2656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2657' href='#L_CALLS_2657'><pre>2657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2658' href='#L_CALLS_2658'><pre>2658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt UndefElts2(VWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2659' href='#L_CALLS_2659'><pre>2659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DemandedElts = (Imm & 0x10) ? </span><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2660' href='#L_CALLS_2660'><pre>2660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = SimplifyDemandedVectorElts(Arg1, DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2661' href='#L_CALLS_2661'><pre>2661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2)) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2662' href='#L_CALLS_2662'><pre>2662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2663' href='#L_CALLS_2663'><pre>2663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2664' href='#L_CALLS_2664'><pre>2664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2665' href='#L_CALLS_2665'><pre>2665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2666' href='#L_CALLS_2666'><pre>2666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If both input elements are undef, the result is undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2667' href='#L_CALLS_2667'><pre>2667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>UndefElts1[(Imm & 0x01) ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>] ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2668' href='#L_CALLS_2668'><pre>2668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>UndefElts2[(Imm & 0x10) ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>]</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2669' href='#L_CALLS_2669'><pre>2669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2670' href='#L_CALLS_2670'><pre>2670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantAggregateZero::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2671' href='#L_CALLS_2671'><pre>2671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2672' href='#L_CALLS_2672'><pre>2672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>MadeChange</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2673' href='#L_CALLS_2673'><pre>2673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2674' href='#L_CALLS_2674'><pre>2674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2675' href='#L_CALLS_2675'><pre>2675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2676' href='#L_CALLS_2676'><pre>2676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2677' href='#L_CALLS_2677'><pre>2677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2678' href='#L_CALLS_2678'><pre>2678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_insertps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2679' href='#L_CALLS_2679'><pre>2679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86insertps(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2680' href='#L_CALLS_2680'><pre>2680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2681' href='#L_CALLS_2681'><pre>2681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2682' href='#L_CALLS_2682'><pre>2682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2683' href='#L_CALLS_2683'><pre>2683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_extrq: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2684' href='#L_CALLS_2684'><pre>2684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2685' href='#L_CALLS_2685'><pre>2685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2686' href='#L_CALLS_2686'><pre>2686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth0 = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2687' href='#L_CALLS_2687'><pre>2687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth1 = Op1->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2688' href='#L_CALLS_2688'><pre>2688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Op0->getType()->getPrimitiveSizeInBits() == 128 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2689' href='#L_CALLS_2689'><pre>2689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1->getType()->getPrimitiveSizeInBits() == 128 && VWidth0 == 2 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2690' href='#L_CALLS_2690'><pre>2690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VWidth1 == 16 && "Unexpected operand sizes");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2691' href='#L_CALLS_2691'><pre>2691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2692' href='#L_CALLS_2692'><pre>2692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2693' href='#L_CALLS_2693'><pre>2693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2694' href='#L_CALLS_2694'><pre>2694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CILength =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2695' href='#L_CALLS_2695'><pre>2695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C1 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C1->getAggregateElement((unsigned)0))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2696' href='#L_CALLS_2696'><pre>2696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2697' href='#L_CALLS_2697'><pre>2697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CIIndex =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2698' href='#L_CALLS_2698'><pre>2698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C1 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C1->getAggregateElement((unsigned)1))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2699' href='#L_CALLS_2699'><pre>2699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2700' href='#L_CALLS_2700'><pre>2700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2701' href='#L_CALLS_2701'><pre>2701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to simplify to a constant, shuffle vector or EXTRQI call.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2702' href='#L_CALLS_2702'><pre>2702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86extrq(*II, Op0, CILength, CIIndex, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2703' href='#L_CALLS_2703'><pre>2703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2704' href='#L_CALLS_2704'><pre>2704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2705' href='#L_CALLS_2705'><pre>2705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // EXTRQ only uses the lowest 64-bits of the first 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2706' href='#L_CALLS_2706'><pre>2706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operands and the lowest 16-bits of the second.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2707' href='#L_CALLS_2707'><pre>2707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool MadeChange = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2708' href='#L_CALLS_2708'><pre>2708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op0, VWidth0, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2709' href='#L_CALLS_2709'><pre>2709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2710' href='#L_CALLS_2710'><pre>2710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2711' href='#L_CALLS_2711'><pre>2711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2712' href='#L_CALLS_2712'><pre>2712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op1, VWidth1, 2)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2713' href='#L_CALLS_2713'><pre>2713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2714' href='#L_CALLS_2714'><pre>2714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2715' href='#L_CALLS_2715'><pre>2715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2716' href='#L_CALLS_2716'><pre>2716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MadeChange</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2717' href='#L_CALLS_2717'><pre>2717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2718' href='#L_CALLS_2718'><pre>2718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2719' href='#L_CALLS_2719'><pre>2719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2720' href='#L_CALLS_2720'><pre>2720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2721' href='#L_CALLS_2721'><pre>2721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_extrqi: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2722' href='#L_CALLS_2722'><pre>2722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // EXTRQI: Extract Length bits starting from Index. Zero pad the remaining</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2723' href='#L_CALLS_2723'><pre>2723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bits of the lower 64-bits. The upper 64-bits are undefined.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2724' href='#L_CALLS_2724'><pre>2724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2725' href='#L_CALLS_2725'><pre>2725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2726' href='#L_CALLS_2726'><pre>2726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Op0->getType()->getPrimitiveSizeInBits() == 128 && VWidth == 2 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2727' href='#L_CALLS_2727'><pre>2727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected operand size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2728' href='#L_CALLS_2728'><pre>2728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2729' href='#L_CALLS_2729'><pre>2729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2730' href='#L_CALLS_2730'><pre>2730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CILength = dyn_cast<ConstantInt>(II->getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2731' href='#L_CALLS_2731'><pre>2731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CIIndex = dyn_cast<ConstantInt>(II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2732' href='#L_CALLS_2732'><pre>2732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2733' href='#L_CALLS_2733'><pre>2733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to simplify to a constant or shuffle vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2734' href='#L_CALLS_2734'><pre>2734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86extrq(*II, Op0, CILength, CIIndex, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2735' href='#L_CALLS_2735'><pre>2735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2736' href='#L_CALLS_2736'><pre>2736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2737' href='#L_CALLS_2737'><pre>2737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // EXTRQI only uses the lowest 64-bits of the first 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2738' href='#L_CALLS_2738'><pre>2738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2739' href='#L_CALLS_2739'><pre>2739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op0, VWidth, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2740' href='#L_CALLS_2740'><pre>2740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2741' href='#L_CALLS_2741'><pre>2741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2742' href='#L_CALLS_2742'><pre>2742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2743' href='#L_CALLS_2743'><pre>2743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2744' href='#L_CALLS_2744'><pre>2744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2745' href='#L_CALLS_2745'><pre>2745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2746' href='#L_CALLS_2746'><pre>2746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_insertq: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2747' href='#L_CALLS_2747'><pre>2747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2748' href='#L_CALLS_2748'><pre>2748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2749' href='#L_CALLS_2749'><pre>2749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2750' href='#L_CALLS_2750'><pre>2750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Op0->getType()->getPrimitiveSizeInBits() == 128 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2751' href='#L_CALLS_2751'><pre>2751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1->getType()->getPrimitiveSizeInBits() == 128 && VWidth == 2 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2752' href='#L_CALLS_2752'><pre>2752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1->getType()->getVectorNumElements() == 2 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2753' href='#L_CALLS_2753'><pre>2753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected operand size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2754' href='#L_CALLS_2754'><pre>2754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2755' href='#L_CALLS_2755'><pre>2755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2756' href='#L_CALLS_2756'><pre>2756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2757' href='#L_CALLS_2757'><pre>2757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI11 =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2758' href='#L_CALLS_2758'><pre>2758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C1 ? </span><span class='red'>dyn_cast_or_null<ConstantInt>(C1->getAggregateElement((unsigned)1))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2759' href='#L_CALLS_2759'><pre>2759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2760' href='#L_CALLS_2760'><pre>2760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2761' href='#L_CALLS_2761'><pre>2761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to simplify to a constant, shuffle vector or INSERTQI call.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2762' href='#L_CALLS_2762'><pre>2762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CI11</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2763' href='#L_CALLS_2763'><pre>2763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt &V11 = CI11->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2764' href='#L_CALLS_2764'><pre>2764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Len = V11.zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2765' href='#L_CALLS_2765'><pre>2765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Idx = V11.lshr(8).zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2766' href='#L_CALLS_2766'><pre>2766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86insertq(*II, Op0, Op1, Len, Idx, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2767' href='#L_CALLS_2767'><pre>2767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2768' href='#L_CALLS_2768'><pre>2768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2769' href='#L_CALLS_2769'><pre>2769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2770' href='#L_CALLS_2770'><pre>2770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // INSERTQ only uses the lowest 64-bits of the first 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2771' href='#L_CALLS_2771'><pre>2771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2772' href='#L_CALLS_2772'><pre>2772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op0, VWidth, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2773' href='#L_CALLS_2773'><pre>2773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2774' href='#L_CALLS_2774'><pre>2774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2775' href='#L_CALLS_2775'><pre>2775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2776' href='#L_CALLS_2776'><pre>2776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2777' href='#L_CALLS_2777'><pre>2777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2778' href='#L_CALLS_2778'><pre>2778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2779' href='#L_CALLS_2779'><pre>2779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_insertqi: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2780' href='#L_CALLS_2780'><pre>2780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // INSERTQI: Extract lowest Length bits from lower half of second source and</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2781' href='#L_CALLS_2781'><pre>2781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // insert over first source starting at Index bit. The upper 64-bits are</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2782' href='#L_CALLS_2782'><pre>2782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // undefined.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2783' href='#L_CALLS_2783'><pre>2783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2784' href='#L_CALLS_2784'><pre>2784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2785' href='#L_CALLS_2785'><pre>2785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth0 = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2786' href='#L_CALLS_2786'><pre>2786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth1 = Op1->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2787' href='#L_CALLS_2787'><pre>2787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Op0->getType()->getPrimitiveSizeInBits() == 128 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2788' href='#L_CALLS_2788'><pre>2788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1->getType()->getPrimitiveSizeInBits() == 128 && VWidth0 == 2 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2789' href='#L_CALLS_2789'><pre>2789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VWidth1 == 2 && "Unexpected operand sizes");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2790' href='#L_CALLS_2790'><pre>2790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2791' href='#L_CALLS_2791'><pre>2791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if we're dealing with constant values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2792' href='#L_CALLS_2792'><pre>2792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CILength = dyn_cast<ConstantInt>(II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2793' href='#L_CALLS_2793'><pre>2793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CIIndex = dyn_cast<ConstantInt>(II->getArgOperand(3));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2794' href='#L_CALLS_2794'><pre>2794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2795' href='#L_CALLS_2795'><pre>2795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Attempt to simplify to a constant or shuffle vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2796' href='#L_CALLS_2796'><pre>2796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CILength && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CIIndex</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2797' href='#L_CALLS_2797'><pre>2797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Len = CILength->getValue().zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2798' href='#L_CALLS_2798'><pre>2798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Idx = CIIndex->getValue().zextOrTrunc(6);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2799' href='#L_CALLS_2799'><pre>2799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86insertq(*II, Op0, Op1, Len, Idx, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2800' href='#L_CALLS_2800'><pre>2800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2801' href='#L_CALLS_2801'><pre>2801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2802' href='#L_CALLS_2802'><pre>2802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2803' href='#L_CALLS_2803'><pre>2803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // INSERTQI only uses the lowest 64-bits of the first two 128-bit vector</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2804' href='#L_CALLS_2804'><pre>2804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operands.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2805' href='#L_CALLS_2805'><pre>2805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool MadeChange = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2806' href='#L_CALLS_2806'><pre>2806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op0, VWidth0, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2807' href='#L_CALLS_2807'><pre>2807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2808' href='#L_CALLS_2808'><pre>2808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2809' href='#L_CALLS_2809'><pre>2809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2810' href='#L_CALLS_2810'><pre>2810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyDemandedVectorEltsLow(Op1, VWidth1, 1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2811' href='#L_CALLS_2811'><pre>2811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2812' href='#L_CALLS_2812'><pre>2812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2813' href='#L_CALLS_2813'><pre>2813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2814' href='#L_CALLS_2814'><pre>2814</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MadeChange</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2815' href='#L_CALLS_2815'><pre>2815</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2816' href='#L_CALLS_2816'><pre>2816</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2817' href='#L_CALLS_2817'><pre>2817</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2818' href='#L_CALLS_2818'><pre>2818</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2819' href='#L_CALLS_2819'><pre>2819</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_pblendvb:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2820' href='#L_CALLS_2820'><pre>2820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_blendvps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2821' href='#L_CALLS_2821'><pre>2821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_blendvpd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2822' href='#L_CALLS_2822'><pre>2822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_blendv_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2823' href='#L_CALLS_2823'><pre>2823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_blendv_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2824' href='#L_CALLS_2824'><pre>2824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pblendvb: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2825' href='#L_CALLS_2825'><pre>2825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Convert blendv* to vector selects if the mask is constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2826' href='#L_CALLS_2826'><pre>2826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This optimization is convoluted because the intrinsic is defined as</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2827' href='#L_CALLS_2827'><pre>2827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // getting a vector of floats or doubles for the ps and pd versions.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2828' href='#L_CALLS_2828'><pre>2828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME: That should be changed.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2829' href='#L_CALLS_2829'><pre>2829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2830' href='#L_CALLS_2830'><pre>2830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2831' href='#L_CALLS_2831'><pre>2831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2832' href='#L_CALLS_2832'><pre>2832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Mask = II->getArgOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2833' href='#L_CALLS_2833'><pre>2833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2834' href='#L_CALLS_2834'><pre>2834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fold (blend A, A, Mask) -> A</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2835' href='#L_CALLS_2835'><pre>2835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Op0 == Op1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2836' href='#L_CALLS_2836'><pre>2836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, Op0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2837' href='#L_CALLS_2837'><pre>2837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2838' href='#L_CALLS_2838'><pre>2838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Zero Mask - select 1st argument.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2839' href='#L_CALLS_2839'><pre>2839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(Mask)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2840' href='#L_CALLS_2840'><pre>2840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, Op0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2841' href='#L_CALLS_2841'><pre>2841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2842' href='#L_CALLS_2842'><pre>2842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Constant Mask - select 1st/2nd argument lane based on top bit of mask.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2843' href='#L_CALLS_2843'><pre>2843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ConstantMask</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantDataVector>(Mask)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2844' href='#L_CALLS_2844'><pre>2844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *NewSelector = getNegativeIsTrueBoolVec(ConstantMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2845' href='#L_CALLS_2845'><pre>2845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(NewSelector, Op1, Op0, "blendv");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2846' href='#L_CALLS_2846'><pre>2846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2847' href='#L_CALLS_2847'><pre>2847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2848' href='#L_CALLS_2848'><pre>2848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2849' href='#L_CALLS_2849'><pre>2849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2850' href='#L_CALLS_2850'><pre>2850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_ssse3_pshuf_b_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2851' href='#L_CALLS_2851'><pre>2851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pshuf_b:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2852' href='#L_CALLS_2852'><pre>2852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pshuf_b_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2853' href='#L_CALLS_2853'><pre>2853</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86pshufb(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2854' href='#L_CALLS_2854'><pre>2854</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2855' href='#L_CALLS_2855'><pre>2855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2856' href='#L_CALLS_2856'><pre>2856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2857' href='#L_CALLS_2857'><pre>2857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2858' href='#L_CALLS_2858'><pre>2858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2859' href='#L_CALLS_2859'><pre>2859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vpermilvar_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2860' href='#L_CALLS_2860'><pre>2860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2861' href='#L_CALLS_2861'><pre>2861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2862' href='#L_CALLS_2862'><pre>2862</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vpermilvar_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2863' href='#L_CALLS_2863'><pre>2863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86vpermilvar(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2864' href='#L_CALLS_2864'><pre>2864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2865' href='#L_CALLS_2865'><pre>2865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2866' href='#L_CALLS_2866'><pre>2866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2867' href='#L_CALLS_2867'><pre>2867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_permd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2868' href='#L_CALLS_2868'><pre>2868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_permps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2869' href='#L_CALLS_2869'><pre>2869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86vpermv(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2870' href='#L_CALLS_2870'><pre>2870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2871' href='#L_CALLS_2871'><pre>2871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2872' href='#L_CALLS_2872'><pre>2872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2873' href='#L_CALLS_2873'><pre>2873</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_df_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2874' href='#L_CALLS_2874'><pre>2874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_df_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2875' href='#L_CALLS_2875'><pre>2875</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_di_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2876' href='#L_CALLS_2876'><pre>2876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_di_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2877' href='#L_CALLS_2877'><pre>2877</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_hi_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2878' href='#L_CALLS_2878'><pre>2878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_hi_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2879' href='#L_CALLS_2879'><pre>2879</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_hi_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2880' href='#L_CALLS_2880'><pre>2880</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_qi_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2881' href='#L_CALLS_2881'><pre>2881</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_qi_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2882' href='#L_CALLS_2882'><pre>2882</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_qi_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2883' href='#L_CALLS_2883'><pre>2883</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_sf_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2884' href='#L_CALLS_2884'><pre>2884</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_sf_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2885' href='#L_CALLS_2885'><pre>2885</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_si_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2886' href='#L_CALLS_2886'><pre>2886</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_permvar_si_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2887' href='#L_CALLS_2887'><pre>2887</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = simplifyX86vpermv(*II, *Builder)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2888' href='#L_CALLS_2888'><pre>2888</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We simplified the permuting, now create a select for the masking.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2889' href='#L_CALLS_2889'><pre>2889</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = emitX86MaskSelect(II->getArgOperand(3), V, II->getArgOperand(2),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2890' href='#L_CALLS_2890'><pre>2890</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2891' href='#L_CALLS_2891'><pre>2891</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2892' href='#L_CALLS_2892'><pre>2892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2893' href='#L_CALLS_2893'><pre>2893</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2894' href='#L_CALLS_2894'><pre>2894</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2895' href='#L_CALLS_2895'><pre>2895</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vperm2f128_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2896' href='#L_CALLS_2896'><pre>2896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vperm2f128_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2897' href='#L_CALLS_2897'><pre>2897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vperm2f128_si_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2898' href='#L_CALLS_2898'><pre>2898</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_vperm2i128:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2899' href='#L_CALLS_2899'><pre>2899</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86vperm2(*II, *Builder))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2900' href='#L_CALLS_2900'><pre>2900</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2901' href='#L_CALLS_2901'><pre>2901</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2902' href='#L_CALLS_2902'><pre>2902</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2903' href='#L_CALLS_2903'><pre>2903</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskload_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2904' href='#L_CALLS_2904'><pre>2904</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskload_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2905' href='#L_CALLS_2905'><pre>2905</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskload_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2906' href='#L_CALLS_2906'><pre>2906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskload_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2907' href='#L_CALLS_2907'><pre>2907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskload_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2908' href='#L_CALLS_2908'><pre>2908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskload_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2909' href='#L_CALLS_2909'><pre>2909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskload_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2910' href='#L_CALLS_2910'><pre>2910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskload_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2911' href='#L_CALLS_2911'><pre>2911</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>I</span><span class='red'> = simplifyX86MaskedLoad(*II, *this))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2912' href='#L_CALLS_2912'><pre>2912</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return I</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2913' href='#L_CALLS_2913'><pre>2913</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2914' href='#L_CALLS_2914'><pre>2914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2915' href='#L_CALLS_2915'><pre>2915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_maskmov_dqu:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2916' href='#L_CALLS_2916'><pre>2916</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskstore_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2917' href='#L_CALLS_2917'><pre>2917</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskstore_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2918' href='#L_CALLS_2918'><pre>2918</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskstore_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2919' href='#L_CALLS_2919'><pre>2919</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_maskstore_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2920' href='#L_CALLS_2920'><pre>2920</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskstore_d:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2921' href='#L_CALLS_2921'><pre>2921</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskstore_q:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2922' href='#L_CALLS_2922'><pre>2922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskstore_d_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2923' href='#L_CALLS_2923'><pre>2923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_maskstore_q_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2924' href='#L_CALLS_2924'><pre>2924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>simplifyX86MaskedStore(*II, *this)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2925' href='#L_CALLS_2925'><pre>2925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2926' href='#L_CALLS_2926'><pre>2926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2927' href='#L_CALLS_2927'><pre>2927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2928' href='#L_CALLS_2928'><pre>2928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomb:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2929' href='#L_CALLS_2929'><pre>2929</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomd:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2930' href='#L_CALLS_2930'><pre>2930</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2931' href='#L_CALLS_2931'><pre>2931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomw:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2932' href='#L_CALLS_2932'><pre>2932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86vpcom(*II, *Builder, true))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2933' href='#L_CALLS_2933'><pre>2933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2934' href='#L_CALLS_2934'><pre>2934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2935' href='#L_CALLS_2935'><pre>2935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2936' href='#L_CALLS_2936'><pre>2936</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomub:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2937' href='#L_CALLS_2937'><pre>2937</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomud:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2938' href='#L_CALLS_2938'><pre>2938</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomuq:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2939' href='#L_CALLS_2939'><pre>2939</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vpcomuw:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2940' href='#L_CALLS_2940'><pre>2940</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = simplifyX86vpcom(*II, *Builder, false))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2941' href='#L_CALLS_2941'><pre>2941</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2942' href='#L_CALLS_2942'><pre>2942</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2943' href='#L_CALLS_2943'><pre>2943</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2944' href='#L_CALLS_2944'><pre>2944</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ppc_altivec_vperm:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2945' href='#L_CALLS_2945'><pre>2945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2946' href='#L_CALLS_2946'><pre>2946</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that ppc_altivec_vperm has a big-endian bias, so when creating</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2947' href='#L_CALLS_2947'><pre>2947</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // a vectorshuffle for little endian, we must undo the transformation</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2948' href='#L_CALLS_2948'><pre>2948</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // performed on vec_perm in altivec.h. That is, we must complement</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2949' href='#L_CALLS_2949'><pre>2949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the permutation mask with respect to 31 and reverse the order of</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2950' href='#L_CALLS_2950'><pre>2950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // V1 and V2.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2951' href='#L_CALLS_2951'><pre>2951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Constant *</span><div class='tooltip'><span class='red'>Mask</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(II->getArgOperand(2))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2952' href='#L_CALLS_2952'><pre>2952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(Mask->getType()->getVectorNumElements() == 16 &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2953' href='#L_CALLS_2953'><pre>2953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Bad type for intrinsic!");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2954' href='#L_CALLS_2954'><pre>2954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2955' href='#L_CALLS_2955'><pre>2955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that all of the elements are integer constants or undefs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2956' href='#L_CALLS_2956'><pre>2956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool AllEltsOk = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2957' href='#L_CALLS_2957'><pre>2957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != 16</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2958' href='#L_CALLS_2958'><pre>2958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = Mask->getAggregateElement(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2959' href='#L_CALLS_2959'><pre>2959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Elt || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!(isa<ConstantInt>(Elt) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Elt)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2960' href='#L_CALLS_2960'><pre>2960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllEltsOk = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2961' href='#L_CALLS_2961'><pre>2961</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2962' href='#L_CALLS_2962'><pre>2962</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2963' href='#L_CALLS_2963'><pre>2963</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2964' href='#L_CALLS_2964'><pre>2964</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2965' href='#L_CALLS_2965'><pre>2965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>AllEltsOk</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2966' href='#L_CALLS_2966'><pre>2966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Cast the input vectors to byte vectors.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2967' href='#L_CALLS_2967'><pre>2967</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = Builder->CreateBitCast(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2968' href='#L_CALLS_2968'><pre>2968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2969' href='#L_CALLS_2969'><pre>2969</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = Builder->CreateBitCast(II->getArgOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2970' href='#L_CALLS_2970'><pre>2970</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2971' href='#L_CALLS_2971'><pre>2971</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Result = UndefValue::get(Op0->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2972' href='#L_CALLS_2972'><pre>2972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2973' href='#L_CALLS_2973'><pre>2973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only extract each element once.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2974' href='#L_CALLS_2974'><pre>2974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ExtractedElts[32];</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2975' href='#L_CALLS_2975'><pre>2975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> memset(ExtractedElts, 0, sizeof(ExtractedElts));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2976' href='#L_CALLS_2976'><pre>2976</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2977' href='#L_CALLS_2977'><pre>2977</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != 16</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2978' href='#L_CALLS_2978'><pre>2978</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<UndefValue>(Mask->getAggregateElement(i))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2979' href='#L_CALLS_2979'><pre>2979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2980' href='#L_CALLS_2980'><pre>2980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned Idx =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2981' href='#L_CALLS_2981'><pre>2981</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<ConstantInt>(Mask->getAggregateElement(i))->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2982' href='#L_CALLS_2982'><pre>2982</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Idx &= 31; // Match the hardware behavior.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2983' href='#L_CALLS_2983'><pre>2983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DL.isLittleEndian()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2984' href='#L_CALLS_2984'><pre>2984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Idx = 31 - Idx</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2985' href='#L_CALLS_2985'><pre>2985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2986' href='#L_CALLS_2986'><pre>2986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!ExtractedElts[Idx]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2987' href='#L_CALLS_2987'><pre>2987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0ToUse = (DL.isLittleEndian()) ? </span><div class='tooltip'><span class='red'>Op1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Op0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2988' href='#L_CALLS_2988'><pre>2988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1ToUse = (DL.isLittleEndian()) ? </span><div class='tooltip'><span class='red'>Op0</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Op1</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2989' href='#L_CALLS_2989'><pre>2989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ExtractedElts[Idx] =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2990' href='#L_CALLS_2990'><pre>2990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateExtractElement(Idx < 16 ? </span><div class='tooltip'><span class='red'>Op0ToUse</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Op1ToUse</span><span class='tooltip-content'>0</span></div><span class='red'>,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2991' href='#L_CALLS_2991'><pre>2991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt32(Idx&15));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2992' href='#L_CALLS_2992'><pre>2992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2993' href='#L_CALLS_2993'><pre>2993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2994' href='#L_CALLS_2994'><pre>2994</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert this value into the result vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2995' href='#L_CALLS_2995'><pre>2995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result = Builder->CreateInsertElement(Result, ExtractedElts[Idx],</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2996' href='#L_CALLS_2996'><pre>2996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt32(i));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2997' href='#L_CALLS_2997'><pre>2997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2998' href='#L_CALLS_2998'><pre>2998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::Create(Instruction::BitCast, Result, CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_2999' href='#L_CALLS_2999'><pre>2999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3000' href='#L_CALLS_3000'><pre>3000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3001' href='#L_CALLS_3001'><pre>3001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3002' href='#L_CALLS_3002'><pre>3002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3003' href='#L_CALLS_3003'><pre>3003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld1:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3004' href='#L_CALLS_3004'><pre>3004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld2:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3005' href='#L_CALLS_3005'><pre>3005</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld3:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3006' href='#L_CALLS_3006'><pre>3006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld4:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3007' href='#L_CALLS_3007'><pre>3007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld2lane:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3008' href='#L_CALLS_3008'><pre>3008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld3lane:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3009' href='#L_CALLS_3009'><pre>3009</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vld4lane:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3010' href='#L_CALLS_3010'><pre>3010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst1:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3011' href='#L_CALLS_3011'><pre>3011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst2:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3012' href='#L_CALLS_3012'><pre>3012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst3:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3013' href='#L_CALLS_3013'><pre>3013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst4:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3014' href='#L_CALLS_3014'><pre>3014</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst2lane:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3015' href='#L_CALLS_3015'><pre>3015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst3lane:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3016' href='#L_CALLS_3016'><pre>3016</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vst4lane: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3017' href='#L_CALLS_3017'><pre>3017</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned MemAlign =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3018' href='#L_CALLS_3018'><pre>3018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> getKnownAlignment(II->getArgOperand(0), DL, II, &AC, &DT);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3019' href='#L_CALLS_3019'><pre>3019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned AlignArg = II->getNumArgOperands() - 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3020' href='#L_CALLS_3020'><pre>3020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *IntrAlign = dyn_cast<ConstantInt>(II->getArgOperand(AlignArg));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3021' href='#L_CALLS_3021'><pre>3021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IntrAlign && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IntrAlign->getZExtValue() < MemAlign</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3022' href='#L_CALLS_3022'><pre>3022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(AlignArg,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3023' href='#L_CALLS_3023'><pre>3023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(Type::getInt32Ty(II->getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3024' href='#L_CALLS_3024'><pre>3024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MemAlign, false));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3025' href='#L_CALLS_3025'><pre>3025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3026' href='#L_CALLS_3026'><pre>3026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3027' href='#L_CALLS_3027'><pre>3027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3028' href='#L_CALLS_3028'><pre>3028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3029' href='#L_CALLS_3029'><pre>3029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3030' href='#L_CALLS_3030'><pre>3030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vmulls:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3031' href='#L_CALLS_3031'><pre>3031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::arm_neon_vmullu:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3032' href='#L_CALLS_3032'><pre>3032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::aarch64_neon_smull:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3033' href='#L_CALLS_3033'><pre>3033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::aarch64_neon_umull: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3034' href='#L_CALLS_3034'><pre>3034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3035' href='#L_CALLS_3035'><pre>3035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Arg1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3036' href='#L_CALLS_3036'><pre>3036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3037' href='#L_CALLS_3037'><pre>3037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle mul by zero first:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3038' href='#L_CALLS_3038'><pre>3038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(Arg0) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(Arg1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3039' href='#L_CALLS_3039'><pre>3039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, ConstantAggregateZero::get(II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3040' href='#L_CALLS_3040'><pre>3040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3041' href='#L_CALLS_3041'><pre>3041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3042' href='#L_CALLS_3042'><pre>3042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check for constant LHS & RHS - in this case we just simplify.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3043' href='#L_CALLS_3043'><pre>3043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool Zext = (II->getIntrinsicID() == Intrinsic::arm_neon_vmullu ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3044' href='#L_CALLS_3044'><pre>3044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->getIntrinsicID() == Intrinsic::aarch64_neon_umull</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3045' href='#L_CALLS_3045'><pre>3045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *NewVT = cast<VectorType>(II->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3046' href='#L_CALLS_3046'><pre>3046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Constant *</span><div class='tooltip'><span class='red'>CV0</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Arg0)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3047' href='#L_CALLS_3047'><pre>3047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Constant *</span><div class='tooltip'><span class='red'>CV1</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Arg1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3048' href='#L_CALLS_3048'><pre>3048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CV0 = ConstantExpr::getIntegerCast(CV0, NewVT, /*isSigned=*/!Zext);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3049' href='#L_CALLS_3049'><pre>3049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CV1 = ConstantExpr::getIntegerCast(CV1, NewVT, /*isSigned=*/!Zext);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3050' href='#L_CALLS_3050'><pre>3050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3051' href='#L_CALLS_3051'><pre>3051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, ConstantExpr::getMul(CV0, CV1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3052' href='#L_CALLS_3052'><pre>3052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3053' href='#L_CALLS_3053'><pre>3053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3054' href='#L_CALLS_3054'><pre>3054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Couldn't simplify - canonicalize constant to the RHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3055' href='#L_CALLS_3055'><pre>3055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>std::swap(Arg0, Arg1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3056' href='#L_CALLS_3056'><pre>3056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3057' href='#L_CALLS_3057'><pre>3057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3058' href='#L_CALLS_3058'><pre>3058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle mul by one:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3059' href='#L_CALLS_3059'><pre>3059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Constant *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CV1</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Arg1))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3060' href='#L_CALLS_3060'><pre>3060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantInt *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Splat</span><span class='tooltip-content'>0</span></div><span class='red'> =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3061' href='#L_CALLS_3061'><pre>3061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> dyn_cast_or_null<ConstantInt>(CV1->getSplatValue()))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3062' href='#L_CALLS_3062'><pre>3062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Splat->isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3063' href='#L_CALLS_3063'><pre>3063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return CastInst::CreateIntegerCast(Arg0, II->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3064' href='#L_CALLS_3064'><pre>3064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> /*isSigned=*/!Zext)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3065' href='#L_CALLS_3065'><pre>3065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3066' href='#L_CALLS_3066'><pre>3066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3067' href='#L_CALLS_3067'><pre>3067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3068' href='#L_CALLS_3068'><pre>3068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3069' href='#L_CALLS_3069'><pre>3069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_rcp: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3070' href='#L_CALLS_3070'><pre>3070</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(II->getArgOperand(0))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3071' href='#L_CALLS_3071'><pre>3071</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APFloat &ArgVal = C->getValueAPF();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3072' href='#L_CALLS_3072'><pre>3072</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Val(ArgVal.getSemantics(), 1.0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3073' href='#L_CALLS_3073'><pre>3073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::opStatus Status = Val.divide(ArgVal,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3074' href='#L_CALLS_3074'><pre>3074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3075' href='#L_CALLS_3075'><pre>3075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only do this if it was exact and therefore not dependent on the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3076' href='#L_CALLS_3076'><pre>3076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // rounding mode.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3077' href='#L_CALLS_3077'><pre>3077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Status == APFloat::opOK</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3078' href='#L_CALLS_3078'><pre>3078</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, ConstantFP::get(II->getContext(), Val))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3079' href='#L_CALLS_3079'><pre>3079</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3080' href='#L_CALLS_3080'><pre>3080</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3081' href='#L_CALLS_3081'><pre>3081</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3082' href='#L_CALLS_3082'><pre>3082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3083' href='#L_CALLS_3083'><pre>3083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_frexp_mant:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3084' href='#L_CALLS_3084'><pre>3084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_frexp_exp: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3085' href='#L_CALLS_3085'><pre>3085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3086' href='#L_CALLS_3086'><pre>3086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3087' href='#L_CALLS_3087'><pre>3087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Exp;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3088' href='#L_CALLS_3088'><pre>3088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Significand = frexp(C->getValueAPF(), Exp,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3089' href='#L_CALLS_3089'><pre>3089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3090' href='#L_CALLS_3090'><pre>3090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3091' href='#L_CALLS_3091'><pre>3091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::amdgcn_frexp_mant</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3092' href='#L_CALLS_3092'><pre>3092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, ConstantFP::get(II->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3093' href='#L_CALLS_3093'><pre>3093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Significand));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3094' href='#L_CALLS_3094'><pre>3094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3095' href='#L_CALLS_3095'><pre>3095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3096' href='#L_CALLS_3096'><pre>3096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Match instruction special case behavior.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3097' href='#L_CALLS_3097'><pre>3097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Exp == APFloat::IEK_NaN || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Exp == APFloat::IEK_Inf</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3098' href='#L_CALLS_3098'><pre>3098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Exp = 0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3099' href='#L_CALLS_3099'><pre>3099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3100' href='#L_CALLS_3100'><pre>3100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), Exp))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3101' href='#L_CALLS_3101'><pre>3101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3102' href='#L_CALLS_3102'><pre>3102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3103' href='#L_CALLS_3103'><pre>3103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Src)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3104' href='#L_CALLS_3104'><pre>3104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, UndefValue::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3105' href='#L_CALLS_3105'><pre>3105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3106' href='#L_CALLS_3106'><pre>3106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3107' href='#L_CALLS_3107'><pre>3107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3108' href='#L_CALLS_3108'><pre>3108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_class: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3109' href='#L_CALLS_3109'><pre>3109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> enum {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3110' href='#L_CALLS_3110'><pre>3110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> S_NAN = 1 << 0, // Signaling NaN</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3111' href='#L_CALLS_3111'><pre>3111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Q_NAN = 1 << 1, // Quiet NaN</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3112' href='#L_CALLS_3112'><pre>3112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> N_INFINITY = 1 << 2, // Negative infinity</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3113' href='#L_CALLS_3113'><pre>3113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> N_NORMAL = 1 << 3, // Negative normal</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3114' href='#L_CALLS_3114'><pre>3114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> N_SUBNORMAL = 1 << 4, // Negative subnormal</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3115' href='#L_CALLS_3115'><pre>3115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> N_ZERO = 1 << 5, // Negative zero</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3116' href='#L_CALLS_3116'><pre>3116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> P_ZERO = 1 << 6, // Positive zero</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3117' href='#L_CALLS_3117'><pre>3117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> P_SUBNORMAL = 1 << 7, // Positive subnormal</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3118' href='#L_CALLS_3118'><pre>3118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> P_NORMAL = 1 << 8, // Positive normal</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3119' href='#L_CALLS_3119'><pre>3119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> P_INFINITY = 1 << 9 // Positive infinity</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3120' href='#L_CALLS_3120'><pre>3120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> };</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3121' href='#L_CALLS_3121'><pre>3121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3122' href='#L_CALLS_3122'><pre>3122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const uint32_t FullMask = S_NAN | Q_NAN | N_INFINITY | N_NORMAL |</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3123' href='#L_CALLS_3123'><pre>3123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> N_SUBNORMAL | N_ZERO | P_ZERO | P_SUBNORMAL | P_NORMAL | P_INFINITY;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3124' href='#L_CALLS_3124'><pre>3124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3125' href='#L_CALLS_3125'><pre>3125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3126' href='#L_CALLS_3126'><pre>3126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3127' href='#L_CALLS_3127'><pre>3127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const ConstantInt *CMask = dyn_cast<ConstantInt>(Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3128' href='#L_CALLS_3128'><pre>3128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CMask</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3129' href='#L_CALLS_3129'><pre>3129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<UndefValue>(Src0)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3130' href='#L_CALLS_3130'><pre>3130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, UndefValue::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3131' href='#L_CALLS_3131'><pre>3131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3132' href='#L_CALLS_3132'><pre>3132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Src1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3133' href='#L_CALLS_3133'><pre>3133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3134' href='#L_CALLS_3134'><pre>3134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3135' href='#L_CALLS_3135'><pre>3135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3136' href='#L_CALLS_3136'><pre>3136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3137' href='#L_CALLS_3137'><pre>3137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>uint32_t Mask = CMask->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3138' href='#L_CALLS_3138'><pre>3138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3139' href='#L_CALLS_3139'><pre>3139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If all tests are made, it doesn't matter what the value is.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3140' href='#L_CALLS_3140'><pre>3140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>(Mask & FullMask) == FullMask</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3141' href='#L_CALLS_3141'><pre>3141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), true))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3142' href='#L_CALLS_3142'><pre>3142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3143' href='#L_CALLS_3143'><pre>3143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Mask & FullMask) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3144' href='#L_CALLS_3144'><pre>3144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3145' href='#L_CALLS_3145'><pre>3145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3146' href='#L_CALLS_3146'><pre>3146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Mask == (S_NAN | Q_NAN)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3147' href='#L_CALLS_3147'><pre>3147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Equivalent of isnan. Replace with standard fcmp.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3148' href='#L_CALLS_3148'><pre>3148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *FCmp = Builder->CreateFCmpUNO(Src0, Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3149' href='#L_CALLS_3149'><pre>3149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FCmp->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3150' href='#L_CALLS_3150'><pre>3150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, FCmp);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3151' href='#L_CALLS_3151'><pre>3151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3152' href='#L_CALLS_3152'><pre>3152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3153' href='#L_CALLS_3153'><pre>3153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const ConstantFP *CVal = dyn_cast<ConstantFP>(Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3154' href='#L_CALLS_3154'><pre>3154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CVal</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3155' href='#L_CALLS_3155'><pre>3155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<UndefValue>(Src0)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3156' href='#L_CALLS_3156'><pre>3156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, UndefValue::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3157' href='#L_CALLS_3157'><pre>3157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3158' href='#L_CALLS_3158'><pre>3158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Clamp mask to used bits</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3159' href='#L_CALLS_3159'><pre>3159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(Mask & FullMask) != Mask</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3160' href='#L_CALLS_3160'><pre>3160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewCall = Builder->CreateCall(II->getCalledFunction(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3161' href='#L_CALLS_3161'><pre>3161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> { Src0, ConstantInt::get(Src1->getType(), Mask & FullMask) }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3162' href='#L_CALLS_3162'><pre>3162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> );</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3163' href='#L_CALLS_3163'><pre>3163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3164' href='#L_CALLS_3164'><pre>3164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3165' href='#L_CALLS_3165'><pre>3165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, NewCall);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3166' href='#L_CALLS_3166'><pre>3166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3167' href='#L_CALLS_3167'><pre>3167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3168' href='#L_CALLS_3168'><pre>3168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3169' href='#L_CALLS_3169'><pre>3169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3170' href='#L_CALLS_3170'><pre>3170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3171' href='#L_CALLS_3171'><pre>3171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const APFloat &Val = CVal->getValueAPF();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3172' href='#L_CALLS_3172'><pre>3172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3173' href='#L_CALLS_3173'><pre>3173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Result =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3174' href='#L_CALLS_3174'><pre>3174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ((Mask & S_NAN) && </span><div class='tooltip'><span class='red'>Val.isNaN()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Val.isSignaling()</span><span class='tooltip-content'>0</span></div><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3175' href='#L_CALLS_3175'><pre>3175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & Q_NAN) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isNaN()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!Val.isSignaling()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3176' href='#L_CALLS_3176'><pre>3176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & N_INFINITY) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isInfinity()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3177' href='#L_CALLS_3177'><pre>3177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & N_NORMAL) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isNormal()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3178' href='#L_CALLS_3178'><pre>3178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & N_SUBNORMAL) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isDenormal()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3179' href='#L_CALLS_3179'><pre>3179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & N_ZERO) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isZero()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3180' href='#L_CALLS_3180'><pre>3180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & P_ZERO) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isZero()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3181' href='#L_CALLS_3181'><pre>3181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & P_SUBNORMAL) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isDenormal()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3182' href='#L_CALLS_3182'><pre>3182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & P_NORMAL) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isNormal()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3183' href='#L_CALLS_3183'><pre>3183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((Mask & P_INFINITY) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Val.isInfinity()</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!Val.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3184' href='#L_CALLS_3184'><pre>3184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3185' href='#L_CALLS_3185'><pre>3185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), Result))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3186' href='#L_CALLS_3186'><pre>3186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3187' href='#L_CALLS_3187'><pre>3187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_cvt_pkrtz: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3188' href='#L_CALLS_3188'><pre>3188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3189' href='#L_CALLS_3189'><pre>3189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3190' href='#L_CALLS_3190'><pre>3190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C0</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src0)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3191' href='#L_CALLS_3191'><pre>3191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C1</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3192' href='#L_CALLS_3192'><pre>3192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const fltSemantics &HalfSem</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3193' href='#L_CALLS_3193'><pre>3193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> = II->getType()->getScalarType()->getFltSemantics();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3194' href='#L_CALLS_3194'><pre>3194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool LosesInfo;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3195' href='#L_CALLS_3195'><pre>3195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Val0 = C0->getValueAPF();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3196' href='#L_CALLS_3196'><pre>3196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Val1 = C1->getValueAPF();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3197' href='#L_CALLS_3197'><pre>3197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val0.convert(HalfSem, APFloat::rmTowardZero, &LosesInfo);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3198' href='#L_CALLS_3198'><pre>3198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val1.convert(HalfSem, APFloat::rmTowardZero, &LosesInfo);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3199' href='#L_CALLS_3199'><pre>3199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3200' href='#L_CALLS_3200'><pre>3200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Folded = ConstantVector::get({</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3201' href='#L_CALLS_3201'><pre>3201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP::get(II->getContext(), Val0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3202' href='#L_CALLS_3202'><pre>3202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP::get(II->getContext(), Val1) });</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3203' href='#L_CALLS_3203'><pre>3203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, Folded);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3204' href='#L_CALLS_3204'><pre>3204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3205' href='#L_CALLS_3205'><pre>3205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3206' href='#L_CALLS_3206'><pre>3206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3207' href='#L_CALLS_3207'><pre>3207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Src0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Src1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3208' href='#L_CALLS_3208'><pre>3208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, UndefValue::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3209' href='#L_CALLS_3209'><pre>3209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3210' href='#L_CALLS_3210'><pre>3210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3211' href='#L_CALLS_3211'><pre>3211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3212' href='#L_CALLS_3212'><pre>3212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_ubfe:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3213' href='#L_CALLS_3213'><pre>3213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_sbfe: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3214' href='#L_CALLS_3214'><pre>3214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Decompose simple cases into standard shifts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3215' href='#L_CALLS_3215'><pre>3215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3216' href='#L_CALLS_3216'><pre>3216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<UndefValue>(Src)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3217' href='#L_CALLS_3217'><pre>3217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, Src)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3218' href='#L_CALLS_3218'><pre>3218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3219' href='#L_CALLS_3219'><pre>3219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned Width;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3220' href='#L_CALLS_3220'><pre>3220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Ty = II->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3221' href='#L_CALLS_3221'><pre>3221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned IntSize = Ty->getIntegerBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3222' href='#L_CALLS_3222'><pre>3222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3223' href='#L_CALLS_3223'><pre>3223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CWidth = dyn_cast<ConstantInt>(II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3224' href='#L_CALLS_3224'><pre>3224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CWidth</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3225' href='#L_CALLS_3225'><pre>3225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Width = CWidth->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3226' href='#L_CALLS_3226'><pre>3226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>(Width & (IntSize - 1)) == 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3227' href='#L_CALLS_3227'><pre>3227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantInt::getNullValue(Ty))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3228' href='#L_CALLS_3228'><pre>3228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3229' href='#L_CALLS_3229'><pre>3229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Width >= IntSize</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3230' href='#L_CALLS_3230'><pre>3230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Hardware ignores high bits, so remove those.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3231' href='#L_CALLS_3231'><pre>3231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(2, ConstantInt::get(CWidth->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3232' href='#L_CALLS_3232'><pre>3232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Width & (IntSize - 1)));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3233' href='#L_CALLS_3233'><pre>3233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3234' href='#L_CALLS_3234'><pre>3234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3235' href='#L_CALLS_3235'><pre>3235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3236' href='#L_CALLS_3236'><pre>3236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3237' href='#L_CALLS_3237'><pre>3237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned Offset;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3238' href='#L_CALLS_3238'><pre>3238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *COffset = dyn_cast<ConstantInt>(II->getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3239' href='#L_CALLS_3239'><pre>3239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>COffset</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3240' href='#L_CALLS_3240'><pre>3240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset = COffset->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3241' href='#L_CALLS_3241'><pre>3241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Offset >= IntSize</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3242' href='#L_CALLS_3242'><pre>3242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, ConstantInt::get(COffset->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3243' href='#L_CALLS_3243'><pre>3243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset & (IntSize - 1)));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3244' href='#L_CALLS_3244'><pre>3244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3245' href='#L_CALLS_3245'><pre>3245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3246' href='#L_CALLS_3246'><pre>3246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3247' href='#L_CALLS_3247'><pre>3247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3248' href='#L_CALLS_3248'><pre>3248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool Signed = II->getIntrinsicID() == Intrinsic::amdgcn_sbfe;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3249' href='#L_CALLS_3249'><pre>3249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3250' href='#L_CALLS_3250'><pre>3250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Also emit sub if only width is constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3251' href='#L_CALLS_3251'><pre>3251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CWidth && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>COffset</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Offset == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3252' href='#L_CALLS_3252'><pre>3252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *KSize = ConstantInt::get(COffset->getType(), IntSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3253' href='#L_CALLS_3253'><pre>3253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ShiftVal = Builder->CreateSub(KSize, II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3254' href='#L_CALLS_3254'><pre>3254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftVal = Builder->CreateZExt(ShiftVal, II->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3255' href='#L_CALLS_3255'><pre>3255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3256' href='#L_CALLS_3256'><pre>3256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Shl = Builder->CreateShl(Src, ShiftVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3257' href='#L_CALLS_3257'><pre>3257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RightShift = Signed ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3258' href='#L_CALLS_3258'><pre>3258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateAShr(Shl, ShiftVal)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3259' href='#L_CALLS_3259'><pre>3259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateLShr(Shl, ShiftVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3260' href='#L_CALLS_3260'><pre>3260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RightShift->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3261' href='#L_CALLS_3261'><pre>3261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, RightShift);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3262' href='#L_CALLS_3262'><pre>3262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3263' href='#L_CALLS_3263'><pre>3263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3264' href='#L_CALLS_3264'><pre>3264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CWidth || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!COffset</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3265' href='#L_CALLS_3265'><pre>3265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3266' href='#L_CALLS_3266'><pre>3266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3267' href='#L_CALLS_3267'><pre>3267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: This allows folding to undef when the hardware has specific</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3268' href='#L_CALLS_3268'><pre>3268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // behavior?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3269' href='#L_CALLS_3269'><pre>3269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Offset + Width < IntSize</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3270' href='#L_CALLS_3270'><pre>3270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Shl = Builder->CreateShl(Src, IntSize - Offset - Width);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3271' href='#L_CALLS_3271'><pre>3271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RightShift = Signed ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3272' href='#L_CALLS_3272'><pre>3272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateAShr(Shl, IntSize - Width)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3273' href='#L_CALLS_3273'><pre>3273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateLShr(Shl, IntSize - Width)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3274' href='#L_CALLS_3274'><pre>3274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RightShift->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3275' href='#L_CALLS_3275'><pre>3275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, RightShift);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3276' href='#L_CALLS_3276'><pre>3276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3277' href='#L_CALLS_3277'><pre>3277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3278' href='#L_CALLS_3278'><pre>3278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *RightShift = Signed ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3279' href='#L_CALLS_3279'><pre>3279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateAShr(Src, Offset)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3280' href='#L_CALLS_3280'><pre>3280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->CreateLShr(Src, Offset)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3281' href='#L_CALLS_3281'><pre>3281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3282' href='#L_CALLS_3282'><pre>3282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RightShift->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3283' href='#L_CALLS_3283'><pre>3283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, RightShift)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3284' href='#L_CALLS_3284'><pre>3284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3285' href='#L_CALLS_3285'><pre>3285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_exp:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3286' href='#L_CALLS_3286'><pre>3286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_exp_compr: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3287' href='#L_CALLS_3287'><pre>3287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *En = dyn_cast<ConstantInt>(II->getArgOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3288' href='#L_CALLS_3288'><pre>3288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!En</span><span class='red'>) // Illegal.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3289' href='#L_CALLS_3289'><pre>3289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3290' href='#L_CALLS_3290'><pre>3290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3291' href='#L_CALLS_3291'><pre>3291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned EnBits = En->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3292' href='#L_CALLS_3292'><pre>3292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>EnBits == 0xf</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3293' href='#L_CALLS_3293'><pre>3293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // All inputs enabled.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3294' href='#L_CALLS_3294'><pre>3294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3295' href='#L_CALLS_3295'><pre>3295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool IsCompr = II->getIntrinsicID() == Intrinsic::amdgcn_exp_compr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3296' href='#L_CALLS_3296'><pre>3296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Changed = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3297' href='#L_CALLS_3297'><pre>3297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int I = 0; </span><div class='tooltip'><span class='red'>I < (IsCompr ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>2</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>4</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3298' href='#L_CALLS_3298'><pre>3298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(!IsCompr && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(EnBits & (1 << I)) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3299' href='#L_CALLS_3299'><pre>3299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(IsCompr && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>((EnBits & (0x3 << (2 * I))) == 0)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3300' href='#L_CALLS_3300'><pre>3300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src = II->getArgOperand(I + 2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3301' href='#L_CALLS_3301'><pre>3301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!isa<UndefValue>(Src)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3302' href='#L_CALLS_3302'><pre>3302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(I + 2, UndefValue::get(Src->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3303' href='#L_CALLS_3303'><pre>3303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Changed = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3304' href='#L_CALLS_3304'><pre>3304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3305' href='#L_CALLS_3305'><pre>3305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3306' href='#L_CALLS_3306'><pre>3306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3307' href='#L_CALLS_3307'><pre>3307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3308' href='#L_CALLS_3308'><pre>3308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Changed</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3309' href='#L_CALLS_3309'><pre>3309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3310' href='#L_CALLS_3310'><pre>3310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3311' href='#L_CALLS_3311'><pre>3311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3312' href='#L_CALLS_3312'><pre>3312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3313' href='#L_CALLS_3313'><pre>3313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3314' href='#L_CALLS_3314'><pre>3314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_fmed3: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3315' href='#L_CALLS_3315'><pre>3315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note this does not preserve proper sNaN behavior if IEEE-mode is enabled</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3316' href='#L_CALLS_3316'><pre>3316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // for the shader.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3317' href='#L_CALLS_3317'><pre>3317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3318' href='#L_CALLS_3318'><pre>3318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3319' href='#L_CALLS_3319'><pre>3319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3320' href='#L_CALLS_3320'><pre>3320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src2 = II->getArgOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3321' href='#L_CALLS_3321'><pre>3321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3322' href='#L_CALLS_3322'><pre>3322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Swap = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3323' href='#L_CALLS_3323'><pre>3323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize constants to RHS operands.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3324' href='#L_CALLS_3324'><pre>3324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3325' href='#L_CALLS_3325'><pre>3325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fmed3(c0, x, c1) -> fmed3(x, c0, c1)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3326' href='#L_CALLS_3326'><pre>3326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<Constant>(Src0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Src1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3327' href='#L_CALLS_3327'><pre>3327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Src0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3328' href='#L_CALLS_3328'><pre>3328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Swap = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3329' href='#L_CALLS_3329'><pre>3329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3330' href='#L_CALLS_3330'><pre>3330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3331' href='#L_CALLS_3331'><pre>3331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<Constant>(Src1) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Src2)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3332' href='#L_CALLS_3332'><pre>3332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Src1, Src2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3333' href='#L_CALLS_3333'><pre>3333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Swap = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3334' href='#L_CALLS_3334'><pre>3334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3335' href='#L_CALLS_3335'><pre>3335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3336' href='#L_CALLS_3336'><pre>3336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<Constant>(Src0) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Src1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3337' href='#L_CALLS_3337'><pre>3337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Src0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3338' href='#L_CALLS_3338'><pre>3338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Swap = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3339' href='#L_CALLS_3339'><pre>3339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3340' href='#L_CALLS_3340'><pre>3340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3341' href='#L_CALLS_3341'><pre>3341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Swap</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3342' href='#L_CALLS_3342'><pre>3342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3343' href='#L_CALLS_3343'><pre>3343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3344' href='#L_CALLS_3344'><pre>3344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(2, Src2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3345' href='#L_CALLS_3345'><pre>3345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3346' href='#L_CALLS_3346'><pre>3346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3347' href='#L_CALLS_3347'><pre>3347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3348' href='#L_CALLS_3348'><pre>3348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Src2, m_NaN()) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Src2)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3349' href='#L_CALLS_3349'><pre>3349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewCall = Builder->CreateMinNum(Src0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3350' href='#L_CALLS_3350'><pre>3350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->copyFastMathFlags(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3351' href='#L_CALLS_3351'><pre>3351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3352' href='#L_CALLS_3352'><pre>3352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, NewCall);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3353' href='#L_CALLS_3353'><pre>3353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3354' href='#L_CALLS_3354'><pre>3354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3355' href='#L_CALLS_3355'><pre>3355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (const ConstantFP *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C0</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src0)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3356' href='#L_CALLS_3356'><pre>3356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C1</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3357' href='#L_CALLS_3357'><pre>3357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (const ConstantFP *</span><div class='tooltip'><span class='red'>C2</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantFP>(Src2)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3358' href='#L_CALLS_3358'><pre>3358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat Result = fmed3AMDGCN(C0->getValueAPF(), C1->getValueAPF(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3359' href='#L_CALLS_3359'><pre>3359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C2->getValueAPF());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3360' href='#L_CALLS_3360'><pre>3360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3361' href='#L_CALLS_3361'><pre>3361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP::get(Builder->getContext(), Result));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3362' href='#L_CALLS_3362'><pre>3362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3363' href='#L_CALLS_3363'><pre>3363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3364' href='#L_CALLS_3364'><pre>3364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3365' href='#L_CALLS_3365'><pre>3365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3366' href='#L_CALLS_3366'><pre>3366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3367' href='#L_CALLS_3367'><pre>3367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3368' href='#L_CALLS_3368'><pre>3368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_icmp:</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3369' href='#L_CALLS_3369'><pre>3369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_fcmp: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3370' href='#L_CALLS_3370'><pre>3370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const ConstantInt *CC = dyn_cast<ConstantInt>(II->getArgOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3371' href='#L_CALLS_3371'><pre>3371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CC</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3372' href='#L_CALLS_3372'><pre>3372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3373' href='#L_CALLS_3373'><pre>3373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3374' href='#L_CALLS_3374'><pre>3374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Guard against invalid arguments.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3375' href='#L_CALLS_3375'><pre>3375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>int64_t CCVal = CC->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3376' href='#L_CALLS_3376'><pre>3376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool IsInteger = II->getIntrinsicID() == Intrinsic::amdgcn_icmp;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3377' href='#L_CALLS_3377'><pre>3377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(IsInteger && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(CCVal < CmpInst::FIRST_ICMP_PREDICATE ||</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3378' href='#L_CALLS_3378'><pre>3378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>CCVal > CmpInst::LAST_ICMP_PREDICATE</span><span class='red'>)</span><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3379' href='#L_CALLS_3379'><pre>3379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(!IsInteger && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(CCVal < CmpInst::FIRST_FCMP_PREDICATE ||</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3380' href='#L_CALLS_3380'><pre>3380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>CCVal > CmpInst::LAST_FCMP_PREDICATE</span><span class='red'>)</span><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3381' href='#L_CALLS_3381'><pre>3381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3382' href='#L_CALLS_3382'><pre>3382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3383' href='#L_CALLS_3383'><pre>3383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Src0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3384' href='#L_CALLS_3384'><pre>3384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3385' href='#L_CALLS_3385'><pre>3385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3386' href='#L_CALLS_3386'><pre>3386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>CSrc0</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Src0)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3387' href='#L_CALLS_3387'><pre>3387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>CSrc1</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(Src1)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3388' href='#L_CALLS_3388'><pre>3388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *CCmp = ConstantExpr::getCompare(CCVal, CSrc0, CSrc1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3389' href='#L_CALLS_3389'><pre>3389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3390' href='#L_CALLS_3390'><pre>3390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantExpr::getSExt(CCmp, II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3391' href='#L_CALLS_3391'><pre>3391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3392' href='#L_CALLS_3392'><pre>3392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3393' href='#L_CALLS_3393'><pre>3393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize constants to RHS.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3394' href='#L_CALLS_3394'><pre>3394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>CmpInst::Predicate SwapPred</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3395' href='#L_CALLS_3395'><pre>3395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> = CmpInst::getSwappedPredicate(static_cast<CmpInst::Predicate>(CCVal));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3396' href='#L_CALLS_3396'><pre>3396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(0, Src1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3397' href='#L_CALLS_3397'><pre>3397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, Src0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3398' href='#L_CALLS_3398'><pre>3398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(2, ConstantInt::get(CC->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3399' href='#L_CALLS_3399'><pre>3399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> static_cast<int>(SwapPred)));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3400' href='#L_CALLS_3400'><pre>3400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3401' href='#L_CALLS_3401'><pre>3401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3402' href='#L_CALLS_3402'><pre>3402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3403' href='#L_CALLS_3403'><pre>3403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CCVal != CmpInst::ICMP_EQ && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CCVal != CmpInst::ICMP_NE</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3404' href='#L_CALLS_3404'><pre>3404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3405' href='#L_CALLS_3405'><pre>3405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3406' href='#L_CALLS_3406'><pre>3406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize compare eq with true value to compare != 0</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3407' href='#L_CALLS_3407'><pre>3407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // llvm.amdgcn.icmp(zext (i1 x), 1, eq)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3408' href='#L_CALLS_3408'><pre>3408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> llvm.amdgcn.icmp(zext (i1 x), 0, ne)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3409' href='#L_CALLS_3409'><pre>3409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // llvm.amdgcn.icmp(sext (i1 x), -1, eq)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3410' href='#L_CALLS_3410'><pre>3410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> llvm.amdgcn.icmp(sext (i1 x), 0, ne)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3411' href='#L_CALLS_3411'><pre>3411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *ExtSrc;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3412' href='#L_CALLS_3412'><pre>3412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>CCVal == CmpInst::ICMP_EQ &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3413' href='#L_CALLS_3413'><pre>3413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>((match(Src1, m_One()) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Src0, m_ZExt(m_Value(ExtSrc)))</span><span class='tooltip-content'>0</span></div><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3414' href='#L_CALLS_3414'><pre>3414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(match(Src1, m_AllOnes()) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Src0, m_SExt(m_Value(ExtSrc)))</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3415' href='#L_CALLS_3415'><pre>3415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>ExtSrc->getType()->isIntegerTy(1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3416' href='#L_CALLS_3416'><pre>3416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(1, ConstantInt::getNullValue(Src1->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3417' href='#L_CALLS_3417'><pre>3417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(2, ConstantInt::get(CC->getType(), CmpInst::ICMP_NE));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3418' href='#L_CALLS_3418'><pre>3418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3419' href='#L_CALLS_3419'><pre>3419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3420' href='#L_CALLS_3420'><pre>3420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3421' href='#L_CALLS_3421'><pre>3421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>CmpInst::Predicate SrcPred;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3422' href='#L_CALLS_3422'><pre>3422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SrcLHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3423' href='#L_CALLS_3423'><pre>3423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *SrcRHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3424' href='#L_CALLS_3424'><pre>3424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3425' href='#L_CALLS_3425'><pre>3425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Fold compare eq/ne with 0 from a compare result as the predicate to the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3426' href='#L_CALLS_3426'><pre>3426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // intrinsic. The typical use is a wave vote function in the library, which</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3427' href='#L_CALLS_3427'><pre>3427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // will be fed from a user code condition compared with 0. Fold in the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3428' href='#L_CALLS_3428'><pre>3428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // redundant compare.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3429' href='#L_CALLS_3429'><pre>3429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3430' href='#L_CALLS_3430'><pre>3430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // llvm.amdgcn.icmp([sz]ext ([if]cmp pred a, b), 0, ne)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3431' href='#L_CALLS_3431'><pre>3431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> llvm.amdgcn.[if]cmp(a, b, pred)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3432' href='#L_CALLS_3432'><pre>3432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3433' href='#L_CALLS_3433'><pre>3433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // llvm.amdgcn.icmp([sz]ext ([if]cmp pred a, b), 0, eq)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3434' href='#L_CALLS_3434'><pre>3434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> llvm.amdgcn.[if]cmp(a, b, inv pred)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3435' href='#L_CALLS_3435'><pre>3435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(Src1, m_Zero()) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3436' href='#L_CALLS_3436'><pre>3436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>match(Src0,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3437' href='#L_CALLS_3437'><pre>3437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> m_ZExtOrSExt(m_Cmp(SrcPred, m_Value(SrcLHS), m_Value(SrcRHS))))</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3438' href='#L_CALLS_3438'><pre>3438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>CCVal == CmpInst::ICMP_EQ</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3439' href='#L_CALLS_3439'><pre>3439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SrcPred = CmpInst::getInversePredicate(SrcPred)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3440' href='#L_CALLS_3440'><pre>3440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3441' href='#L_CALLS_3441'><pre>3441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Intrinsic::ID NewIID = CmpInst::isFPPredicate(SrcPred) ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3442' href='#L_CALLS_3442'><pre>3442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>Intrinsic::amdgcn_fcmp</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Intrinsic::amdgcn_icmp</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3443' href='#L_CALLS_3443'><pre>3443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3444' href='#L_CALLS_3444'><pre>3444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewF = Intrinsic::getDeclaration(II->getModule(), NewIID,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3445' href='#L_CALLS_3445'><pre>3445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SrcLHS->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3446' href='#L_CALLS_3446'><pre>3446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Args[] = { SrcLHS, SrcRHS,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3447' href='#L_CALLS_3447'><pre>3447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(CC->getType(), SrcPred) };</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3448' href='#L_CALLS_3448'><pre>3448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewCall = Builder->CreateCall(NewF, Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3449' href='#L_CALLS_3449'><pre>3449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3450' href='#L_CALLS_3450'><pre>3450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(*II, NewCall);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3451' href='#L_CALLS_3451'><pre>3451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3452' href='#L_CALLS_3452'><pre>3452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3453' href='#L_CALLS_3453'><pre>3453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3454' href='#L_CALLS_3454'><pre>3454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3455' href='#L_CALLS_3455'><pre>3455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::stackrestore: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3456' href='#L_CALLS_3456'><pre>3456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the save is right next to the restore, remove the restore. This can</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3457' href='#L_CALLS_3457'><pre>3457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // happen when variable allocas are DCE'd.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3458' href='#L_CALLS_3458'><pre>3458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (IntrinsicInst *</span><div class='tooltip'><span class='red'>SS</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<IntrinsicInst>(II->getArgOperand(0))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3459' href='#L_CALLS_3459'><pre>3459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SS->getIntrinsicID() == Intrinsic::stacksave</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3460' href='#L_CALLS_3460'><pre>3460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>&*++SS->getIterator() == II</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3461' href='#L_CALLS_3461'><pre>3461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(CI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3462' href='#L_CALLS_3462'><pre>3462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3463' href='#L_CALLS_3463'><pre>3463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3464' href='#L_CALLS_3464'><pre>3464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3465' href='#L_CALLS_3465'><pre>3465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Scan down this block to see if there is another stack restore in the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3466' href='#L_CALLS_3466'><pre>3466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // same block without an intervening call/alloca.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3467' href='#L_CALLS_3467'><pre>3467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>BasicBlock::iterator BI(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3468' href='#L_CALLS_3468'><pre>3468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TerminatorInst *TI = II->getParent()->getTerminator();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3469' href='#L_CALLS_3469'><pre>3469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool CannotRemove = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3470' href='#L_CALLS_3470'><pre>3470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (++BI; </span><div class='tooltip'><span class='red'>&*BI != TI</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++BI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3471' href='#L_CALLS_3471'><pre>3471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<AllocaInst>(BI)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3472' href='#L_CALLS_3472'><pre>3472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CannotRemove = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3473' href='#L_CALLS_3473'><pre>3473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3474' href='#L_CALLS_3474'><pre>3474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3475' href='#L_CALLS_3475'><pre>3475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (CallInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>BCI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<CallInst>(BI)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3476' href='#L_CALLS_3476'><pre>3476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (IntrinsicInst *</span><div class='tooltip'><span class='red'>II</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<IntrinsicInst>(BCI)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3477' href='#L_CALLS_3477'><pre>3477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If there is a stackrestore below this one, remove this one.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3478' href='#L_CALLS_3478'><pre>3478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>II->getIntrinsicID() == Intrinsic::stackrestore</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3479' href='#L_CALLS_3479'><pre>3479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(CI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3480' href='#L_CALLS_3480'><pre>3480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3481' href='#L_CALLS_3481'><pre>3481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Bail if we cross over an intrinsic with side effects, such as</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3482' href='#L_CALLS_3482'><pre>3482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // llvm.stacksave, llvm.read_register, or llvm.setjmp.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3483' href='#L_CALLS_3483'><pre>3483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->mayHaveSideEffects()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3484' href='#L_CALLS_3484'><pre>3484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CannotRemove = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3485' href='#L_CALLS_3485'><pre>3485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3486' href='#L_CALLS_3486'><pre>3486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3487' href='#L_CALLS_3487'><pre>3487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3488' href='#L_CALLS_3488'><pre>3488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we found a non-intrinsic call, we can't remove the stack</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3489' href='#L_CALLS_3489'><pre>3489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // restore.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3490' href='#L_CALLS_3490'><pre>3490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CannotRemove = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3491' href='#L_CALLS_3491'><pre>3491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3492' href='#L_CALLS_3492'><pre>3492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3493' href='#L_CALLS_3493'><pre>3493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3494' href='#L_CALLS_3494'><pre>3494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3495' href='#L_CALLS_3495'><pre>3495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3496' href='#L_CALLS_3496'><pre>3496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the stack restore is in a return, resume, or unwind block and if there</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3497' href='#L_CALLS_3497'><pre>3497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // are no allocas or calls between the restore and the return, nuke the</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3498' href='#L_CALLS_3498'><pre>3498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // restore.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3499' href='#L_CALLS_3499'><pre>3499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CannotRemove && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(isa<ReturnInst>(TI) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ResumeInst>(TI)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3500' href='#L_CALLS_3500'><pre>3500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(CI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3501' href='#L_CALLS_3501'><pre>3501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3502' href='#L_CALLS_3502'><pre>3502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3503' href='#L_CALLS_3503'><pre>3503</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre><span class='red'> </span>case Intrinsic::lifetime_start:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3504' href='#L_CALLS_3504'><pre>3504</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // Asan needs to poison memory to detect invalid access which is possible</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3505' href='#L_CALLS_3505'><pre>3505</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> // even for empty lifetime range.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3506' href='#L_CALLS_3506'><pre>3506</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> if (II->getFunction()->hasFnAttribute(Attribute::SanitizeAddress))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3507' href='#L_CALLS_3507'><pre>3507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3508' href='#L_CALLS_3508'><pre>3508</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3509' href='#L_CALLS_3509'><pre>3509</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>155k</span></div><div class='tooltip'>removeTriviallyEmptyRange(*II, Intrinsic::lifetime_start,<span class='tooltip-content'>155k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3510' href='#L_CALLS_3510'><pre>3510</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> Intrinsic::lifetime_end, *this))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3511' href='#L_CALLS_3511'><pre>3511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3512' href='#L_CALLS_3512'><pre>3512</pre></a></td><td class='covered-line'><pre>155k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3513' href='#L_CALLS_3513'><pre>3513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::assume: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3514' href='#L_CALLS_3514'><pre>3514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *IIOperand = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3515' href='#L_CALLS_3515'><pre>3515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Remove an assume if it is immediately followed by an identical assume.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3516' href='#L_CALLS_3516'><pre>3516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(II->getNextNode(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3517' href='#L_CALLS_3517'><pre>3517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> m_Intrinsic<Intrinsic::assume>(m_Specific(IIOperand)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3518' href='#L_CALLS_3518'><pre>3518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(CI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3519' href='#L_CALLS_3519'><pre>3519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3520' href='#L_CALLS_3520'><pre>3520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize assume(a && b) -> assume(a); assume(b);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3521' href='#L_CALLS_3521'><pre>3521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note: New assumption intrinsics created here are registered by</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3522' href='#L_CALLS_3522'><pre>3522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the InstCombineIRInserter object.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3523' href='#L_CALLS_3523'><pre>3523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *AssumeIntrinsic = II->getCalledValue(), *A, *B;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3524' href='#L_CALLS_3524'><pre>3524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>match(IIOperand, m_And(m_Value(A), m_Value(B)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3525' href='#L_CALLS_3525'><pre>3525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateCall(AssumeIntrinsic, A, II->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3526' href='#L_CALLS_3526'><pre>3526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateCall(AssumeIntrinsic, B, II->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3527' href='#L_CALLS_3527'><pre>3527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return eraseInstFromFunction(*II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3528' href='#L_CALLS_3528'><pre>3528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3529' href='#L_CALLS_3529'><pre>3529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // assume(!(a || b)) -> assume(!a); assume(!b);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3530' href='#L_CALLS_3530'><pre>3530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(IIOperand, m_Not(m_Or(m_Value(A), m_Value(B))))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3531' href='#L_CALLS_3531'><pre>3531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateCall(AssumeIntrinsic, Builder->CreateNot(A),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3532' href='#L_CALLS_3532'><pre>3532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3533' href='#L_CALLS_3533'><pre>3533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateCall(AssumeIntrinsic, Builder->CreateNot(B),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3534' href='#L_CALLS_3534'><pre>3534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3535' href='#L_CALLS_3535'><pre>3535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return eraseInstFromFunction(*II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3536' href='#L_CALLS_3536'><pre>3536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3537' href='#L_CALLS_3537'><pre>3537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3538' href='#L_CALLS_3538'><pre>3538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // assume( (load addr) != null ) -> add 'nonnull' metadata to load</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3539' href='#L_CALLS_3539'><pre>3539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (if assume is valid at the load)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3540' href='#L_CALLS_3540'><pre>3540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>CmpInst::Predicate Pred;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3541' href='#L_CALLS_3541'><pre>3541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *LHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3542' href='#L_CALLS_3542'><pre>3542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(IIOperand, m_ICmp(Pred, m_Instruction(LHS), m_Zero())) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3543' href='#L_CALLS_3543'><pre>3543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_NE</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>LHS->getOpcode() == Instruction::Load</span><span class='tooltip-content'>0</span></div><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3544' href='#L_CALLS_3544'><pre>3544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LHS->getType()->isPointerTy()</span><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3545' href='#L_CALLS_3545'><pre>3545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>isValidAssumeForContext(II, LHS, &DT)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3546' href='#L_CALLS_3546'><pre>3546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MDNode *MD = MDNode::get(II->getContext(), None);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3547' href='#L_CALLS_3547'><pre>3547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LHS->setMetadata(LLVMContext::MD_nonnull, MD);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3548' href='#L_CALLS_3548'><pre>3548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return eraseInstFromFunction(*II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3549' href='#L_CALLS_3549'><pre>3549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3550' href='#L_CALLS_3550'><pre>3550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: apply nonnull return attributes to calls and invokes</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3551' href='#L_CALLS_3551'><pre>3551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: apply range metadata for range check patterns?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3552' href='#L_CALLS_3552'><pre>3552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3553' href='#L_CALLS_3553'><pre>3553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3554' href='#L_CALLS_3554'><pre>3554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If there is a dominating assume with the same condition as this one,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3555' href='#L_CALLS_3555'><pre>3555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // then this one is redundant, and should be removed.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3556' href='#L_CALLS_3556'><pre>3556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>APInt KnownZero(1, 0), KnownOne(1, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3557' href='#L_CALLS_3557'><pre>3557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> computeKnownBits(IIOperand, KnownZero, KnownOne, 0, II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3558' href='#L_CALLS_3558'><pre>3558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>KnownOne.isAllOnesValue()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3559' href='#L_CALLS_3559'><pre>3559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(*II)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3560' href='#L_CALLS_3560'><pre>3560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3561' href='#L_CALLS_3561'><pre>3561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Update the cache of affected values for this assumption (we might be</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3562' href='#L_CALLS_3562'><pre>3562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // here because we just simplified the condition).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3563' href='#L_CALLS_3563'><pre>3563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AC.updateAffectedValues(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3564' href='#L_CALLS_3564'><pre>3564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3565' href='#L_CALLS_3565'><pre>3565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3566' href='#L_CALLS_3566'><pre>3566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::experimental_gc_relocate: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3567' href='#L_CALLS_3567'><pre>3567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Translate facts known about a pointer before relocating into</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3568' href='#L_CALLS_3568'><pre>3568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // facts about the relocate value, while being careful to</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3569' href='#L_CALLS_3569'><pre>3569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // preserve relocation semantics.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3570' href='#L_CALLS_3570'><pre>3570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *DerivedPtr = cast<GCRelocateInst>(II)->getDerivedPtr();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3571' href='#L_CALLS_3571'><pre>3571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3572' href='#L_CALLS_3572'><pre>3572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Remove the relocation if unused, note that this check is required</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3573' href='#L_CALLS_3573'><pre>3573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to prevent the cases below from looping forever.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3574' href='#L_CALLS_3574'><pre>3574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>II->use_empty()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3575' href='#L_CALLS_3575'><pre>3575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(*II)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3576' href='#L_CALLS_3576'><pre>3576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3577' href='#L_CALLS_3577'><pre>3577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Undef is undef, even after relocation.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3578' href='#L_CALLS_3578'><pre>3578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: provide a hook for this in GCStrategy. This is clearly legal for</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3579' href='#L_CALLS_3579'><pre>3579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // most practical collectors, but there was discussion in the review thread</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3580' href='#L_CALLS_3580'><pre>3580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // about whether it was legal for all possible collectors.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3581' href='#L_CALLS_3581'><pre>3581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(DerivedPtr)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3582' href='#L_CALLS_3582'><pre>3582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Use undef of gc_relocate's type to replace it.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3583' href='#L_CALLS_3583'><pre>3583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, UndefValue::get(II->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3584' href='#L_CALLS_3584'><pre>3584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3585' href='#L_CALLS_3585'><pre>3585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<PointerType>(II->getType())) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3586' href='#L_CALLS_3586'><pre>3586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The relocation of null will be null for most any collector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3587' href='#L_CALLS_3587'><pre>3587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: provide a hook for this in GCStrategy. There might be some</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3588' href='#L_CALLS_3588'><pre>3588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // weird collector this property does not hold for.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3589' href='#L_CALLS_3589'><pre>3589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<ConstantPointerNull>(DerivedPtr)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3590' href='#L_CALLS_3590'><pre>3590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Use null-pointer of gc_relocate's type to replace it.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3591' href='#L_CALLS_3591'><pre>3591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(*II, ConstantPointerNull::get(PT))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3592' href='#L_CALLS_3592'><pre>3592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3593' href='#L_CALLS_3593'><pre>3593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // isKnownNonNull -> nonnull attribute</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3594' href='#L_CALLS_3594'><pre>3594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isKnownNonNullAt(DerivedPtr, II, &DT)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3595' href='#L_CALLS_3595'><pre>3595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->addAttribute(AttributeSet::ReturnIndex, Attribute::NonNull)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3596' href='#L_CALLS_3596'><pre>3596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3597' href='#L_CALLS_3597'><pre>3597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3598' href='#L_CALLS_3598'><pre>3598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: bitcast(relocate(p)) -> relocate(bitcast(p))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3599' href='#L_CALLS_3599'><pre>3599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Canonicalize on the type from the uses to the defs</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3600' href='#L_CALLS_3600'><pre>3600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3601' href='#L_CALLS_3601'><pre>3601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: relocate((gep p, C, C2, ...)) -> gep(relocate(p), C, C2, ...)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3602' href='#L_CALLS_3602'><pre>3602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3603' href='#L_CALLS_3603'><pre>3603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3604' href='#L_CALLS_3604'><pre>3604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3605' href='#L_CALLS_3605'><pre>3605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::experimental_guard: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3606' href='#L_CALLS_3606'><pre>3606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Is this guard followed by another guard?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3607' href='#L_CALLS_3607'><pre>3607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NextInst = II->getNextNode();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3608' href='#L_CALLS_3608'><pre>3608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NextCond = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3609' href='#L_CALLS_3609'><pre>3609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(NextInst,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3610' href='#L_CALLS_3610'><pre>3610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> m_Intrinsic<Intrinsic::experimental_guard>(m_Value(NextCond)))</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3611' href='#L_CALLS_3611'><pre>3611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CurrCond = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3612' href='#L_CALLS_3612'><pre>3612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3613' href='#L_CALLS_3613'><pre>3613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Remove a guard that it is immediately preceeded by an identical guard.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3614' href='#L_CALLS_3614'><pre>3614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>CurrCond == NextCond</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3615' href='#L_CALLS_3615'><pre>3615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(*NextInst)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3616' href='#L_CALLS_3616'><pre>3616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3617' href='#L_CALLS_3617'><pre>3617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise canonicalize guard(a); guard(b) -> guard(a & b).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3618' href='#L_CALLS_3618'><pre>3618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->setArgOperand(0, Builder->CreateAnd(CurrCond, NextCond));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3619' href='#L_CALLS_3619'><pre>3619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return eraseInstFromFunction(*NextInst)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3620' href='#L_CALLS_3620'><pre>3620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3621' href='#L_CALLS_3621'><pre>3621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3622' href='#L_CALLS_3622'><pre>3622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3623' href='#L_CALLS_3623'><pre>3623</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3624' href='#L_CALLS_3624'><pre>3624</pre></a></td><td class='covered-line'><pre>439k</pre></td><td class='code'><pre> return visitCallSite(II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3625' href='#L_CALLS_3625'><pre>3625</pre></a></td><td class='covered-line'><pre>451k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3626' href='#L_CALLS_3626'><pre>3626</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3627' href='#L_CALLS_3627'><pre>3627</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Fence instruction simplification</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3628' href='#L_CALLS_3628'><pre>3628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFenceInst(FenceInst &FI) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3629' href='#L_CALLS_3629'><pre>3629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Remove identical consecutive fences.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3630' href='#L_CALLS_3630'><pre>3630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><span class='red'>NFI</span><span class='red'> = dyn_cast<FenceInst>(FI.getNextNode()))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3631' href='#L_CALLS_3631'><pre>3631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>FI.isIdenticalTo(NFI)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3632' href='#L_CALLS_3632'><pre>3632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(FI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3633' href='#L_CALLS_3633'><pre>3633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3634' href='#L_CALLS_3634'><pre>3634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3635' href='#L_CALLS_3635'><pre>3635</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3636' href='#L_CALLS_3636'><pre>3636</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// InvokeInst simplification</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3637' href='#L_CALLS_3637'><pre>3637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3638' href='#L_CALLS_3638'><pre>3638</pre></a></td><td class='covered-line'><pre>146k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitInvokeInst(InvokeInst &II) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3639' href='#L_CALLS_3639'><pre>3639</pre></a></td><td class='covered-line'><pre>146k</pre></td><td class='code'><pre> return visitCallSite(&II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3640' href='#L_CALLS_3640'><pre>3640</pre></a></td><td class='covered-line'><pre>146k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3641' href='#L_CALLS_3641'><pre>3641</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3642' href='#L_CALLS_3642'><pre>3642</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If this cast does not affect the value passed through the varargs area, we</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3643' href='#L_CALLS_3643'><pre>3643</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// can eliminate the use of the cast.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3644' href='#L_CALLS_3644'><pre>3644</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool isSafeToEliminateVarargsCast(const CallSite CS,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3645' href='#L_CALLS_3645'><pre>3645</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DataLayout &DL,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3646' href='#L_CALLS_3646'><pre>3646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const CastInst *const CI,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3647' href='#L_CALLS_3647'><pre>3647</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> const int ix) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3648' href='#L_CALLS_3648'><pre>3648</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> if (!CI->isLosslessCast())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3649' href='#L_CALLS_3649'><pre>3649</pre></a></td><td class='covered-line'><pre>9.62k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3650' href='#L_CALLS_3650'><pre>3650</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3651' href='#L_CALLS_3651'><pre>3651</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> // If this is a GC intrinsic, avoid munging types. We need types for</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3652' href='#L_CALLS_3652'><pre>3652</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> // statepoint reconstruction in SelectionDAG.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3653' href='#L_CALLS_3653'><pre>3653</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> // TODO: This is probably something which should be expanded to all</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3654' href='#L_CALLS_3654'><pre>3654</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> // intrinsics since the entire point of intrinsics is that</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3655' href='#L_CALLS_3655'><pre>3655</pre></a></td><td class='covered-line'><pre>9.72k</pre></td><td class='code'><pre> // they are understandable by the optimizer.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3656' href='#L_CALLS_3656'><pre>3656</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>96</span></div><div class='tooltip'>isStatepoint(CS) || <span class='tooltip-content'>96</span></div><div class='tooltip'>isGCRelocate(CS)<span class='tooltip-content'>96</span></div> || <div class='tooltip'>isGCResult(CS)<span class='tooltip-content'>96</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3657' href='#L_CALLS_3657'><pre>3657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3658' href='#L_CALLS_3658'><pre>3658</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3659' href='#L_CALLS_3659'><pre>3659</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> // The size of ByVal or InAlloca arguments is derived from the type, so we</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3660' href='#L_CALLS_3660'><pre>3660</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> // can't change to a type with a different size. If the size were</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3661' href='#L_CALLS_3661'><pre>3661</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> // passed explicitly we could avoid this check.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3662' href='#L_CALLS_3662'><pre>3662</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>96</span></div><div class='tooltip'>!CS.isByValOrInAllocaArgument(ix)<span class='tooltip-content'>96</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3663' href='#L_CALLS_3663'><pre>3663</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3664' href='#L_CALLS_3664'><pre>3664</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3665' href='#L_CALLS_3665'><pre>3665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Type* SrcTy =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3666' href='#L_CALLS_3666'><pre>3666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<PointerType>(CI->getOperand(0)->getType())->getElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3667' href='#L_CALLS_3667'><pre>3667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type* DstTy = cast<PointerType>(CI->getType())->getElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3668' href='#L_CALLS_3668'><pre>3668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!SrcTy->isSized() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!DstTy->isSized()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3669' href='#L_CALLS_3669'><pre>3669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3670' href='#L_CALLS_3670'><pre>3670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DL.getTypeAllocSize(SrcTy) != DL.getTypeAllocSize(DstTy)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3671' href='#L_CALLS_3671'><pre>3671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3672' href='#L_CALLS_3672'><pre>3672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3673' href='#L_CALLS_3673'><pre>3673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3674' href='#L_CALLS_3674'><pre>3674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3675' href='#L_CALLS_3675'><pre>3675</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre>Instruction *InstCombiner::tryOptimizeCall(CallInst *CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3676' href='#L_CALLS_3676'><pre>3676</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> if (<div class='tooltip'>!CI->getCalledFunction()<span class='tooltip-content'>1.61M</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>117k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3677' href='#L_CALLS_3677'><pre>3677</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3678' href='#L_CALLS_3678'><pre>3678</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre> <div class='tooltip'>auto InstCombineRAUW = [this](Instruction *From, Value *With) <span class='tooltip-content'>1.49M</span></div><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3679' href='#L_CALLS_3679'><pre>3679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replaceInstUsesWith(*From, With);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3680' href='#L_CALLS_3680'><pre>3680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3681' href='#L_CALLS_3681'><pre>3681</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre> LibCallSimplifier Simplifier(DL, &TLI, InstCombineRAUW);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3682' href='#L_CALLS_3682'><pre>3682</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>With<span class='tooltip-content'>1.49M</span></div> = Simplifier.optimizeCall(CI)) <div class='tooltip'>{<span class='tooltip-content'>1.20k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3683' href='#L_CALLS_3683'><pre>3683</pre></a></td><td class='covered-line'><pre>1.20k</pre></td><td class='code'><pre> ++NumSimplified;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3684' href='#L_CALLS_3684'><pre>3684</pre></a></td><td class='covered-line'><pre>707</pre></td><td class='code'><pre> return CI->use_empty() ? <div class='tooltip'>CI<span class='tooltip-content'>707</span></div> : <div class='tooltip'>replaceInstUsesWith(*CI, With)<span class='tooltip-content'>502</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3685' href='#L_CALLS_3685'><pre>3685</pre></a></td><td class='covered-line'><pre>1.20k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3686' href='#L_CALLS_3686'><pre>3686</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3687' href='#L_CALLS_3687'><pre>3687</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3688' href='#L_CALLS_3688'><pre>3688</pre></a></td><td class='covered-line'><pre>1.49M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3689' href='#L_CALLS_3689'><pre>3689</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3690' href='#L_CALLS_3690'><pre>3690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static IntrinsicInst *findInitTrampolineFromAlloca(Value *TrampMem) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3691' href='#L_CALLS_3691'><pre>3691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Strip off at most one level of pointer casts, looking for an alloca. This</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3692' href='#L_CALLS_3692'><pre>3692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is good enough in practice and simpler than handling any number of casts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3693' href='#L_CALLS_3693'><pre>3693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Underlying = TrampMem->stripPointerCasts();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3694' href='#L_CALLS_3694'><pre>3694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Underlying != TrampMem &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3695' href='#L_CALLS_3695'><pre>3695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(!Underlying->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Underlying->user_back() != TrampMem</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3696' href='#L_CALLS_3696'><pre>3696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3697' href='#L_CALLS_3697'><pre>3697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<AllocaInst>(Underlying)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3698' href='#L_CALLS_3698'><pre>3698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3699' href='#L_CALLS_3699'><pre>3699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3700' href='#L_CALLS_3700'><pre>3700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IntrinsicInst *InitTrampoline = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3701' href='#L_CALLS_3701'><pre>3701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (User *U : TrampMem->users()) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3702' href='#L_CALLS_3702'><pre>3702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntrinsicInst *II = dyn_cast<IntrinsicInst>(U);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3703' href='#L_CALLS_3703'><pre>3703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!II</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3704' href='#L_CALLS_3704'><pre>3704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3705' href='#L_CALLS_3705'><pre>3705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::init_trampoline</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3706' href='#L_CALLS_3706'><pre>3706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>InitTrampoline</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3707' href='#L_CALLS_3707'><pre>3707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // More than one init_trampoline writes to this value. Give up.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3708' href='#L_CALLS_3708'><pre>3708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3709' href='#L_CALLS_3709'><pre>3709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InitTrampoline = II;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3710' href='#L_CALLS_3710'><pre>3710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3711' href='#L_CALLS_3711'><pre>3711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3712' href='#L_CALLS_3712'><pre>3712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::adjust_trampoline</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3713' href='#L_CALLS_3713'><pre>3713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Allow any number of calls to adjust.trampoline.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3714' href='#L_CALLS_3714'><pre>3714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3715' href='#L_CALLS_3715'><pre>3715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3716' href='#L_CALLS_3716'><pre>3716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3717' href='#L_CALLS_3717'><pre>3717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3718' href='#L_CALLS_3718'><pre>3718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // No call to init.trampoline found.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3719' href='#L_CALLS_3719'><pre>3719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!InitTrampoline</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3720' href='#L_CALLS_3720'><pre>3720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3721' href='#L_CALLS_3721'><pre>3721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3722' href='#L_CALLS_3722'><pre>3722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that the alloca is being used in the expected way.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3723' href='#L_CALLS_3723'><pre>3723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>InitTrampoline->getOperand(0) != TrampMem</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3724' href='#L_CALLS_3724'><pre>3724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3725' href='#L_CALLS_3725'><pre>3725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3726' href='#L_CALLS_3726'><pre>3726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return InitTrampoline</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3727' href='#L_CALLS_3727'><pre>3727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3728' href='#L_CALLS_3728'><pre>3728</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3729' href='#L_CALLS_3729'><pre>3729</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static IntrinsicInst *findInitTrampolineFromBB(IntrinsicInst *AdjustTramp,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3730' href='#L_CALLS_3730'><pre>3730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *TrampMem) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3731' href='#L_CALLS_3731'><pre>3731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Visit all the previous instructions in the basic block, and try to find a</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3732' href='#L_CALLS_3732'><pre>3732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // init.trampoline which has a direct path to the adjust.trampoline.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3733' href='#L_CALLS_3733'><pre>3733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (BasicBlock::iterator I = AdjustTramp->getIterator(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3734' href='#L_CALLS_3734'><pre>3734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> E = AdjustTramp->getParent()->begin();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3735' href='#L_CALLS_3735'><pre>3735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>;) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3736' href='#L_CALLS_3736'><pre>3736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Inst = &*--I;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3737' href='#L_CALLS_3737'><pre>3737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (IntrinsicInst *</span><span class='red'>II</span><span class='red'> = dyn_cast<IntrinsicInst>(I))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3738' href='#L_CALLS_3738'><pre>3738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::init_trampoline &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3739' href='#L_CALLS_3739'><pre>3739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->getOperand(0) == TrampMem</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3740' href='#L_CALLS_3740'><pre>3740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return II</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3741' href='#L_CALLS_3741'><pre>3741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Inst->mayWriteToMemory()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3742' href='#L_CALLS_3742'><pre>3742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3743' href='#L_CALLS_3743'><pre>3743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3744' href='#L_CALLS_3744'><pre>3744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3745' href='#L_CALLS_3745'><pre>3745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3746' href='#L_CALLS_3746'><pre>3746</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3747' href='#L_CALLS_3747'><pre>3747</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Given a call to llvm.adjust.trampoline, find and return the corresponding</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3748' href='#L_CALLS_3748'><pre>3748</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// call to llvm.init.trampoline if the call to the trampoline can be optimized</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3749' href='#L_CALLS_3749'><pre>3749</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// to a direct call to a function. Otherwise return NULL.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3750' href='#L_CALLS_3750'><pre>3750</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3751' href='#L_CALLS_3751'><pre>3751</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre>static IntrinsicInst *findInitTrampoline(Value *Callee) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3752' href='#L_CALLS_3752'><pre>3752</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> Callee = Callee->stripPointerCasts();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3753' href='#L_CALLS_3753'><pre>3753</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> IntrinsicInst *AdjustTramp = dyn_cast<IntrinsicInst>(Callee);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3754' href='#L_CALLS_3754'><pre>3754</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (!AdjustTramp ||</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3755' href='#L_CALLS_3755'><pre>3755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>AdjustTramp->getIntrinsicID() != Intrinsic::adjust_trampoline</span>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3756' href='#L_CALLS_3756'><pre>3756</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3757' href='#L_CALLS_3757'><pre>3757</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3758' href='#L_CALLS_3758'><pre>3758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *TrampMem = AdjustTramp->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3759' href='#L_CALLS_3759'><pre>3759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3760' href='#L_CALLS_3760'><pre>3760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (IntrinsicInst *</span><span class='red'>IT</span><span class='red'> = findInitTrampolineFromAlloca(TrampMem))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3761' href='#L_CALLS_3761'><pre>3761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IT</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3762' href='#L_CALLS_3762'><pre>3762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (IntrinsicInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IT</span><span class='tooltip-content'>0</span></div><span class='red'> = findInitTrampolineFromBB(AdjustTramp, TrampMem))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3763' href='#L_CALLS_3763'><pre>3763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return IT</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3764' href='#L_CALLS_3764'><pre>3764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3765' href='#L_CALLS_3765'><pre>3765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3766' href='#L_CALLS_3766'><pre>3766</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3767' href='#L_CALLS_3767'><pre>3767</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Improvements for call and invoke instructions.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3768' href='#L_CALLS_3768'><pre>3768</pre></a></td><td class='covered-line'><pre>1.78M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitCallSite(CallSite CS) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3769' href='#L_CALLS_3769'><pre>3769</pre></a></td><td class='covered-line'><pre>1.78M</pre></td><td class='code'><pre> if (isAllocLikeFn(CS.getInstruction(), &TLI))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3770' href='#L_CALLS_3770'><pre>3770</pre></a></td><td class='covered-line'><pre>27.7k</pre></td><td class='code'><pre> return visitAllocSite(*CS.getInstruction());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3771' href='#L_CALLS_3771'><pre>3771</pre></a></td><td class='covered-line'><pre>1.78M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3772' href='#L_CALLS_3772'><pre>3772</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> bool Changed = false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3773' href='#L_CALLS_3773'><pre>3773</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3774' href='#L_CALLS_3774'><pre>3774</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // Mark any parameters that are known to be non-null with the nonnull</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3775' href='#L_CALLS_3775'><pre>3775</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // attribute. This is helpful for inlining calls to functions with null</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3776' href='#L_CALLS_3776'><pre>3776</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // checks on their arguments.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3777' href='#L_CALLS_3777'><pre>3777</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> SmallVector<unsigned, 4> Indices;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3778' href='#L_CALLS_3778'><pre>3778</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> unsigned ArgNo = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3779' href='#L_CALLS_3779'><pre>3779</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3780' href='#L_CALLS_3780'><pre>3780</pre></a></td><td class='covered-line'><pre>3.88M</pre></td><td class='code'><pre> for (Value *V : CS.args()) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3781' href='#L_CALLS_3781'><pre>3781</pre></a></td><td class='covered-line'><pre>3.88M</pre></td><td class='code'><pre> if (V->getType()->isPointerTy() &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3782' href='#L_CALLS_3782'><pre>3782</pre></a></td><td class='covered-line'><pre>2.54M</pre></td><td class='code'><pre> !CS.paramHasAttr(ArgNo + 1, Attribute::NonNull) &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3783' href='#L_CALLS_3783'><pre>3783</pre></a></td><td class='covered-line'><pre>1.57M</pre></td><td class='code'><pre> isKnownNonNullAt(V, CS.getInstruction(), &DT))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3784' href='#L_CALLS_3784'><pre>3784</pre></a></td><td class='covered-line'><pre>88.7k</pre></td><td class='code'><pre> Indices.push_back(ArgNo + 1);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3785' href='#L_CALLS_3785'><pre>3785</pre></a></td><td class='covered-line'><pre>3.88M</pre></td><td class='code'><pre> ArgNo++;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3786' href='#L_CALLS_3786'><pre>3786</pre></a></td><td class='covered-line'><pre>3.88M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3787' href='#L_CALLS_3787'><pre>3787</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3788' href='#L_CALLS_3788'><pre>3788</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> assert(ArgNo == CS.arg_size() && "sanity check");</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3789' href='#L_CALLS_3789'><pre>3789</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3790' href='#L_CALLS_3790'><pre>3790</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (<div class='tooltip'>!Indices.empty()<span class='tooltip-content'>1.75M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>58.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3791' href='#L_CALLS_3791'><pre>3791</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> AttributeSet AS = CS.getAttributes();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3792' href='#L_CALLS_3792'><pre>3792</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> LLVMContext &Ctx = CS.getInstruction()->getContext();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3793' href='#L_CALLS_3793'><pre>3793</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> AS = AS.addAttribute(Ctx, Indices,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3794' href='#L_CALLS_3794'><pre>3794</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> Attribute::get(Ctx, Attribute::NonNull));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3795' href='#L_CALLS_3795'><pre>3795</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> CS.setAttributes(AS);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3796' href='#L_CALLS_3796'><pre>3796</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3797' href='#L_CALLS_3797'><pre>3797</pre></a></td><td class='covered-line'><pre>58.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3798' href='#L_CALLS_3798'><pre>3798</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3799' href='#L_CALLS_3799'><pre>3799</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // If the callee is a pointer to a function, attempt to move any casts to the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3800' href='#L_CALLS_3800'><pre>3800</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // arguments of the call/invoke.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3801' href='#L_CALLS_3801'><pre>3801</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> Value *Callee = CS.getCalledValue();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3802' href='#L_CALLS_3802'><pre>3802</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<Function>(Callee) && <span class='tooltip-content'>1.75M</span></div><div class='tooltip'>transformConstExprCastCall(CS)<span class='tooltip-content'>142k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3803' href='#L_CALLS_3803'><pre>3803</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3804' href='#L_CALLS_3804'><pre>3804</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3805' href='#L_CALLS_3805'><pre>3805</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> <div class='tooltip'>if (Function *<span class='tooltip-content'>1.75M</span></div><div class='tooltip'>CalleeF<span class='tooltip-content'>1.75M</span></div> = dyn_cast<Function>(Callee)) <div class='tooltip'>{<span class='tooltip-content'>1.61M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3806' href='#L_CALLS_3806'><pre>3806</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // Remove the convergent attr on calls when the callee is not convergent.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3807' href='#L_CALLS_3807'><pre>3807</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> if (<div class='tooltip'>CS.isConvergent() && <span class='tooltip-content'>1.61M</span></div><div class='tooltip'><span class='red'>!CalleeF->isConvergent()</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3808' href='#L_CALLS_3808'><pre>3808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>!CalleeF->isIntrinsic()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3809' href='#L_CALLS_3809'><pre>3809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DEBUG</span><span class='red'>(dbgs() << "Removing convergent attr from instr "</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3810' href='#L_CALLS_3810'><pre>3810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> << CS.getInstruction() << "\n");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3811' href='#L_CALLS_3811'><pre>3811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CS.setNotConvergent();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3812' href='#L_CALLS_3812'><pre>3812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CS.getInstruction();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3813' href='#L_CALLS_3813'><pre>3813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3814' href='#L_CALLS_3814'><pre>3814</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3815' href='#L_CALLS_3815'><pre>3815</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // If the call and callee calling conventions don't match, this call must</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3816' href='#L_CALLS_3816'><pre>3816</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // be unreachable, as the call is undefined.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3817' href='#L_CALLS_3817'><pre>3817</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.61M</span></div><div class='tooltip'>CalleeF->getCallingConv() != CS.getCallingConv() &&<span class='tooltip-content'>1.61M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3818' href='#L_CALLS_3818'><pre>3818</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // Only do this for calls to a function with a body. A prototype may</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3819' href='#L_CALLS_3819'><pre>3819</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // not actually end up matching the implementation's calling conv for a</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3820' href='#L_CALLS_3820'><pre>3820</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // variety of reasons (e.g. it may be written in assembly).</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3821' href='#L_CALLS_3821'><pre>3821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>!CalleeF->isDeclaration()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3822' href='#L_CALLS_3822'><pre>3822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *OldCall = CS.getInstruction();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3823' href='#L_CALLS_3823'><pre>3823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> new StoreInst(ConstantInt::getTrue(Callee->getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3824' href='#L_CALLS_3824'><pre>3824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(Type::getInt1PtrTy(Callee->getContext())),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3825' href='#L_CALLS_3825'><pre>3825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OldCall);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3826' href='#L_CALLS_3826'><pre>3826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If OldCall does not return void then replaceAllUsesWith undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3827' href='#L_CALLS_3827'><pre>3827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This allows ValueHandlers and custom metadata to adjust itself.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3828' href='#L_CALLS_3828'><pre>3828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!OldCall->getType()->isVoidTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3829' href='#L_CALLS_3829'><pre>3829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>replaceInstUsesWith(*OldCall, UndefValue::get(OldCall->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3830' href='#L_CALLS_3830'><pre>3830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<CallInst>(OldCall)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3831' href='#L_CALLS_3831'><pre>3831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return eraseInstFromFunction(*OldCall)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3832' href='#L_CALLS_3832'><pre>3832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3833' href='#L_CALLS_3833'><pre>3833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We cannot remove an invoke, because it would change the CFG, just</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3834' href='#L_CALLS_3834'><pre>3834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // change the callee to a null pointer.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3835' href='#L_CALLS_3835'><pre>3835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cast<InvokeInst>(OldCall)->setCalledFunction(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3836' href='#L_CALLS_3836'><pre>3836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(CalleeF->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3837' href='#L_CALLS_3837'><pre>3837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3838' href='#L_CALLS_3838'><pre>3838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3839' href='#L_CALLS_3839'><pre>3839</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3840' href='#L_CALLS_3840'><pre>3840</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3841' href='#L_CALLS_3841'><pre>3841</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.75M</span></div><div class='tooltip'>isa<ConstantPointerNull>(Callee) || <span class='tooltip-content'>1.75M</span></div><div class='tooltip'>isa<UndefValue>(Callee)<span class='tooltip-content'>1.75M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3842' href='#L_CALLS_3842'><pre>3842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If CS does not return void then replaceAllUsesWith undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3843' href='#L_CALLS_3843'><pre>3843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This allows ValueHandlers and custom metadata to adjust itself.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3844' href='#L_CALLS_3844'><pre>3844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CS.getInstruction()->getType()->isVoidTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3845' href='#L_CALLS_3845'><pre>3845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>replaceInstUsesWith(*CS.getInstruction(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3846' href='#L_CALLS_3846'><pre>3846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(CS.getInstruction()->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3847' href='#L_CALLS_3847'><pre>3847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3848' href='#L_CALLS_3848'><pre>3848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<InvokeInst>(CS.getInstruction())</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3849' href='#L_CALLS_3849'><pre>3849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Can't remove an invoke because we cannot change the CFG.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3850' href='#L_CALLS_3850'><pre>3850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3851' href='#L_CALLS_3851'><pre>3851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3852' href='#L_CALLS_3852'><pre>3852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3853' href='#L_CALLS_3853'><pre>3853</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This instruction is not reachable, just remove it. We insert a store to</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3854' href='#L_CALLS_3854'><pre>3854</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // undef so that we know that this code is not reachable, despite the fact</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3855' href='#L_CALLS_3855'><pre>3855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that we can't modify the CFG here.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3856' href='#L_CALLS_3856'><pre>3856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>new StoreInst(ConstantInt::getTrue(Callee->getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3857' href='#L_CALLS_3857'><pre>3857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(Type::getInt1PtrTy(Callee->getContext())),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3858' href='#L_CALLS_3858'><pre>3858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CS.getInstruction());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3859' href='#L_CALLS_3859'><pre>3859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3860' href='#L_CALLS_3860'><pre>3860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return eraseInstFromFunction(*CS.getInstruction())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3861' href='#L_CALLS_3861'><pre>3861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3862' href='#L_CALLS_3862'><pre>3862</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3863' href='#L_CALLS_3863'><pre>3863</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> <div class='tooltip'>if (IntrinsicInst *<span class='tooltip-content'>1.75M</span></div><div class='tooltip'>II<span class='tooltip-content'>1.75M</span></div> = findInitTrampoline(Callee))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3864' href='#L_CALLS_3864'><pre>3864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return transformCallThroughTrampoline(CS, II)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3865' href='#L_CALLS_3865'><pre>3865</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3866' href='#L_CALLS_3866'><pre>3866</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> PointerType *PTy = cast<PointerType>(Callee->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3867' href='#L_CALLS_3867'><pre>3867</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> FunctionType *FTy = cast<FunctionType>(PTy->getElementType());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3868' href='#L_CALLS_3868'><pre>3868</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (<div class='tooltip'>FTy->isVarArg()<span class='tooltip-content'>1.75M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>89.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3869' href='#L_CALLS_3869'><pre>3869</pre></a></td><td class='covered-line'><pre>89.8k</pre></td><td class='code'><pre> int ix = FTy->getNumParams();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3870' href='#L_CALLS_3870'><pre>3870</pre></a></td><td class='covered-line'><pre>89.8k</pre></td><td class='code'><pre> // See if we can optimize any arguments passed through the varargs area of</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3871' href='#L_CALLS_3871'><pre>3871</pre></a></td><td class='covered-line'><pre>89.8k</pre></td><td class='code'><pre> // the call.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3872' href='#L_CALLS_3872'><pre>3872</pre></a></td><td class='covered-line'><pre>89.8k</pre></td><td class='code'><pre> for (CallSite::arg_iterator I = CS.arg_begin() + FTy->getNumParams(),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3873' href='#L_CALLS_3873'><pre>3873</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> E = CS.arg_end(); <div class='tooltip'>I != E<span class='tooltip-content'>186k</span></div>; <div class='tooltip'>++I, ++ix<span class='tooltip-content'>96.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>96.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3874' href='#L_CALLS_3874'><pre>3874</pre></a></td><td class='covered-line'><pre>96.3k</pre></td><td class='code'><pre> CastInst *CI = dyn_cast<CastInst>(*I);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3875' href='#L_CALLS_3875'><pre>3875</pre></a></td><td class='covered-line'><pre>96.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>CI && <span class='tooltip-content'>96.3k</span></div><div class='tooltip'>isSafeToEliminateVarargsCast(CS, DL, CI, ix)<span class='tooltip-content'>9.72k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>96</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3876' href='#L_CALLS_3876'><pre>3876</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> *I = CI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3877' href='#L_CALLS_3877'><pre>3877</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3878' href='#L_CALLS_3878'><pre>3878</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3879' href='#L_CALLS_3879'><pre>3879</pre></a></td><td class='covered-line'><pre>96.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3880' href='#L_CALLS_3880'><pre>3880</pre></a></td><td class='covered-line'><pre>89.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3881' href='#L_CALLS_3881'><pre>3881</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3882' href='#L_CALLS_3882'><pre>3882</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<InlineAsm>(Callee) && <span class='tooltip-content'>1.75M</span></div><div class='tooltip'><span class='red'>!CS.doesNotThrow()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3883' href='#L_CALLS_3883'><pre>3883</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Inline asm calls cannot throw - mark them 'nounwind'.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3884' href='#L_CALLS_3884'><pre>3884</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CS.setDoesNotThrow();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3885' href='#L_CALLS_3885'><pre>3885</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Changed = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3886' href='#L_CALLS_3886'><pre>3886</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3887' href='#L_CALLS_3887'><pre>3887</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3888' href='#L_CALLS_3888'><pre>3888</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // Try to optimize the call if possible, we require DataLayout for most of</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3889' href='#L_CALLS_3889'><pre>3889</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // this. None of these calls are seen as possibly dead so go ahead and</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3890' href='#L_CALLS_3890'><pre>3890</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> // delete the instruction now.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3891' href='#L_CALLS_3891'><pre>3891</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> if (CallInst *<div class='tooltip'>CI<span class='tooltip-content'>1.75M</span></div> = dyn_cast<CallInst>(CS.getInstruction())) <div class='tooltip'>{<span class='tooltip-content'>1.61M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3892' href='#L_CALLS_3892'><pre>3892</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> Instruction *I = tryOptimizeCall(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3893' href='#L_CALLS_3893'><pre>3893</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // If we changed something return the result, etc. Otherwise let</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3894' href='#L_CALLS_3894'><pre>3894</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> // the fallthrough check.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3895' href='#L_CALLS_3895'><pre>3895</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> if (<div class='tooltip'>I<span class='tooltip-content'>1.61M</span></div>) <div class='tooltip'>return eraseInstFromFunction(*I)<span class='tooltip-content'>1.20k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3896' href='#L_CALLS_3896'><pre>3896</pre></a></td><td class='covered-line'><pre>1.61M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3897' href='#L_CALLS_3897'><pre>3897</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3898' href='#L_CALLS_3898'><pre>3898</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>1.75M</span></div><div class='tooltip'>CS.getInstruction()<span class='tooltip-content'>58.9k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>1.69M</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3899' href='#L_CALLS_3899'><pre>3899</pre></a></td><td class='covered-line'><pre>1.75M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3900' href='#L_CALLS_3900'><pre>3900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3901' href='#L_CALLS_3901'><pre>3901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If the callee is a constexpr cast of a function, attempt to move the cast to</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3902' href='#L_CALLS_3902'><pre>3902</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the arguments of the call/invoke.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3903' href='#L_CALLS_3903'><pre>3903</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre>bool InstCombiner::transformConstExprCastCall(CallSite CS) {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3904' href='#L_CALLS_3904'><pre>3904</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> auto *Callee = dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3905' href='#L_CALLS_3905'><pre>3905</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> if (!Callee)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3906' href='#L_CALLS_3906'><pre>3906</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3907' href='#L_CALLS_3907'><pre>3907</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3908' href='#L_CALLS_3908'><pre>3908</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> // The prototype of a thunk is a lie. Don't directly call such a function.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3909' href='#L_CALLS_3909'><pre>3909</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>173</span></div><div class='tooltip'>Callee->hasFnAttribute("thunk")<span class='tooltip-content'>173</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3910' href='#L_CALLS_3910'><pre>3910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3911' href='#L_CALLS_3911'><pre>3911</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3912' href='#L_CALLS_3912'><pre>3912</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> Instruction *Caller = CS.getInstruction();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3913' href='#L_CALLS_3913'><pre>3913</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> const AttributeSet &CallerPAL = CS.getAttributes();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3914' href='#L_CALLS_3914'><pre>3914</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3915' href='#L_CALLS_3915'><pre>3915</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // Okay, this is a cast from a function to a different type. Unless doing so</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3916' href='#L_CALLS_3916'><pre>3916</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // would cause a type conversion of one of our arguments, change this call to</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3917' href='#L_CALLS_3917'><pre>3917</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // be a direct call with arguments casted to the appropriate types.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3918' href='#L_CALLS_3918'><pre>3918</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3919' href='#L_CALLS_3919'><pre>3919</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> FunctionType *FT = Callee->getFunctionType();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3920' href='#L_CALLS_3920'><pre>3920</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> Type *OldRetTy = Caller->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3921' href='#L_CALLS_3921'><pre>3921</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> Type *NewRetTy = FT->getReturnType();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3922' href='#L_CALLS_3922'><pre>3922</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3923' href='#L_CALLS_3923'><pre>3923</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // Check to see if we are changing the return type...</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3924' href='#L_CALLS_3924'><pre>3924</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> if (<div class='tooltip'>OldRetTy != NewRetTy<span class='tooltip-content'>173</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3925' href='#L_CALLS_3925'><pre>3925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3926' href='#L_CALLS_3926'><pre>3926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NewRetTy->isStructTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3927' href='#L_CALLS_3927'><pre>3927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>; // TODO: Handle multiple return values.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3928' href='#L_CALLS_3928'><pre>3928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3929' href='#L_CALLS_3929'><pre>3929</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CastInst::isBitOrNoopPointerCastable(NewRetTy, OldRetTy, DL)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3930' href='#L_CALLS_3930'><pre>3930</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Callee->isDeclaration()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3931' href='#L_CALLS_3931'><pre>3931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>; // Cannot transform this return value.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3932' href='#L_CALLS_3932'><pre>3932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3933' href='#L_CALLS_3933'><pre>3933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!Caller->use_empty() &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3934' href='#L_CALLS_3934'><pre>3934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // void -> non-void is handled specially</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3935' href='#L_CALLS_3935'><pre>3935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!NewRetTy->isVoidTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3936' href='#L_CALLS_3936'><pre>3936</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>; // Cannot transform this return value.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3937' href='#L_CALLS_3937'><pre>3937</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3938' href='#L_CALLS_3938'><pre>3938</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3939' href='#L_CALLS_3939'><pre>3939</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CallerPAL.isEmpty() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!Caller->use_empty()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3940' href='#L_CALLS_3940'><pre>3940</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttrBuilder RAttrs(CallerPAL, AttributeSet::ReturnIndex);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3941' href='#L_CALLS_3941'><pre>3941</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RAttrs.overlaps(AttributeFuncs::typeIncompatible(NewRetTy))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3942' href='#L_CALLS_3942'><pre>3942</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>; // Attribute not compatible with transformed value.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3943' href='#L_CALLS_3943'><pre>3943</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3944' href='#L_CALLS_3944'><pre>3944</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3945' href='#L_CALLS_3945'><pre>3945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the callsite is an invoke instruction, and the return value is used by</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3946' href='#L_CALLS_3946'><pre>3946</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // a PHI node in a successor, we cannot change the return type of the call</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3947' href='#L_CALLS_3947'><pre>3947</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // because there is no place to put the cast instruction (without breaking</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3948' href='#L_CALLS_3948'><pre>3948</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the critical edge). Bail out in this case.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3949' href='#L_CALLS_3949'><pre>3949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!Caller->use_empty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3950' href='#L_CALLS_3950'><pre>3950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (InvokeInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<InvokeInst>(Caller))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3951' href='#L_CALLS_3951'><pre>3951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>for (User *U : II->users())</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3952' href='#L_CALLS_3952'><pre>3952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (PHINode *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PN</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<PHINode>(U))</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3953' href='#L_CALLS_3953'><pre>3953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PN->getParent() == II->getNormalDest() ||</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3954' href='#L_CALLS_3954'><pre>3954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>PN->getParent() == II->getUnwindDest()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3955' href='#L_CALLS_3955'><pre>3955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3956' href='#L_CALLS_3956'><pre>3956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3957' href='#L_CALLS_3957'><pre>3957</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3958' href='#L_CALLS_3958'><pre>3958</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> unsigned NumActualArgs = CS.arg_size();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3959' href='#L_CALLS_3959'><pre>3959</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> unsigned NumCommonArgs = std::min(FT->getNumParams(), NumActualArgs);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3960' href='#L_CALLS_3960'><pre>3960</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3961' href='#L_CALLS_3961'><pre>3961</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // Prevent us turning:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3962' href='#L_CALLS_3962'><pre>3962</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // declare void @takes_i32_inalloca(i32* inalloca)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3963' href='#L_CALLS_3963'><pre>3963</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // call void bitcast (void (i32*)* @takes_i32_inalloca to void (i32)*)(i32 0)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3964' href='#L_CALLS_3964'><pre>3964</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3965' href='#L_CALLS_3965'><pre>3965</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // into:</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3966' href='#L_CALLS_3966'><pre>3966</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // call void @takes_i32_inalloca(i32* null)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3967' href='#L_CALLS_3967'><pre>3967</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3968' href='#L_CALLS_3968'><pre>3968</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> // Similarly, avoid folding away bitcasts of byval calls.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3969' href='#L_CALLS_3969'><pre>3969</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> if (Callee->getAttributes().hasAttrSomewhere(Attribute::InAlloca) ||</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3970' href='#L_CALLS_3970'><pre>3970</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> Callee->getAttributes().hasAttrSomewhere(Attribute::ByVal))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3971' href='#L_CALLS_3971'><pre>3971</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3972' href='#L_CALLS_3972'><pre>3972</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3973' href='#L_CALLS_3973'><pre>3973</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre> CallSite::arg_iterator AI = CS.arg_begin();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3974' href='#L_CALLS_3974'><pre>3974</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> for (unsigned i = 0, e = NumCommonArgs; <div class='tooltip'>i != e<span class='tooltip-content'>209</span></div>; <div class='tooltip'>++i, ++AI<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>64</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3975' href='#L_CALLS_3975'><pre>3975</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Type *ParamTy = FT->getParamType(i);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3976' href='#L_CALLS_3976'><pre>3976</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Type *ActTy = (*AI)->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3977' href='#L_CALLS_3977'><pre>3977</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3978' href='#L_CALLS_3978'><pre>3978</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> if (!CastInst::isBitOrNoopPointerCastable(ActTy, ParamTy, DL))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3979' href='#L_CALLS_3979'><pre>3979</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return false; // Cannot transform this parameter value.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3980' href='#L_CALLS_3980'><pre>3980</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3981' href='#L_CALLS_3981'><pre>3981</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>36</span></div><div class='tooltip'>AttrBuilder(CallerPAL.getParamAttributes(i + 1), i + 1).<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3982' href='#L_CALLS_3982'><pre>3982</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> overlaps(AttributeFuncs::typeIncompatible(ParamTy)))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3983' href='#L_CALLS_3983'><pre>3983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>; // Attribute not compatible with transformed value.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3984' href='#L_CALLS_3984'><pre>3984</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3985' href='#L_CALLS_3985'><pre>3985</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>36</span></div><div class='tooltip'>CS.isInAllocaArgument(i)<span class='tooltip-content'>36</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3986' href='#L_CALLS_3986'><pre>3986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>; // Cannot transform to and from inalloca.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3987' href='#L_CALLS_3987'><pre>3987</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3988' href='#L_CALLS_3988'><pre>3988</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> // If the parameter is passed as a byval argument, then we have to have a</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3989' href='#L_CALLS_3989'><pre>3989</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> // sized type and the sized type has to have the same size as the old type.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3990' href='#L_CALLS_3990'><pre>3990</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>36</span></div><div class='tooltip'>ParamTy != ActTy &&<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3991' href='#L_CALLS_3991'><pre>3991</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> CallerPAL.getParamAttributes(i + 1).hasAttribute(i + 1,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3992' href='#L_CALLS_3992'><pre>3992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Attribute::ByVal)) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3993' href='#L_CALLS_3993'><pre>3993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *ParamPTy = dyn_cast<PointerType>(ParamTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3994' href='#L_CALLS_3994'><pre>3994</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!ParamPTy || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!ParamPTy->getElementType()->isSized()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3995' href='#L_CALLS_3995'><pre>3995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3996' href='#L_CALLS_3996'><pre>3996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3997' href='#L_CALLS_3997'><pre>3997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Type *CurElTy = ActTy->getPointerElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3998' href='#L_CALLS_3998'><pre>3998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DL.getTypeAllocSize(CurElTy) !=</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_3999' href='#L_CALLS_3999'><pre>3999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DL.getTypeAllocSize(ParamPTy->getElementType())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4000' href='#L_CALLS_4000'><pre>4000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4001' href='#L_CALLS_4001'><pre>4001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4002' href='#L_CALLS_4002'><pre>4002</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4003' href='#L_CALLS_4003'><pre>4003</pre></a></td><td class='covered-line'><pre>173</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4004' href='#L_CALLS_4004'><pre>4004</pre></a></td><td class='covered-line'><pre>145</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>145</span></div><div class='tooltip'>Callee->isDeclaration()<span class='tooltip-content'>145</span></div>) <div class='tooltip'>{<span class='tooltip-content'>121</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4005' href='#L_CALLS_4005'><pre>4005</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // Do not delete arguments unless we have a function body.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4006' href='#L_CALLS_4006'><pre>4006</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> if (<div class='tooltip'>FT->getNumParams() < NumActualArgs && <span class='tooltip-content'>121</span></div><div class='tooltip'>!FT->isVarArg()<span class='tooltip-content'>118</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4007' href='#L_CALLS_4007'><pre>4007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4008' href='#L_CALLS_4008'><pre>4008</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4009' href='#L_CALLS_4009'><pre>4009</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // If the callee is just a declaration, don't change the varargsness of the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4010' href='#L_CALLS_4010'><pre>4010</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // call. We don't want to introduce a varargs call where one doesn't</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4011' href='#L_CALLS_4011'><pre>4011</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // already exist.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4012' href='#L_CALLS_4012'><pre>4012</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> PointerType *APTy = cast<PointerType>(CS.getCalledValue()->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4013' href='#L_CALLS_4013'><pre>4013</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> if (FT->isVarArg()!=cast<FunctionType>(APTy->getElementType())->isVarArg())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4014' href='#L_CALLS_4014'><pre>4014</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4015' href='#L_CALLS_4015'><pre>4015</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4016' href='#L_CALLS_4016'><pre>4016</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // If both the callee and the cast type are varargs, we still have to make</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4017' href='#L_CALLS_4017'><pre>4017</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // sure the number of fixed parameters are the same or we have the same</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4018' href='#L_CALLS_4018'><pre>4018</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> // ABI issues as if we introduce a varargs call.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4019' href='#L_CALLS_4019'><pre>4019</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>121</span></div><div class='tooltip'>FT->isVarArg() &&<span class='tooltip-content'>121</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4020' href='#L_CALLS_4020'><pre>4020</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> cast<FunctionType>(APTy->getElementType())->isVarArg() &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4021' href='#L_CALLS_4021'><pre>4021</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> FT->getNumParams() !=</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4022' href='#L_CALLS_4022'><pre>4022</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> cast<FunctionType>(APTy->getElementType())->getNumParams())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4023' href='#L_CALLS_4023'><pre>4023</pre></a></td><td class='covered-line'><pre>118</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4024' href='#L_CALLS_4024'><pre>4024</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4025' href='#L_CALLS_4025'><pre>4025</pre></a></td><td class='covered-line'><pre>145</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4026' href='#L_CALLS_4026'><pre>4026</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>27</span></div><div class='tooltip'>FT->getNumParams() < NumActualArgs && <span class='tooltip-content'>27</span></div><div class='tooltip'><span class='red'>FT->isVarArg()</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4027' href='#L_CALLS_4027'><pre>4027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!CallerPAL.isEmpty()</span>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4028' href='#L_CALLS_4028'><pre>4028</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // In this case we have more arguments than the new function type, but we</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4029' href='#L_CALLS_4029'><pre>4029</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // won't be dropping them. Check that these extra arguments have attributes</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4030' href='#L_CALLS_4030'><pre>4030</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // that are compatible with being a vararg call argument.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4031' href='#L_CALLS_4031'><pre>4031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>for (unsigned i = CallerPAL.getNumSlots(); </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>i</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>--i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4032' href='#L_CALLS_4032'><pre>4032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Index = CallerPAL.getSlotIndex(i - 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4033' href='#L_CALLS_4033'><pre>4033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Index <= FT->getNumParams()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4034' href='#L_CALLS_4034'><pre>4034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4035' href='#L_CALLS_4035'><pre>4035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4036' href='#L_CALLS_4036'><pre>4036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check if it has an attribute that's incompatible with varargs.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4037' href='#L_CALLS_4037'><pre>4037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>AttributeSet PAttrs = CallerPAL.getSlotAttributes(i - 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4038' href='#L_CALLS_4038'><pre>4038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>PAttrs.hasAttribute(Index, Attribute::StructRet)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4039' href='#L_CALLS_4039'><pre>4039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4040' href='#L_CALLS_4040'><pre>4040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4041' href='#L_CALLS_4041'><pre>4041</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4042' href='#L_CALLS_4042'><pre>4042</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4043' href='#L_CALLS_4043'><pre>4043</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // Okay, we decided that this is a safe thing to do: go ahead and start</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4044' href='#L_CALLS_4044'><pre>4044</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // inserting cast instructions as necessary.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4045' href='#L_CALLS_4045'><pre>4045</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> std::vector<Value*> Args;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4046' href='#L_CALLS_4046'><pre>4046</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Args.reserve(NumActualArgs);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4047' href='#L_CALLS_4047'><pre>4047</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> SmallVector<AttributeSet, 8> attrVec;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4048' href='#L_CALLS_4048'><pre>4048</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> attrVec.reserve(NumCommonArgs);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4049' href='#L_CALLS_4049'><pre>4049</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4050' href='#L_CALLS_4050'><pre>4050</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // Get any return attributes.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4051' href='#L_CALLS_4051'><pre>4051</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> AttrBuilder RAttrs(CallerPAL, AttributeSet::ReturnIndex);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4052' href='#L_CALLS_4052'><pre>4052</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4053' href='#L_CALLS_4053'><pre>4053</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // If the return value is not being used, the type may not be compatible</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4054' href='#L_CALLS_4054'><pre>4054</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // with the existing attributes. Wipe out any problematic attributes.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4055' href='#L_CALLS_4055'><pre>4055</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> RAttrs.remove(AttributeFuncs::typeIncompatible(NewRetTy));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4056' href='#L_CALLS_4056'><pre>4056</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4057' href='#L_CALLS_4057'><pre>4057</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // Add the new return attributes.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4058' href='#L_CALLS_4058'><pre>4058</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (RAttrs.hasAttributes())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4059' href='#L_CALLS_4059'><pre>4059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>attrVec.push_back(AttributeSet::get(Caller->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4060' href='#L_CALLS_4060'><pre>4060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttributeSet::ReturnIndex, RAttrs))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4061' href='#L_CALLS_4061'><pre>4061</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4062' href='#L_CALLS_4062'><pre>4062</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> AI = CS.arg_begin();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4063' href='#L_CALLS_4063'><pre>4063</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i != NumCommonArgs<span class='tooltip-content'>63</span></div>; <div class='tooltip'>++i, ++AI<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4064' href='#L_CALLS_4064'><pre>4064</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> Type *ParamTy = FT->getParamType(i);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4065' href='#L_CALLS_4065'><pre>4065</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4066' href='#L_CALLS_4066'><pre>4066</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> if (<div class='tooltip'>(*AI)->getType() == ParamTy<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4067' href='#L_CALLS_4067'><pre>4067</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Args.push_back(*AI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4068' href='#L_CALLS_4068'><pre>4068</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4069' href='#L_CALLS_4069'><pre>4069</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> Args.push_back(Builder->CreateBitOrPointerCast(*AI, ParamTy));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4070' href='#L_CALLS_4070'><pre>4070</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4071' href='#L_CALLS_4071'><pre>4071</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4072' href='#L_CALLS_4072'><pre>4072</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> // Add any parameter attributes.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4073' href='#L_CALLS_4073'><pre>4073</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4074' href='#L_CALLS_4074'><pre>4074</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> if (PAttrs.hasAttributes())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4075' href='#L_CALLS_4075'><pre>4075</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> attrVec.push_back(AttributeSet::get(Caller->getContext(), i + 1,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4076' href='#L_CALLS_4076'><pre>4076</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> PAttrs));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4077' href='#L_CALLS_4077'><pre>4077</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4078' href='#L_CALLS_4078'><pre>4078</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4079' href='#L_CALLS_4079'><pre>4079</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // If the function takes more arguments than the call was taking, add them</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4080' href='#L_CALLS_4080'><pre>4080</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // now.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4081' href='#L_CALLS_4081'><pre>4081</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> for (unsigned i = NumCommonArgs; <div class='tooltip'>i != FT->getNumParams()<span class='tooltip-content'>27</span></div>; <div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4082' href='#L_CALLS_4082'><pre>4082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Args.push_back(Constant::getNullValue(FT->getParamType(i)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4083' href='#L_CALLS_4083'><pre>4083</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4084' href='#L_CALLS_4084'><pre>4084</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // If we are removing arguments to the function, emit an obnoxious warning.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4085' href='#L_CALLS_4085'><pre>4085</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (<div class='tooltip'>FT->getNumParams() < NumActualArgs<span class='tooltip-content'>27</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4086' href='#L_CALLS_4086'><pre>4086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: if (!FT->isVarArg()) this call may be unreachable. PR14722</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4087' href='#L_CALLS_4087'><pre>4087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>FT->isVarArg()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4088' href='#L_CALLS_4088'><pre>4088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add all of the arguments in their promoted form to the arg list.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4089' href='#L_CALLS_4089'><pre>4089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = FT->getNumParams(); </span><div class='tooltip'><span class='red'>i != NumActualArgs</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i, ++AI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4090' href='#L_CALLS_4090'><pre>4090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *PTy = getPromotedType((*AI)->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4091' href='#L_CALLS_4091'><pre>4091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>PTy != (*AI)->getType()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4092' href='#L_CALLS_4092'><pre>4092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Must promote to pass through va_arg area!</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4093' href='#L_CALLS_4093'><pre>4093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction::CastOps opcode =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4094' href='#L_CALLS_4094'><pre>4094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CastInst::getCastOpcode(*AI, false, PTy, false);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4095' href='#L_CALLS_4095'><pre>4095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Args.push_back(Builder->CreateCast(opcode, *AI, PTy));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4096' href='#L_CALLS_4096'><pre>4096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4097' href='#L_CALLS_4097'><pre>4097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Args.push_back(*AI);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4098' href='#L_CALLS_4098'><pre>4098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4099' href='#L_CALLS_4099'><pre>4099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4100' href='#L_CALLS_4100'><pre>4100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add any parameter attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4101' href='#L_CALLS_4101'><pre>4101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4102' href='#L_CALLS_4102'><pre>4102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>PAttrs.hasAttributes()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4103' href='#L_CALLS_4103'><pre>4103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>attrVec.push_back(AttributeSet::get(FT->getContext(), i + 1,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4104' href='#L_CALLS_4104'><pre>4104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PAttrs))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4105' href='#L_CALLS_4105'><pre>4105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4106' href='#L_CALLS_4106'><pre>4106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4107' href='#L_CALLS_4107'><pre>4107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4108' href='#L_CALLS_4108'><pre>4108</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4109' href='#L_CALLS_4109'><pre>4109</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> AttributeSet FnAttrs = CallerPAL.getFnAttributes();</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4110' href='#L_CALLS_4110'><pre>4110</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex))</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4111' href='#L_CALLS_4111'><pre>4111</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> attrVec.push_back(AttributeSet::get(Callee->getContext(), FnAttrs));</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4112' href='#L_CALLS_4112'><pre>4112</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4113' href='#L_CALLS_4113'><pre>4113</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (NewRetTy->isVoidTy())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4114' href='#L_CALLS_4114'><pre>4114</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Caller->setName(""); // Void type should not have a name.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4115' href='#L_CALLS_4115'><pre>4115</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4116' href='#L_CALLS_4116'><pre>4116</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> const AttributeSet &NewCallerPAL = AttributeSet::get(Callee->getContext(),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4117' href='#L_CALLS_4117'><pre>4117</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> attrVec);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4118' href='#L_CALLS_4118'><pre>4118</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4119' href='#L_CALLS_4119'><pre>4119</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> SmallVector<OperandBundleDef, 1> OpBundles;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4120' href='#L_CALLS_4120'><pre>4120</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> CS.getOperandBundlesAsDefs(OpBundles);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4121' href='#L_CALLS_4121'><pre>4121</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4122' href='#L_CALLS_4122'><pre>4122</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Instruction *NC;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4123' href='#L_CALLS_4123'><pre>4123</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (InvokeInst *<div class='tooltip'>II<span class='tooltip-content'>27</span></div> = dyn_cast<InvokeInst>(Caller)) <div class='tooltip'>{<span class='tooltip-content'>14</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4124' href='#L_CALLS_4124'><pre>4124</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> NC = Builder->CreateInvoke(Callee, II->getNormalDest(), II->getUnwindDest(),</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4125' href='#L_CALLS_4125'><pre>4125</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Args, OpBundles);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4126' href='#L_CALLS_4126'><pre>4126</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> NC->takeName(II);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4127' href='#L_CALLS_4127'><pre>4127</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> cast<InvokeInst>(NC)->setCallingConv(II->getCallingConv());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4128' href='#L_CALLS_4128'><pre>4128</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> cast<InvokeInst>(NC)->setAttributes(NewCallerPAL);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4129' href='#L_CALLS_4129'><pre>4129</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4130' href='#L_CALLS_4130'><pre>4130</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> CallInst *CI = cast<CallInst>(Caller);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4131' href='#L_CALLS_4131'><pre>4131</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> NC = Builder->CreateCall(Callee, Args, OpBundles);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4132' href='#L_CALLS_4132'><pre>4132</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> NC->takeName(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4133' href='#L_CALLS_4133'><pre>4133</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> cast<CallInst>(NC)->setTailCallKind(CI->getTailCallKind());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4134' href='#L_CALLS_4134'><pre>4134</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> cast<CallInst>(NC)->setCallingConv(CI->getCallingConv());</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4135' href='#L_CALLS_4135'><pre>4135</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> cast<CallInst>(NC)->setAttributes(NewCallerPAL);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4136' href='#L_CALLS_4136'><pre>4136</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4137' href='#L_CALLS_4137'><pre>4137</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4138' href='#L_CALLS_4138'><pre>4138</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> // Insert a cast of the return type as necessary.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4139' href='#L_CALLS_4139'><pre>4139</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> Value *NV = NC;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4140' href='#L_CALLS_4140'><pre>4140</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (<div class='tooltip'>OldRetTy != NV->getType() && <span class='tooltip-content'>27</span></div><div class='tooltip'><span class='red'>!Caller->use_empty()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4141' href='#L_CALLS_4141'><pre>4141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!NV->getType()->isVoidTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4142' href='#L_CALLS_4142'><pre>4142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NV = NC = CastInst::CreateBitOrPointerCast(NC, OldRetTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4143' href='#L_CALLS_4143'><pre>4143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NC->setDebugLoc(Caller->getDebugLoc());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4144' href='#L_CALLS_4144'><pre>4144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4145' href='#L_CALLS_4145'><pre>4145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If this is an invoke instruction, we should insert it after the first</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4146' href='#L_CALLS_4146'><pre>4146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // non-phi, instruction in the normal successor block.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4147' href='#L_CALLS_4147'><pre>4147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (InvokeInst *</span><div class='tooltip'><span class='red'>II</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<InvokeInst>(Caller)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4148' href='#L_CALLS_4148'><pre>4148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock::iterator I = II->getNormalDest()->getFirstInsertionPt();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4149' href='#L_CALLS_4149'><pre>4149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstBefore(NC, *I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4150' href='#L_CALLS_4150'><pre>4150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4151' href='#L_CALLS_4151'><pre>4151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, it's a call, just insert cast right after the call.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4152' href='#L_CALLS_4152'><pre>4152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstBefore(NC, *Caller);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4153' href='#L_CALLS_4153'><pre>4153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4154' href='#L_CALLS_4154'><pre>4154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.AddUsersToWorkList(*Caller);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4155' href='#L_CALLS_4155'><pre>4155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4156' href='#L_CALLS_4156'><pre>4156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NV = UndefValue::get(Caller->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4157' href='#L_CALLS_4157'><pre>4157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4158' href='#L_CALLS_4158'><pre>4158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4159' href='#L_CALLS_4159'><pre>4159</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4160' href='#L_CALLS_4160'><pre>4160</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> if (!Caller->use_empty())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4161' href='#L_CALLS_4161'><pre>4161</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> replaceInstUsesWith(*Caller, NV);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4162' href='#L_CALLS_4162'><pre>4162</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>22</span></div><div class='tooltip'>Caller->hasValueHandle()<span class='tooltip-content'>22</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4163' href='#L_CALLS_4163'><pre>4163</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> if (OldRetTy == NV->getType())</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4164' href='#L_CALLS_4164'><pre>4164</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> ValueHandleBase::ValueIsRAUWd(Caller, NV);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4165' href='#L_CALLS_4165'><pre>4165</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4166' href='#L_CALLS_4166'><pre>4166</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> // We cannot call ValueIsRAUWd with a different type, and the</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4167' href='#L_CALLS_4167'><pre>4167</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> // actual tracked value will disappear.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4168' href='#L_CALLS_4168'><pre>4168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>ValueHandleBase::ValueIsDeleted(Caller)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4169' href='#L_CALLS_4169'><pre>4169</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4170' href='#L_CALLS_4170'><pre>4170</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4171' href='#L_CALLS_4171'><pre>4171</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> eraseInstFromFunction(*Caller);</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4172' href='#L_CALLS_4172'><pre>4172</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4173' href='#L_CALLS_4173'><pre>4173</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4174' href='#L_CALLS_4174'><pre>4174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4175' href='#L_CALLS_4175'><pre>4175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Turn a call to a function created by init_trampoline / adjust_trampoline</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4176' href='#L_CALLS_4176'><pre>4176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// intrinsic pair into a direct call to the underlying function.</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4177' href='#L_CALLS_4177'><pre>4177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4178' href='#L_CALLS_4178'><pre>4178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>InstCombiner::transformCallThroughTrampoline(CallSite CS,</pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4179' href='#L_CALLS_4179'><pre>4179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> IntrinsicInst *Tramp) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4180' href='#L_CALLS_4180'><pre>4180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Callee = CS.getCalledValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4181' href='#L_CALLS_4181'><pre>4181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *PTy = cast<PointerType>(Callee->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4182' href='#L_CALLS_4182'><pre>4182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FunctionType *FTy = cast<FunctionType>(PTy->getElementType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4183' href='#L_CALLS_4183'><pre>4183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const AttributeSet &Attrs = CS.getAttributes();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4184' href='#L_CALLS_4184'><pre>4184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4185' href='#L_CALLS_4185'><pre>4185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the call already has the 'nest' attribute somewhere then give up -</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4186' href='#L_CALLS_4186'><pre>4186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // otherwise 'nest' would occur twice after splicing in the chain.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4187' href='#L_CALLS_4187'><pre>4187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Attrs.hasAttrSomewhere(Attribute::Nest)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4188' href='#L_CALLS_4188'><pre>4188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4189' href='#L_CALLS_4189'><pre>4189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4190' href='#L_CALLS_4190'><pre>4190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>(Tramp &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4191' href='#L_CALLS_4191'><pre>4191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "transformCallThroughTrampoline called with incorrect CallSite.");</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4192' href='#L_CALLS_4192'><pre>4192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4193' href='#L_CALLS_4193'><pre>4193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Function *NestF =cast<Function>(Tramp->getArgOperand(1)->stripPointerCasts());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4194' href='#L_CALLS_4194'><pre>4194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FunctionType *NestFTy = cast<FunctionType>(NestF->getValueType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4195' href='#L_CALLS_4195'><pre>4195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4196' href='#L_CALLS_4196'><pre>4196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const AttributeSet &NestAttrs = NestF->getAttributes();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4197' href='#L_CALLS_4197'><pre>4197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!NestAttrs.isEmpty()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4198' href='#L_CALLS_4198'><pre>4198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NestIdx = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4199' href='#L_CALLS_4199'><pre>4199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *NestTy = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4200' href='#L_CALLS_4200'><pre>4200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttributeSet NestAttr;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4201' href='#L_CALLS_4201'><pre>4201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4202' href='#L_CALLS_4202'><pre>4202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Look for a parameter marked with the 'nest' attribute.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4203' href='#L_CALLS_4203'><pre>4203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (FunctionType::param_iterator I = NestFTy->param_begin(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4204' href='#L_CALLS_4204'><pre>4204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> E = NestFTy->param_end(); </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++NestIdx, ++I</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4205' href='#L_CALLS_4205'><pre>4205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>NestAttrs.hasAttribute(NestIdx, Attribute::Nest)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4206' href='#L_CALLS_4206'><pre>4206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Record the parameter type and any other attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4207' href='#L_CALLS_4207'><pre>4207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NestTy = *I;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4208' href='#L_CALLS_4208'><pre>4208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NestAttr = NestAttrs.getParamAttributes(NestIdx);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4209' href='#L_CALLS_4209'><pre>4209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4210' href='#L_CALLS_4210'><pre>4210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4211' href='#L_CALLS_4211'><pre>4211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4212' href='#L_CALLS_4212'><pre>4212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NestTy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4213' href='#L_CALLS_4213'><pre>4213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Caller = CS.getInstruction();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4214' href='#L_CALLS_4214'><pre>4214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::vector<Value*> NewArgs;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4215' href='#L_CALLS_4215'><pre>4215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewArgs.reserve(CS.arg_size() + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4216' href='#L_CALLS_4216'><pre>4216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4217' href='#L_CALLS_4217'><pre>4217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<AttributeSet, 8> NewAttrs;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4218' href='#L_CALLS_4218'><pre>4218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewAttrs.reserve(Attrs.getNumSlots() + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4219' href='#L_CALLS_4219'><pre>4219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4220' href='#L_CALLS_4220'><pre>4220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the nest argument into the call argument list, which may</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4221' href='#L_CALLS_4221'><pre>4221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mean appending it. Likewise for attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4222' href='#L_CALLS_4222'><pre>4222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4223' href='#L_CALLS_4223'><pre>4223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add any result attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4224' href='#L_CALLS_4224'><pre>4224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Attrs.hasAttributes(AttributeSet::ReturnIndex)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4225' href='#L_CALLS_4225'><pre>4225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewAttrs.push_back(AttributeSet::get(Caller->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4226' href='#L_CALLS_4226'><pre>4226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Attrs.getRetAttributes()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4227' href='#L_CALLS_4227'><pre>4227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4228' href='#L_CALLS_4228'><pre>4228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4229' href='#L_CALLS_4229'><pre>4229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Idx = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4230' href='#L_CALLS_4230'><pre>4230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4231' href='#L_CALLS_4231'><pre>4231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> do </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4232' href='#L_CALLS_4232'><pre>4232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Idx == NestIdx</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4233' href='#L_CALLS_4233'><pre>4233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add the chain argument and attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4234' href='#L_CALLS_4234'><pre>4234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NestVal = Tramp->getArgOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4235' href='#L_CALLS_4235'><pre>4235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NestVal->getType() != NestTy</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4236' href='#L_CALLS_4236'><pre>4236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest")</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4237' href='#L_CALLS_4237'><pre>4237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewArgs.push_back(NestVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4238' href='#L_CALLS_4238'><pre>4238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewAttrs.push_back(AttributeSet::get(Caller->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4239' href='#L_CALLS_4239'><pre>4239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NestAttr));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4240' href='#L_CALLS_4240'><pre>4240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4241' href='#L_CALLS_4241'><pre>4241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4242' href='#L_CALLS_4242'><pre>4242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I == E</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4243' href='#L_CALLS_4243'><pre>4243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4244' href='#L_CALLS_4244'><pre>4244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4245' href='#L_CALLS_4245'><pre>4245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add the original argument and attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4246' href='#L_CALLS_4246'><pre>4246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewArgs.push_back(*I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4247' href='#L_CALLS_4247'><pre>4247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttributeSet Attr = Attrs.getParamAttributes(Idx);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4248' href='#L_CALLS_4248'><pre>4248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Attr.hasAttributes(Idx)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4249' href='#L_CALLS_4249'><pre>4249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttrBuilder B(Attr, Idx);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4250' href='#L_CALLS_4250'><pre>4250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewAttrs.push_back(AttributeSet::get(Caller->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4251' href='#L_CALLS_4251'><pre>4251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Idx + (Idx >= NestIdx), B));</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4252' href='#L_CALLS_4252'><pre>4252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4253' href='#L_CALLS_4253'><pre>4253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4254' href='#L_CALLS_4254'><pre>4254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++Idx;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4255' href='#L_CALLS_4255'><pre>4255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++I;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4256' href='#L_CALLS_4256'><pre>4256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> while (</span><span class='red'>true</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4257' href='#L_CALLS_4257'><pre>4257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4258' href='#L_CALLS_4258'><pre>4258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4259' href='#L_CALLS_4259'><pre>4259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add any function attributes.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4260' href='#L_CALLS_4260'><pre>4260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Attrs.hasAttributes(AttributeSet::FunctionIndex)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4261' href='#L_CALLS_4261'><pre>4261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewAttrs.push_back(AttributeSet::get(FTy->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4262' href='#L_CALLS_4262'><pre>4262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Attrs.getFnAttributes()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4263' href='#L_CALLS_4263'><pre>4263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4264' href='#L_CALLS_4264'><pre>4264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The trampoline may have been bitcast to a bogus type (FTy).</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4265' href='#L_CALLS_4265'><pre>4265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle this by synthesizing a new function type, equal to FTy</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4266' href='#L_CALLS_4266'><pre>4266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // with the chain parameter inserted.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4267' href='#L_CALLS_4267'><pre>4267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4268' href='#L_CALLS_4268'><pre>4268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::vector<Type*> NewTypes;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4269' href='#L_CALLS_4269'><pre>4269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewTypes.reserve(FTy->getNumParams()+1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4270' href='#L_CALLS_4270'><pre>4270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4271' href='#L_CALLS_4271'><pre>4271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the chain's type into the list of parameter types, which may</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4272' href='#L_CALLS_4272'><pre>4272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mean appending it.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4273' href='#L_CALLS_4273'><pre>4273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> {</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4274' href='#L_CALLS_4274'><pre>4274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Idx = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4275' href='#L_CALLS_4275'><pre>4275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FunctionType::param_iterator I = FTy->param_begin(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4276' href='#L_CALLS_4276'><pre>4276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> E = FTy->param_end();</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4277' href='#L_CALLS_4277'><pre>4277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4278' href='#L_CALLS_4278'><pre>4278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> do </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4279' href='#L_CALLS_4279'><pre>4279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Idx == NestIdx</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4280' href='#L_CALLS_4280'><pre>4280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add the chain's type.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4281' href='#L_CALLS_4281'><pre>4281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewTypes.push_back(NestTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4282' href='#L_CALLS_4282'><pre>4282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4283' href='#L_CALLS_4283'><pre>4283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I == E</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4284' href='#L_CALLS_4284'><pre>4284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4285' href='#L_CALLS_4285'><pre>4285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4286' href='#L_CALLS_4286'><pre>4286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Add the original type.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4287' href='#L_CALLS_4287'><pre>4287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewTypes.push_back(*I);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4288' href='#L_CALLS_4288'><pre>4288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4289' href='#L_CALLS_4289'><pre>4289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++Idx;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4290' href='#L_CALLS_4290'><pre>4290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++I;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4291' href='#L_CALLS_4291'><pre>4291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> while (</span><span class='red'>true</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4292' href='#L_CALLS_4292'><pre>4292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4293' href='#L_CALLS_4293'><pre>4293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4294' href='#L_CALLS_4294'><pre>4294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace the trampoline call with a direct call. Let the generic</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4295' href='#L_CALLS_4295'><pre>4295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // code sort out any function type mismatches.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4296' href='#L_CALLS_4296'><pre>4296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FunctionType *NewFTy = FunctionType::get(FTy->getReturnType(), NewTypes,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4297' href='#L_CALLS_4297'><pre>4297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FTy->isVarArg());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4298' href='#L_CALLS_4298'><pre>4298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *NewCallee =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4299' href='#L_CALLS_4299'><pre>4299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NestF->getType() == PointerType::getUnqual(NewFTy) ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4300' href='#L_CALLS_4300'><pre>4300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>NestF</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ConstantExpr::getBitCast(NestF,</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4301' href='#L_CALLS_4301'><pre>4301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType::getUnqual(NewFTy))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4302' href='#L_CALLS_4302'><pre>4302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const AttributeSet &NewPAL =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4303' href='#L_CALLS_4303'><pre>4303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AttributeSet::get(FTy->getContext(), NewAttrs);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4304' href='#L_CALLS_4304'><pre>4304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4305' href='#L_CALLS_4305'><pre>4305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<OperandBundleDef, 1> OpBundles;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4306' href='#L_CALLS_4306'><pre>4306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CS.getOperandBundlesAsDefs(OpBundles);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4307' href='#L_CALLS_4307'><pre>4307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4308' href='#L_CALLS_4308'><pre>4308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewCaller;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4309' href='#L_CALLS_4309'><pre>4309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (InvokeInst *</span><div class='tooltip'><span class='red'>II</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<InvokeInst>(Caller)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4310' href='#L_CALLS_4310'><pre>4310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCaller = InvokeInst::Create(NewCallee,</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4311' href='#L_CALLS_4311'><pre>4311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getNormalDest(), II->getUnwindDest(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4312' href='#L_CALLS_4312'><pre>4312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewArgs, OpBundles);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4313' href='#L_CALLS_4313'><pre>4313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<InvokeInst>(NewCaller)->setCallingConv(II->getCallingConv());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4314' href='#L_CALLS_4314'><pre>4314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<InvokeInst>(NewCaller)->setAttributes(NewPAL);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4315' href='#L_CALLS_4315'><pre>4315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4316' href='#L_CALLS_4316'><pre>4316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCaller = CallInst::Create(NewCallee, NewArgs, OpBundles);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4317' href='#L_CALLS_4317'><pre>4317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<CallInst>(NewCaller)->setTailCallKind(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4318' href='#L_CALLS_4318'><pre>4318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<CallInst>(Caller)->getTailCallKind());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4319' href='#L_CALLS_4319'><pre>4319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<CallInst>(NewCaller)->setCallingConv(</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4320' href='#L_CALLS_4320'><pre>4320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<CallInst>(Caller)->getCallingConv());</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4321' href='#L_CALLS_4321'><pre>4321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<CallInst>(NewCaller)->setAttributes(NewPAL);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4322' href='#L_CALLS_4322'><pre>4322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4323' href='#L_CALLS_4323'><pre>4323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4324' href='#L_CALLS_4324'><pre>4324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewCaller;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4325' href='#L_CALLS_4325'><pre>4325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4326' href='#L_CALLS_4326'><pre>4326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4327' href='#L_CALLS_4327'><pre>4327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4328' href='#L_CALLS_4328'><pre>4328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace the trampoline call with a direct call. Since there is no 'nest'</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4329' href='#L_CALLS_4329'><pre>4329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // parameter, there is no need to adjust the argument list. Let the generic</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4330' href='#L_CALLS_4330'><pre>4330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // code sort out any function type mismatches.</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4331' href='#L_CALLS_4331'><pre>4331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Constant *NewCallee =</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4332' href='#L_CALLS_4332'><pre>4332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NestF->getType() == PTy ? </span><span class='red'>NestF</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4333' href='#L_CALLS_4333'><pre>4333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantExpr::getBitCast(NestF, PTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4334' href='#L_CALLS_4334'><pre>4334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CS.setCalledFunction(NewCallee);</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4335' href='#L_CALLS_4335'><pre>4335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CS.getInstruction()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CALLS_4336' href='#L_CALLS_4336'><pre>4336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='CASTS' href='#CASTS'>lib/Transforms/InstCombine/InstCombineCasts.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_CASTS_40'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1' href='#L_CASTS_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineCasts.cpp -----------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2' href='#L_CASTS_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_3' href='#L_CASTS_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_4' href='#L_CASTS_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_5' href='#L_CASTS_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_6' href='#L_CASTS_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_7' href='#L_CASTS_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_8' href='#L_CASTS_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_9' href='#L_CASTS_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_10' href='#L_CASTS_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visit functions for cast operations.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_11' href='#L_CASTS_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_12' href='#L_CASTS_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_13' href='#L_CASTS_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_14' href='#L_CASTS_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_15' href='#L_CASTS_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/SetVector.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_16' href='#L_CASTS_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ConstantFolding.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_17' href='#L_CASTS_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DataLayout.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_18' href='#L_CASTS_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_19' href='#L_CASTS_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/TargetLibraryInfo.h"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_20' href='#L_CASTS_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_21' href='#L_CASTS_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_22' href='#L_CASTS_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_23' href='#L_CASTS_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_24' href='#L_CASTS_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_25' href='#L_CASTS_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Analyze 'Val', seeing if it is a simple linear expression.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_26' href='#L_CASTS_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If so, decompose it, returning some value X, such that Val is</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_27' href='#L_CASTS_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// X*Scale+Offset.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_28' href='#L_CASTS_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_29' href='#L_CASTS_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *decomposeSimpleLinearExpr(Value *Val, unsigned &Scale,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_30' href='#L_CASTS_30'><pre>30</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> uint64_t &Offset) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_31' href='#L_CASTS_31'><pre>31</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>CI<span class='tooltip-content'>2.74k</span></div> = dyn_cast<ConstantInt>(Val)) <div class='tooltip'>{<span class='tooltip-content'>2.60k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_32' href='#L_CASTS_32'><pre>32</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> Offset = CI->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_33' href='#L_CASTS_33'><pre>33</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> Scale = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_34' href='#L_CASTS_34'><pre>34</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> return ConstantInt::get(Val->getType(), 0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_35' href='#L_CASTS_35'><pre>35</pre></a></td><td class='covered-line'><pre>2.60k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_36' href='#L_CASTS_36'><pre>36</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_37' href='#L_CASTS_37'><pre>37</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> <div class='tooltip'>if (BinaryOperator *<span class='tooltip-content'>140</span></div><div class='tooltip'>I<span class='tooltip-content'>140</span></div> = dyn_cast<BinaryOperator>(Val)) <div class='tooltip'>{<span class='tooltip-content'>140</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_38' href='#L_CASTS_38'><pre>38</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> // Cannot look past anything that might overflow.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_39' href='#L_CASTS_39'><pre>39</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> OverflowingBinaryOperator *OBI = dyn_cast<OverflowingBinaryOperator>(Val);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_40' href='#L_CASTS_40'><pre>40</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> if (<div class='tooltip'>OBI && <span class='tooltip-content'>140</span></div><div class='tooltip'>!OBI->hasNoUnsignedWrap()<span class='tooltip-content'>140</span></div> && <div class='tooltip'><span class='red'>!OBI->hasNoSignedWrap()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_41' href='#L_CASTS_41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Scale = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_42' href='#L_CASTS_42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_43' href='#L_CASTS_43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Val;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_44' href='#L_CASTS_44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_45' href='#L_CASTS_45'><pre>45</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_46' href='#L_CASTS_46'><pre>46</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>140</span></div><div class='tooltip'>RHS<span class='tooltip-content'>140</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>140</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_47' href='#L_CASTS_47'><pre>47</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> if (<div class='tooltip'>I->getOpcode() == Instruction::Shl<span class='tooltip-content'>140</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_48' href='#L_CASTS_48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is a value scaled by '1 << the shift amt'.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_49' href='#L_CASTS_49'><pre>49</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Scale = UINT64_C(1) << RHS->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_50' href='#L_CASTS_50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_51' href='#L_CASTS_51'><pre>51</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return I->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_52' href='#L_CASTS_52'><pre>52</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_53' href='#L_CASTS_53'><pre>53</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_54' href='#L_CASTS_54'><pre>54</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>140</span></div><div class='tooltip'>I->getOpcode() == Instruction::Mul<span class='tooltip-content'>140</span></div>) <div class='tooltip'>{<span class='tooltip-content'>70</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_55' href='#L_CASTS_55'><pre>55</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // This value is scaled by 'RHS'.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_56' href='#L_CASTS_56'><pre>56</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Scale = RHS->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_57' href='#L_CASTS_57'><pre>57</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Offset = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_58' href='#L_CASTS_58'><pre>58</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_59' href='#L_CASTS_59'><pre>59</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_60' href='#L_CASTS_60'><pre>60</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_61' href='#L_CASTS_61'><pre>61</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>70</span></div><div class='tooltip'>I->getOpcode() == Instruction::Add<span class='tooltip-content'>70</span></div>) <div class='tooltip'>{<span class='tooltip-content'>70</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_62' href='#L_CASTS_62'><pre>62</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // We have X+C. Check to see if we really have (X*C2)+C1,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_63' href='#L_CASTS_63'><pre>63</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // where C1 is divisible by C2.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_64' href='#L_CASTS_64'><pre>64</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> unsigned SubScale;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_65' href='#L_CASTS_65'><pre>65</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Value *SubVal =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_66' href='#L_CASTS_66'><pre>66</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> decomposeSimpleLinearExpr(I->getOperand(0), SubScale, Offset);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_67' href='#L_CASTS_67'><pre>67</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Offset += RHS->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_68' href='#L_CASTS_68'><pre>68</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Scale = SubScale;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_69' href='#L_CASTS_69'><pre>69</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> return SubVal;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_70' href='#L_CASTS_70'><pre>70</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_71' href='#L_CASTS_71'><pre>71</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_72' href='#L_CASTS_72'><pre>72</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_73' href='#L_CASTS_73'><pre>73</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_74' href='#L_CASTS_74'><pre>74</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> // Otherwise, we can't look past this.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_75' href='#L_CASTS_75'><pre>75</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Scale = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_76' href='#L_CASTS_76'><pre>76</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_77' href='#L_CASTS_77'><pre>77</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Val</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_78' href='#L_CASTS_78'><pre>78</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_79' href='#L_CASTS_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_80' href='#L_CASTS_80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If we find a cast of an allocation instruction, try to eliminate the cast by</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_81' href='#L_CASTS_81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// moving the type information into the alloc.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_82' href='#L_CASTS_82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_83' href='#L_CASTS_83'><pre>83</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> AllocaInst &AI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_84' href='#L_CASTS_84'><pre>84</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> PointerType *PTy = cast<PointerType>(CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_85' href='#L_CASTS_85'><pre>85</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_86' href='#L_CASTS_86'><pre>86</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> BuilderTy AllocaBuilder(*Builder);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_87' href='#L_CASTS_87'><pre>87</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> AllocaBuilder.SetInsertPoint(&AI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_88' href='#L_CASTS_88'><pre>88</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_89' href='#L_CASTS_89'><pre>89</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // Get the type really allocated and the type casted to.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_90' href='#L_CASTS_90'><pre>90</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> Type *AllocElTy = AI.getAllocatedType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_91' href='#L_CASTS_91'><pre>91</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> Type *CastElTy = PTy->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_92' href='#L_CASTS_92'><pre>92</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> if (<div class='tooltip'>!AllocElTy->isSized() || <span class='tooltip-content'>179k</span></div><div class='tooltip'>!CastElTy->isSized()<span class='tooltip-content'>179k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_93' href='#L_CASTS_93'><pre>93</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_94' href='#L_CASTS_94'><pre>94</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> unsigned AllocElTyAlign = DL.getABITypeAlignment(AllocElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_95' href='#L_CASTS_95'><pre>95</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> unsigned CastElTyAlign = DL.getABITypeAlignment(CastElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_96' href='#L_CASTS_96'><pre>96</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> if (<div class='tooltip'>CastElTyAlign < AllocElTyAlign<span class='tooltip-content'>179k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>148k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_97' href='#L_CASTS_97'><pre>97</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_98' href='#L_CASTS_98'><pre>98</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // If the allocation has multiple uses, only promote it if we are strictly</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_99' href='#L_CASTS_99'><pre>99</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // increasing the alignment of the resultant allocation. If we keep it the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_100' href='#L_CASTS_100'><pre>100</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // same, we open the door to infinite loops of various kinds.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_101' href='#L_CASTS_101'><pre>101</pre></a></td><td class='covered-line'><pre>31.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>31.2k</span></div><div class='tooltip'>!AI.hasOneUse() && <span class='tooltip-content'>31.2k</span></div><div class='tooltip'>CastElTyAlign == AllocElTyAlign<span class='tooltip-content'>31.2k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>25.7k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_102' href='#L_CASTS_102'><pre>102</pre></a></td><td class='covered-line'><pre>31.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_103' href='#L_CASTS_103'><pre>103</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> uint64_t AllocElTySize = DL.getTypeAllocSize(AllocElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_104' href='#L_CASTS_104'><pre>104</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> uint64_t CastElTySize = DL.getTypeAllocSize(CastElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_105' href='#L_CASTS_105'><pre>105</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> if (<div class='tooltip'>CastElTySize == 0 || <span class='tooltip-content'>5.48k</span></div><div class='tooltip'>AllocElTySize == 0<span class='tooltip-content'>5.48k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_106' href='#L_CASTS_106'><pre>106</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_107' href='#L_CASTS_107'><pre>107</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> // If the allocation has multiple uses, only promote it if we're not</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_108' href='#L_CASTS_108'><pre>108</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> // shrinking the amount of memory being allocated.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_109' href='#L_CASTS_109'><pre>109</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> uint64_t AllocElTyStoreSize = DL.getTypeStoreSize(AllocElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_110' href='#L_CASTS_110'><pre>110</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> uint64_t CastElTyStoreSize = DL.getTypeStoreSize(CastElTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_111' href='#L_CASTS_111'><pre>111</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> if (<div class='tooltip'>!AI.hasOneUse() && <span class='tooltip-content'>5.48k</span></div><div class='tooltip'>CastElTyStoreSize < AllocElTyStoreSize<span class='tooltip-content'>5.47k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>2.80k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_112' href='#L_CASTS_112'><pre>112</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_113' href='#L_CASTS_113'><pre>113</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> // See if we can satisfy the modulus by pulling a scale out of the array</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_114' href='#L_CASTS_114'><pre>114</pre></a></td><td class='covered-line'><pre>5.48k</pre></td><td class='code'><pre> // size argument.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_115' href='#L_CASTS_115'><pre>115</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> unsigned ArraySizeScale;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_116' href='#L_CASTS_116'><pre>116</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> uint64_t ArrayOffset;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_117' href='#L_CASTS_117'><pre>117</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> Value *NumElements = // See if the array size is a decomposable linear expr.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_118' href='#L_CASTS_118'><pre>118</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> decomposeSimpleLinearExpr(AI.getOperand(0), ArraySizeScale, ArrayOffset);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_119' href='#L_CASTS_119'><pre>119</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_120' href='#L_CASTS_120'><pre>120</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // If we can now satisfy the modulus, by using a non-1 scale, we really can</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_121' href='#L_CASTS_121'><pre>121</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // do the xform.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_122' href='#L_CASTS_122'><pre>122</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> if ((AllocElTySize*ArraySizeScale) % CastElTySize != 0 ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_123' href='#L_CASTS_123'><pre>123</pre></a></td><td class='covered-line'><pre>2.64k</pre></td><td class='code'><pre> <div class='tooltip'>(AllocElTySize*ArrayOffset ) % CastElTySize != 0<span class='tooltip-content'>2.64k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>78</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_124' href='#L_CASTS_124'><pre>124</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_125' href='#L_CASTS_125'><pre>125</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> unsigned Scale = (AllocElTySize*ArraySizeScale)/CastElTySize;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_126' href='#L_CASTS_126'><pre>126</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Value *Amt = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_127' href='#L_CASTS_127'><pre>127</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> if (<div class='tooltip'>Scale == 1<span class='tooltip-content'>2.59k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_128' href='#L_CASTS_128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Amt = NumElements;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_129' href='#L_CASTS_129'><pre>129</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_130' href='#L_CASTS_130'><pre>130</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Amt = ConstantInt::get(AI.getArraySize()->getType(), Scale);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_131' href='#L_CASTS_131'><pre>131</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // Insert before the alloca, not before the cast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_132' href='#L_CASTS_132'><pre>132</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Amt = AllocaBuilder.CreateMul(Amt, NumElements);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_133' href='#L_CASTS_133'><pre>133</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_134' href='#L_CASTS_134'><pre>134</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_135' href='#L_CASTS_135'><pre>135</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> if (uint64_t <div class='tooltip'>Offset<span class='tooltip-content'>2.59k</span></div> = (AllocElTySize*ArrayOffset)/CastElTySize) <div class='tooltip'>{<span class='tooltip-content'>2.59k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_136' href='#L_CASTS_136'><pre>136</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Value *Off = ConstantInt::get(AI.getArraySize()->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_137' href='#L_CASTS_137'><pre>137</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Offset, true);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_138' href='#L_CASTS_138'><pre>138</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Amt = AllocaBuilder.CreateAdd(Amt, Off);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_139' href='#L_CASTS_139'><pre>139</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_140' href='#L_CASTS_140'><pre>140</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_141' href='#L_CASTS_141'><pre>141</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> AllocaInst *New = AllocaBuilder.CreateAlloca(CastElTy, Amt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_142' href='#L_CASTS_142'><pre>142</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> New->setAlignment(AI.getAlignment());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_143' href='#L_CASTS_143'><pre>143</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> New->takeName(&AI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_144' href='#L_CASTS_144'><pre>144</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> New->setUsedWithInAlloca(AI.isUsedWithInAlloca());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_145' href='#L_CASTS_145'><pre>145</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_146' href='#L_CASTS_146'><pre>146</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // If the allocation has multiple real uses, insert a cast and change all</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_147' href='#L_CASTS_147'><pre>147</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // things that used it to use the new cast. This will also hack on CI, but it</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_148' href='#L_CASTS_148'><pre>148</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // will die soon.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_149' href='#L_CASTS_149'><pre>149</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> if (<div class='tooltip'>!AI.hasOneUse()<span class='tooltip-content'>2.59k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.59k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_150' href='#L_CASTS_150'><pre>150</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // New is the allocation instruction, pointer typed. AI is the original</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_151' href='#L_CASTS_151'><pre>151</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> // allocation instruction, also pointer typed. Thus, cast to use is BitCast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_152' href='#L_CASTS_152'><pre>152</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Value *NewCast = AllocaBuilder.CreateBitCast(New, AI.getType(), "tmpcast");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_153' href='#L_CASTS_153'><pre>153</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> replaceInstUsesWith(AI, NewCast);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_154' href='#L_CASTS_154'><pre>154</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_155' href='#L_CASTS_155'><pre>155</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, New);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_156' href='#L_CASTS_156'><pre>156</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_157' href='#L_CASTS_157'><pre>157</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_158' href='#L_CASTS_158'><pre>158</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given an expression that CanEvaluateTruncated or CanEvaluateSExtd returns</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_159' href='#L_CASTS_159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// true for, actually insert the code to evaluate the expression.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_160' href='#L_CASTS_160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::EvaluateInDifferentType(Value *V, Type *Ty,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_161' href='#L_CASTS_161'><pre>161</pre></a></td><td class='covered-line'><pre>6.62k</pre></td><td class='code'><pre> bool isSigned) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_162' href='#L_CASTS_162'><pre>162</pre></a></td><td class='covered-line'><pre>6.62k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>6.62k</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'>{<span class='tooltip-content'>1.60k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_163' href='#L_CASTS_163'><pre>163</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> C = ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_164' href='#L_CASTS_164'><pre>164</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> // If we got a constantexpr back, try to simplify it with DL info.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_165' href='#L_CASTS_165'><pre>165</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> if (Constant *FoldedC = ConstantFoldConstant(C, DL, &TLI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_166' href='#L_CASTS_166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>C = FoldedC</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_167' href='#L_CASTS_167'><pre>167</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> return C;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_168' href='#L_CASTS_168'><pre>168</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_169' href='#L_CASTS_169'><pre>169</pre></a></td><td class='covered-line'><pre>6.62k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_170' href='#L_CASTS_170'><pre>170</pre></a></td><td class='covered-line'><pre>6.62k</pre></td><td class='code'><pre> // Otherwise, it must be an instruction.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_171' href='#L_CASTS_171'><pre>171</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre> Instruction *I = cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_172' href='#L_CASTS_172'><pre>172</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre> Instruction *Res = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_173' href='#L_CASTS_173'><pre>173</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre> unsigned Opc = I->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_174' href='#L_CASTS_174'><pre>174</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre> switch (Opc) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_175' href='#L_CASTS_175'><pre>175</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_176' href='#L_CASTS_176'><pre>176</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_177' href='#L_CASTS_177'><pre>177</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_178' href='#L_CASTS_178'><pre>178</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_179' href='#L_CASTS_179'><pre>179</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_180' href='#L_CASTS_180'><pre>180</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_181' href='#L_CASTS_181'><pre>181</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_182' href='#L_CASTS_182'><pre>182</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_183' href='#L_CASTS_183'><pre>183</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_184' href='#L_CASTS_184'><pre>184</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_185' href='#L_CASTS_185'><pre>185</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> case Instruction::URem: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_186' href='#L_CASTS_186'><pre>186</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> Value *LHS = EvaluateInDifferentType(I->getOperand(0), Ty, isSigned);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_187' href='#L_CASTS_187'><pre>187</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> Value *RHS = EvaluateInDifferentType(I->getOperand(1), Ty, isSigned);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_188' href='#L_CASTS_188'><pre>188</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> Res = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_189' href='#L_CASTS_189'><pre>189</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_190' href='#L_CASTS_190'><pre>190</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_191' href='#L_CASTS_191'><pre>191</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> case Instruction::Trunc:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_192' href='#L_CASTS_192'><pre>192</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> case Instruction::ZExt:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_193' href='#L_CASTS_193'><pre>193</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> case Instruction::SExt:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_194' href='#L_CASTS_194'><pre>194</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> // If the source type of the cast is the type we're trying for then we can</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_195' href='#L_CASTS_195'><pre>195</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> // just return the source. There's no need to insert it because it is not</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_196' href='#L_CASTS_196'><pre>196</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> // new.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_197' href='#L_CASTS_197'><pre>197</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> if (I->getOperand(0)->getType() == Ty)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_198' href='#L_CASTS_198'><pre>198</pre></a></td><td class='covered-line'><pre>2.43k</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_199' href='#L_CASTS_199'><pre>199</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_200' href='#L_CASTS_200'><pre>200</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> // Otherwise, must be the same type of cast, so just reinsert a new one.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_201' href='#L_CASTS_201'><pre>201</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> // This also handles the case of zext(trunc(x)) -> zext(x).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_202' href='#L_CASTS_202'><pre>202</pre></a></td><td class='covered-line'><pre>669</pre></td><td class='code'><pre> Res = CastInst::CreateIntegerCast(I->getOperand(0), Ty,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_203' href='#L_CASTS_203'><pre>203</pre></a></td><td class='covered-line'><pre>669</pre></td><td class='code'><pre> Opc == Instruction::SExt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_204' href='#L_CASTS_204'><pre>204</pre></a></td><td class='covered-line'><pre>669</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_205' href='#L_CASTS_205'><pre>205</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> case Instruction::Select: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_206' href='#L_CASTS_206'><pre>206</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> Value *True = EvaluateInDifferentType(I->getOperand(1), Ty, isSigned);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_207' href='#L_CASTS_207'><pre>207</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> Value *False = EvaluateInDifferentType(I->getOperand(2), Ty, isSigned);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_208' href='#L_CASTS_208'><pre>208</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> Res = SelectInst::Create(I->getOperand(0), True, False);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_209' href='#L_CASTS_209'><pre>209</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_210' href='#L_CASTS_210'><pre>210</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_211' href='#L_CASTS_211'><pre>211</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_212' href='#L_CASTS_212'><pre>212</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> PHINode *OPN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_213' href='#L_CASTS_213'><pre>213</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> PHINode *NPN = PHINode::Create(Ty, OPN->getNumIncomingValues());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_214' href='#L_CASTS_214'><pre>214</pre></a></td><td class='covered-line'><pre>766</pre></td><td class='code'><pre> for (unsigned i = 0, e = OPN->getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>766</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>552</span></div>) <div class='tooltip'>{<span class='tooltip-content'>552</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_215' href='#L_CASTS_215'><pre>215</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> Value *V =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_216' href='#L_CASTS_216'><pre>216</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> EvaluateInDifferentType(OPN->getIncomingValue(i), Ty, isSigned);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_217' href='#L_CASTS_217'><pre>217</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> NPN->addIncoming(V, OPN->getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_218' href='#L_CASTS_218'><pre>218</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_219' href='#L_CASTS_219'><pre>219</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> Res = NPN;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_220' href='#L_CASTS_220'><pre>220</pre></a></td><td class='covered-line'><pre>214</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_221' href='#L_CASTS_221'><pre>221</pre></a></td><td class='covered-line'><pre>3.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_222' href='#L_CASTS_222'><pre>222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_223' href='#L_CASTS_223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Can handle more cases here.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_224' href='#L_CASTS_224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span>("Unreachable!");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_225' href='#L_CASTS_225'><pre>225</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_226' href='#L_CASTS_226'><pre>226</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_227' href='#L_CASTS_227'><pre>227</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> Res->takeName(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_228' href='#L_CASTS_228'><pre>228</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> return InsertNewInstWith(Res, *I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_229' href='#L_CASTS_229'><pre>229</pre></a></td><td class='covered-line'><pre>5.02k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_230' href='#L_CASTS_230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_231' href='#L_CASTS_231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction::CastOps InstCombiner::isEliminableCastPair(const CastInst *CI1,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_232' href='#L_CASTS_232'><pre>232</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> const CastInst *CI2) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_233' href='#L_CASTS_233'><pre>233</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *SrcTy = CI1->getSrcTy();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_234' href='#L_CASTS_234'><pre>234</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *MidTy = CI1->getDestTy();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_235' href='#L_CASTS_235'><pre>235</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *DstTy = CI2->getDestTy();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_236' href='#L_CASTS_236'><pre>236</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_237' href='#L_CASTS_237'><pre>237</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Instruction::CastOps firstOp = Instruction::CastOps(CI1->getOpcode());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_238' href='#L_CASTS_238'><pre>238</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Instruction::CastOps secondOp = Instruction::CastOps(CI2->getOpcode());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_239' href='#L_CASTS_239'><pre>239</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *SrcIntPtrTy =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_240' href='#L_CASTS_240'><pre>240</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> SrcTy->isPtrOrPtrVectorTy() ? <div class='tooltip'>DL.getIntPtrType(SrcTy)<span class='tooltip-content'>23.7k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>11.9k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_241' href='#L_CASTS_241'><pre>241</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *MidIntPtrTy =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_242' href='#L_CASTS_242'><pre>242</pre></a></td><td class='covered-line'><pre>18.0k</pre></td><td class='code'><pre> MidTy->isPtrOrPtrVectorTy() ? <div class='tooltip'>DL.getIntPtrType(MidTy)<span class='tooltip-content'>18.0k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>17.7k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_243' href='#L_CASTS_243'><pre>243</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> Type *DstIntPtrTy =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_244' href='#L_CASTS_244'><pre>244</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> DstTy->isPtrOrPtrVectorTy() ? <div class='tooltip'>DL.getIntPtrType(DstTy)<span class='tooltip-content'>25.6k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>10.0k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_245' href='#L_CASTS_245'><pre>245</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> unsigned Res = CastInst::isEliminableCastPair(firstOp, secondOp, SrcTy, MidTy,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_246' href='#L_CASTS_246'><pre>246</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> DstTy, SrcIntPtrTy, MidIntPtrTy,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_247' href='#L_CASTS_247'><pre>247</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> DstIntPtrTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_248' href='#L_CASTS_248'><pre>248</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_249' href='#L_CASTS_249'><pre>249</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> // We don't want to form an inttoptr or ptrtoint that converts to an integer</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_250' href='#L_CASTS_250'><pre>250</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> // type that differs from the pointer size.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_251' href='#L_CASTS_251'><pre>251</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>(Res == Instruction::IntToPtr && <span class='tooltip-content'>35.7k</span></div><div class='tooltip'>SrcTy != DstIntPtrTy<span class='tooltip-content'>513</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_252' href='#L_CASTS_252'><pre>252</pre></a></td><td class='covered-line'><pre>35.3k</pre></td><td class='code'><pre> <div class='tooltip'>(Res == Instruction::PtrToInt && <span class='tooltip-content'>35.3k</span></div><div class='tooltip'>DstTy != SrcIntPtrTy<span class='tooltip-content'>1.20k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_253' href='#L_CASTS_253'><pre>253</pre></a></td><td class='covered-line'><pre>912</pre></td><td class='code'><pre> Res = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_254' href='#L_CASTS_254'><pre>254</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_255' href='#L_CASTS_255'><pre>255</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> return Instruction::CastOps(Res);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_256' href='#L_CASTS_256'><pre>256</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_257' href='#L_CASTS_257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_258' href='#L_CASTS_258'><pre>258</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// @brief Implement the transforms common to all CastInst visitors.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_259' href='#L_CASTS_259'><pre>259</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre>Instruction *InstCombiner::commonCastTransforms(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_260' href='#L_CASTS_260'><pre>260</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_261' href='#L_CASTS_261'><pre>261</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_262' href='#L_CASTS_262'><pre>262</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre> // Try to eliminate a cast of a cast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_263' href='#L_CASTS_263'><pre>263</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>CSrc<span class='tooltip-content'>2.07M</span></div> = dyn_cast<CastInst>(Src)) <div class='tooltip'>{ // A->B->C cast<span class='tooltip-content'>35.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_264' href='#L_CASTS_264'><pre>264</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> if (Instruction::CastOps <div class='tooltip'>NewOpc<span class='tooltip-content'>35.7k</span></div> = isEliminableCastPair(CSrc, &CI)) <div class='tooltip'>{<span class='tooltip-content'>27.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_265' href='#L_CASTS_265'><pre>265</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // The first cast (CSrc) is eliminable so we need to fix up or replace</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_266' href='#L_CASTS_266'><pre>266</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // the second cast (CI). CSrc will then have a good chance of being dead.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_267' href='#L_CASTS_267'><pre>267</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> return CastInst::Create(NewOpc, CSrc->getOperand(0), CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_268' href='#L_CASTS_268'><pre>268</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_269' href='#L_CASTS_269'><pre>269</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_270' href='#L_CASTS_270'><pre>270</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_271' href='#L_CASTS_271'><pre>271</pre></a></td><td class='covered-line'><pre>2.07M</pre></td><td class='code'><pre> // If we are casting a select, then fold the cast into the select.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_272' href='#L_CASTS_272'><pre>272</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>2.04M</span></div><div class='tooltip'>SI<span class='tooltip-content'>2.04M</span></div> = dyn_cast<SelectInst>(Src))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_273' href='#L_CASTS_273'><pre>273</pre></a></td><td class='covered-line'><pre>12.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>12.4k</span></div><div class='tooltip'>NV<span class='tooltip-content'>12.4k</span></div> = FoldOpIntoSelect(CI, SI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_274' href='#L_CASTS_274'><pre>274</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_275' href='#L_CASTS_275'><pre>275</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_276' href='#L_CASTS_276'><pre>276</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre> // If we are casting a PHI, then fold the cast into the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_277' href='#L_CASTS_277'><pre>277</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.04M</span></div><div class='tooltip'>isa<PHINode>(Src)<span class='tooltip-content'>2.04M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>179k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_278' href='#L_CASTS_278'><pre>278</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // Don't do this if it would create a PHI node with an illegal type from a</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_279' href='#L_CASTS_279'><pre>279</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> // legal type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_280' href='#L_CASTS_280'><pre>280</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Src->getType()->isIntegerTy() || <span class='tooltip-content'>179k</span></div><div class='tooltip'>!CI.getType()->isIntegerTy()<span class='tooltip-content'>123k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_281' href='#L_CASTS_281'><pre>281</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> shouldChangeType(CI.getType(), Src->getType()))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_282' href='#L_CASTS_282'><pre>282</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>179k</span></div><div class='tooltip'>NV<span class='tooltip-content'>179k</span></div> = FoldOpIntoPhi(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_283' href='#L_CASTS_283'><pre>283</pre></a></td><td class='covered-line'><pre>586</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_284' href='#L_CASTS_284'><pre>284</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_285' href='#L_CASTS_285'><pre>285</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_286' href='#L_CASTS_286'><pre>286</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_287' href='#L_CASTS_287'><pre>287</pre></a></td><td class='covered-line'><pre>2.04M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_288' href='#L_CASTS_288'><pre>288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_289' href='#L_CASTS_289'><pre>289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we can evaluate the specified expression tree as type Ty</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_290' href='#L_CASTS_290'><pre>290</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instead of its larger type, and arrive with the same value.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_291' href='#L_CASTS_291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is used by code that tries to eliminate truncates.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_292' href='#L_CASTS_292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_293' href='#L_CASTS_293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Ty will always be a type smaller than V. We should return true if trunc(V)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_294' href='#L_CASTS_294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// can be computed by computing V in the smaller type. If V is an instruction,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_295' href='#L_CASTS_295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// then trunc(inst(x,y)) can be computed as inst(trunc(x),trunc(y)), which only</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_296' href='#L_CASTS_296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// makes sense if x and y can be efficiently truncated.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_297' href='#L_CASTS_297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_298' href='#L_CASTS_298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function works on both vectors and scalars.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_299' href='#L_CASTS_299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_300' href='#L_CASTS_300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canEvaluateTruncated(Value *V, Type *Ty, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_301' href='#L_CASTS_301'><pre>301</pre></a></td><td class='covered-line'><pre>98.5k</pre></td><td class='code'><pre> Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_302' href='#L_CASTS_302'><pre>302</pre></a></td><td class='covered-line'><pre>98.5k</pre></td><td class='code'><pre> // We can always evaluate constants in another type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_303' href='#L_CASTS_303'><pre>303</pre></a></td><td class='covered-line'><pre>98.5k</pre></td><td class='code'><pre> if (isa<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_304' href='#L_CASTS_304'><pre>304</pre></a></td><td class='covered-line'><pre>1.95k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_305' href='#L_CASTS_305'><pre>305</pre></a></td><td class='covered-line'><pre>98.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_306' href='#L_CASTS_306'><pre>306</pre></a></td><td class='covered-line'><pre>96.5k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_307' href='#L_CASTS_307'><pre>307</pre></a></td><td class='covered-line'><pre>96.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>96.5k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>2.01k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_308' href='#L_CASTS_308'><pre>308</pre></a></td><td class='covered-line'><pre>96.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_309' href='#L_CASTS_309'><pre>309</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> Type *OrigTy = V->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_310' href='#L_CASTS_310'><pre>310</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_311' href='#L_CASTS_311'><pre>311</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> // If this is an extension from the dest type, we can eliminate it, even if it</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_312' href='#L_CASTS_312'><pre>312</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> // has multiple uses.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_313' href='#L_CASTS_313'><pre>313</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>(isa<ZExtInst>(I) || <span class='tooltip-content'>94.5k</span></div><div class='tooltip'>isa<SExtInst>(I)<span class='tooltip-content'>92.9k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_314' href='#L_CASTS_314'><pre>314</pre></a></td><td class='covered-line'><pre>1.96k</pre></td><td class='code'><pre> I->getOperand(0)->getType() == Ty)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_315' href='#L_CASTS_315'><pre>315</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_316' href='#L_CASTS_316'><pre>316</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_317' href='#L_CASTS_317'><pre>317</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> // We can't extend or shrink something that has multiple uses: doing so would</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_318' href='#L_CASTS_318'><pre>318</pre></a></td><td class='covered-line'><pre>94.5k</pre></td><td class='code'><pre> // require duplicating the instruction in general, which isn't profitable.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_319' href='#L_CASTS_319'><pre>319</pre></a></td><td class='covered-line'><pre>92.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>92.9k</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>92.9k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>40.9k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_320' href='#L_CASTS_320'><pre>320</pre></a></td><td class='covered-line'><pre>92.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_321' href='#L_CASTS_321'><pre>321</pre></a></td><td class='covered-line'><pre>51.9k</pre></td><td class='code'><pre> unsigned Opc = I->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_322' href='#L_CASTS_322'><pre>322</pre></a></td><td class='covered-line'><pre>51.9k</pre></td><td class='code'><pre> switch (Opc) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_323' href='#L_CASTS_323'><pre>323</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_324' href='#L_CASTS_324'><pre>324</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_325' href='#L_CASTS_325'><pre>325</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_326' href='#L_CASTS_326'><pre>326</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_327' href='#L_CASTS_327'><pre>327</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_328' href='#L_CASTS_328'><pre>328</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_329' href='#L_CASTS_329'><pre>329</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> // These operators can all arbitrarily be extended or truncated.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_330' href='#L_CASTS_330'><pre>330</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_331' href='#L_CASTS_331'><pre>331</pre></a></td><td class='covered-line'><pre>2.25k</pre></td><td class='code'><pre> canEvaluateTruncated(I->getOperand(1), Ty, IC, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_332' href='#L_CASTS_332'><pre>332</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_333' href='#L_CASTS_333'><pre>333</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_334' href='#L_CASTS_334'><pre>334</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> case Instruction::URem: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_335' href='#L_CASTS_335'><pre>335</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> // UDiv and URem can be truncated if all the truncated bits are zero.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_336' href='#L_CASTS_336'><pre>336</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_337' href='#L_CASTS_337'><pre>337</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> uint32_t BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_338' href='#L_CASTS_338'><pre>338</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> if (<div class='tooltip'>BitWidth < OrigBitWidth<span class='tooltip-content'>462</span></div>) <div class='tooltip'>{<span class='tooltip-content'>462</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_339' href='#L_CASTS_339'><pre>339</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> APInt Mask = APInt::getHighBitsSet(OrigBitWidth, OrigBitWidth-BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_340' href='#L_CASTS_340'><pre>340</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> if (IC.MaskedValueIsZero(I->getOperand(0), Mask, 0, CxtI) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_341' href='#L_CASTS_341'><pre>341</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> <div class='tooltip'>IC.MaskedValueIsZero(I->getOperand(1), Mask, 0, CxtI)<span class='tooltip-content'>56</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_342' href='#L_CASTS_342'><pre>342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_343' href='#L_CASTS_343'><pre>343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>canEvaluateTruncated(I->getOperand(1), Ty, IC, CxtI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_344' href='#L_CASTS_344'><pre>344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_345' href='#L_CASTS_345'><pre>345</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_346' href='#L_CASTS_346'><pre>346</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_347' href='#L_CASTS_347'><pre>347</pre></a></td><td class='covered-line'><pre>462</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_348' href='#L_CASTS_348'><pre>348</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_349' href='#L_CASTS_349'><pre>349</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> // If we are truncating the result of this SHL, and if it's a shift of a</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_350' href='#L_CASTS_350'><pre>350</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> // constant amount, we can always perform a SHL in a smaller type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_351' href='#L_CASTS_351'><pre>351</pre></a></td><td class='covered-line'><pre>1.53k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>CI<span class='tooltip-content'>1.53k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>591</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_352' href='#L_CASTS_352'><pre>352</pre></a></td><td class='covered-line'><pre>591</pre></td><td class='code'><pre> uint32_t BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_353' href='#L_CASTS_353'><pre>353</pre></a></td><td class='covered-line'><pre>591</pre></td><td class='code'><pre> if (CI->getLimitedValue(BitWidth) < BitWidth)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_354' href='#L_CASTS_354'><pre>354</pre></a></td><td class='covered-line'><pre>591</pre></td><td class='code'><pre> return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_355' href='#L_CASTS_355'><pre>355</pre></a></td><td class='covered-line'><pre>591</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_356' href='#L_CASTS_356'><pre>356</pre></a></td><td class='covered-line'><pre>941</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_357' href='#L_CASTS_357'><pre>357</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_358' href='#L_CASTS_358'><pre>358</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // If this is a truncate of a logical shr, we can truncate it to a smaller</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_359' href='#L_CASTS_359'><pre>359</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // lshr iff we know that the bits we would otherwise be shifting in are</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_360' href='#L_CASTS_360'><pre>360</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // already zeros.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_361' href='#L_CASTS_361'><pre>361</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>CI<span class='tooltip-content'>11.2k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>10.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_362' href='#L_CASTS_362'><pre>362</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_363' href='#L_CASTS_363'><pre>363</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> uint32_t BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_364' href='#L_CASTS_364'><pre>364</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> if (IC.MaskedValueIsZero(I->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_365' href='#L_CASTS_365'><pre>365</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> APInt::getHighBitsSet(OrigBitWidth, OrigBitWidth-BitWidth), 0, CxtI) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_366' href='#L_CASTS_366'><pre>366</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> <div class='tooltip'>CI->getLimitedValue(BitWidth) < BitWidth<span class='tooltip-content'>94</span></div>) <div class='tooltip'>{<span class='tooltip-content'>94</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_367' href='#L_CASTS_367'><pre>367</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_368' href='#L_CASTS_368'><pre>368</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_369' href='#L_CASTS_369'><pre>369</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_370' href='#L_CASTS_370'><pre>370</pre></a></td><td class='covered-line'><pre>11.1k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_371' href='#L_CASTS_371'><pre>371</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> case Instruction::Trunc:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_372' href='#L_CASTS_372'><pre>372</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // trunc(trunc(x)) -> trunc(x)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_373' href='#L_CASTS_373'><pre>373</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_374' href='#L_CASTS_374'><pre>374</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> case Instruction::ZExt:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_375' href='#L_CASTS_375'><pre>375</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> case Instruction::SExt:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_376' href='#L_CASTS_376'><pre>376</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> // trunc(ext(x)) -> ext(x) if the source type is smaller than the new dest</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_377' href='#L_CASTS_377'><pre>377</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> // trunc(ext(x)) -> trunc(x) if the source type is larger than the new dest</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_378' href='#L_CASTS_378'><pre>378</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_379' href='#L_CASTS_379'><pre>379</pre></a></td><td class='covered-line'><pre>408</pre></td><td class='code'><pre> case Instruction::Select: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_380' href='#L_CASTS_380'><pre>380</pre></a></td><td class='covered-line'><pre>408</pre></td><td class='code'><pre> SelectInst *SI = cast<SelectInst>(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_381' href='#L_CASTS_381'><pre>381</pre></a></td><td class='covered-line'><pre>408</pre></td><td class='code'><pre> return canEvaluateTruncated(SI->getTrueValue(), Ty, IC, CxtI) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_382' href='#L_CASTS_382'><pre>382</pre></a></td><td class='covered-line'><pre>92</pre></td><td class='code'><pre> canEvaluateTruncated(SI->getFalseValue(), Ty, IC, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_383' href='#L_CASTS_383'><pre>383</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_384' href='#L_CASTS_384'><pre>384</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_385' href='#L_CASTS_385'><pre>385</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> // We can change a phi if we can change all operands. Note that we never</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_386' href='#L_CASTS_386'><pre>386</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> // get into trouble with cyclic PHIs here because we only consider</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_387' href='#L_CASTS_387'><pre>387</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> // instructions with a single use.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_388' href='#L_CASTS_388'><pre>388</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> PHINode *PN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_389' href='#L_CASTS_389'><pre>389</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> for (Value *IncValue : PN->incoming_values())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_390' href='#L_CASTS_390'><pre>390</pre></a></td><td class='covered-line'><pre>2.89k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.89k</span></div><div class='tooltip'>!canEvaluateTruncated(IncValue, Ty, IC, CxtI)<span class='tooltip-content'>2.89k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_391' href='#L_CASTS_391'><pre>391</pre></a></td><td class='covered-line'><pre>2.02k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_392' href='#L_CASTS_392'><pre>392</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_393' href='#L_CASTS_393'><pre>393</pre></a></td><td class='covered-line'><pre>2.17k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_394' href='#L_CASTS_394'><pre>394</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_395' href='#L_CASTS_395'><pre>395</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> // TODO: Can handle more cases here.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_396' href='#L_CASTS_396'><pre>396</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_397' href='#L_CASTS_397'><pre>397</pre></a></td><td class='covered-line'><pre>51.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_398' href='#L_CASTS_398'><pre>398</pre></a></td><td class='covered-line'><pre>51.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_399' href='#L_CASTS_399'><pre>399</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_400' href='#L_CASTS_400'><pre>400</pre></a></td><td class='covered-line'><pre>51.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_401' href='#L_CASTS_401'><pre>401</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_402' href='#L_CASTS_402'><pre>402</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given a vector that is bitcast to an integer, optionally logically</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_403' href='#L_CASTS_403'><pre>403</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// right-shifted, and truncated, convert it to an extractelement.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_404' href='#L_CASTS_404'><pre>404</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example (big endian):</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_405' href='#L_CASTS_405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// trunc (lshr (bitcast <4 x i32> %X to i128), 32) to i32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_406' href='#L_CASTS_406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ---></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_407' href='#L_CASTS_407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// extractelement <4 x i32> %X, 1</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_408' href='#L_CASTS_408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldVecTruncToExtElt(TruncInst &Trunc, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_409' href='#L_CASTS_409'><pre>409</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_410' href='#L_CASTS_410'><pre>410</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> Value *TruncOp = Trunc.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_411' href='#L_CASTS_411'><pre>411</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> Type *DestType = Trunc.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_412' href='#L_CASTS_412'><pre>412</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>!TruncOp->hasOneUse() || <span class='tooltip-content'>78.2k</span></div><div class='tooltip'>!isa<IntegerType>(DestType)<span class='tooltip-content'>40.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_413' href='#L_CASTS_413'><pre>413</pre></a></td><td class='covered-line'><pre>37.9k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_414' href='#L_CASTS_414'><pre>414</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_415' href='#L_CASTS_415'><pre>415</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre> Value *VecInput = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_416' href='#L_CASTS_416'><pre>416</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre> ConstantInt *ShiftVal = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_417' href='#L_CASTS_417'><pre>417</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre> if (!match(TruncOp, m_CombineOr(m_BitCast(m_Value(VecInput)),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_418' href='#L_CASTS_418'><pre>418</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre> m_LShr(m_BitCast(m_Value(VecInput)),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_419' href='#L_CASTS_419'><pre>419</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre> m_ConstantInt(ShiftVal)))) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_420' href='#L_CASTS_420'><pre>420</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> !isa<VectorType>(VecInput->getType()))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_421' href='#L_CASTS_421'><pre>421</pre></a></td><td class='covered-line'><pre>39.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_422' href='#L_CASTS_422'><pre>422</pre></a></td><td class='covered-line'><pre>40.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_423' href='#L_CASTS_423'><pre>423</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> VectorType *VecType = cast<VectorType>(VecInput->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_424' href='#L_CASTS_424'><pre>424</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> unsigned VecWidth = VecType->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_425' href='#L_CASTS_425'><pre>425</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> unsigned DestWidth = DestType->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_426' href='#L_CASTS_426'><pre>426</pre></a></td><td class='covered-line'><pre>401</pre></td><td class='code'><pre> unsigned ShiftAmount = ShiftVal ? <div class='tooltip'>ShiftVal->getZExtValue()<span class='tooltip-content'>197</span></div> : <div class='tooltip'>0<span class='tooltip-content'>401</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_427' href='#L_CASTS_427'><pre>427</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_428' href='#L_CASTS_428'><pre>428</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> if (<div class='tooltip'>(VecWidth % DestWidth != 0) || <span class='tooltip-content'>598</span></div><div class='tooltip'>(ShiftAmount % DestWidth != 0)<span class='tooltip-content'>598</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_429' href='#L_CASTS_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_430' href='#L_CASTS_430'><pre>430</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_431' href='#L_CASTS_431'><pre>431</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> // If the element type of the vector doesn't match the result type,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_432' href='#L_CASTS_432'><pre>432</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> // bitcast it to a vector type that we can extract from.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_433' href='#L_CASTS_433'><pre>433</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> unsigned NumVecElts = VecWidth / DestWidth;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_434' href='#L_CASTS_434'><pre>434</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> if (<div class='tooltip'>VecType->getElementType() != DestType<span class='tooltip-content'>598</span></div>) <div class='tooltip'>{<span class='tooltip-content'>598</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_435' href='#L_CASTS_435'><pre>435</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> VecType = VectorType::get(DestType, NumVecElts);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_436' href='#L_CASTS_436'><pre>436</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> VecInput = IC.Builder->CreateBitCast(VecInput, VecType, "bc");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_437' href='#L_CASTS_437'><pre>437</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_438' href='#L_CASTS_438'><pre>438</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_439' href='#L_CASTS_439'><pre>439</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> unsigned Elt = ShiftAmount / DestWidth;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_440' href='#L_CASTS_440'><pre>440</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> if (DL.isBigEndian())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_441' href='#L_CASTS_441'><pre>441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Elt = NumVecElts - 1 - Elt</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_442' href='#L_CASTS_442'><pre>442</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_443' href='#L_CASTS_443'><pre>443</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> return ExtractElementInst::Create(VecInput, IC.Builder->getInt32(Elt));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_444' href='#L_CASTS_444'><pre>444</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_445' href='#L_CASTS_445'><pre>445</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_446' href='#L_CASTS_446'><pre>446</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to narrow the width of bitwise logic instructions with constants.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_447' href='#L_CASTS_447'><pre>447</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre>Instruction *InstCombiner::shrinkBitwiseLogic(TruncInst &Trunc) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_448' href='#L_CASTS_448'><pre>448</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> Type *SrcTy = Trunc.getSrcTy();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_449' href='#L_CASTS_449'><pre>449</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> Type *DestTy = Trunc.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_450' href='#L_CASTS_450'><pre>450</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<IntegerType>(SrcTy) && <span class='tooltip-content'>78.4k</span></div><div class='tooltip'>!shouldChangeType(SrcTy, DestTy)<span class='tooltip-content'>78.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_451' href='#L_CASTS_451'><pre>451</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_452' href='#L_CASTS_452'><pre>452</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_453' href='#L_CASTS_453'><pre>453</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre> BinaryOperator *LogicOp;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_454' href='#L_CASTS_454'><pre>454</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre> Constant *C;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_455' href='#L_CASTS_455'><pre>455</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre> if (!match(Trunc.getOperand(0), m_OneUse(m_BinOp(LogicOp))) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_456' href='#L_CASTS_456'><pre>456</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> !LogicOp->isBitwiseLogicOp() ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_457' href='#L_CASTS_457'><pre>457</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> !match(LogicOp->getOperand(1), m_Constant(C)))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_458' href='#L_CASTS_458'><pre>458</pre></a></td><td class='covered-line'><pre>77.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_459' href='#L_CASTS_459'><pre>459</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_460' href='#L_CASTS_460'><pre>460</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre> // trunc (logic X, C) --> logic (trunc X, C')</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_461' href='#L_CASTS_461'><pre>461</pre></a></td><td class='covered-line'><pre>200</pre></td><td class='code'><pre> Constant *NarrowC = ConstantExpr::getTrunc(C, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_462' href='#L_CASTS_462'><pre>462</pre></a></td><td class='covered-line'><pre>200</pre></td><td class='code'><pre> Value *NarrowOp0 = Builder->CreateTrunc(LogicOp->getOperand(0), DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_463' href='#L_CASTS_463'><pre>463</pre></a></td><td class='covered-line'><pre>200</pre></td><td class='code'><pre> return BinaryOperator::Create(LogicOp->getOpcode(), NarrowOp0, NarrowC);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_464' href='#L_CASTS_464'><pre>464</pre></a></td><td class='covered-line'><pre>77.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_465' href='#L_CASTS_465'><pre>465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_466' href='#L_CASTS_466'><pre>466</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to narrow the width of a splat shuffle. This could be generalized to any</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_467' href='#L_CASTS_467'><pre>467</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// shuffle with a constant operand, but we limit the transform to avoid</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_468' href='#L_CASTS_468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// creating a shuffle type that targets may not be able to lower effectively.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_469' href='#L_CASTS_469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *shrinkSplatShuffle(TruncInst &Trunc,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_470' href='#L_CASTS_470'><pre>470</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_471' href='#L_CASTS_471'><pre>471</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> auto *Shuf = dyn_cast<ShuffleVectorInst>(Trunc.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_472' href='#L_CASTS_472'><pre>472</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>Shuf && <span class='tooltip-content'>78.2k</span></div><div class='tooltip'><span class='red'>Shuf->hasOneUse()</span><span class='tooltip-content'>0</span></div> && <div class='tooltip'><span class='red'>isa<UndefValue>(Shuf->getOperand(1))</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_473' href='#L_CASTS_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Shuf->getMask()->getSplatValue()</span> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_474' href='#L_CASTS_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>Shuf->getType() == Shuf->getOperand(0)->getType()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_475' href='#L_CASTS_475'><pre>475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // trunc (shuf X, Undef, SplatMask) --> shuf (trunc X), Undef, SplatMask</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_476' href='#L_CASTS_476'><pre>476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *NarrowUndef = UndefValue::get(Trunc.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_477' href='#L_CASTS_477'><pre>477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NarrowOp = Builder.CreateTrunc(Shuf->getOperand(0), Trunc.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_478' href='#L_CASTS_478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ShuffleVectorInst(NarrowOp, NarrowUndef, Shuf->getMask());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_479' href='#L_CASTS_479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_480' href='#L_CASTS_480'><pre>480</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_481' href='#L_CASTS_481'><pre>481</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_482' href='#L_CASTS_482'><pre>482</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_483' href='#L_CASTS_483'><pre>483</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_484' href='#L_CASTS_484'><pre>484</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to narrow the width of an insert element. This could be generalized for</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_485' href='#L_CASTS_485'><pre>485</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// any vector constant, but we limit the transform to insertion into undef to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_486' href='#L_CASTS_486'><pre>486</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// avoid potential backend problems from unsupported insertion widths. This</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_487' href='#L_CASTS_487'><pre>487</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// could also be extended to handle the case of inserting a scalar constant</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_488' href='#L_CASTS_488'><pre>488</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into a vector variable.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_489' href='#L_CASTS_489'><pre>489</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *shrinkInsertElt(CastInst &Trunc,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_490' href='#L_CASTS_490'><pre>490</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_491' href='#L_CASTS_491'><pre>491</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> Instruction::CastOps Opcode = Trunc.getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_492' href='#L_CASTS_492'><pre>492</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> assert((Opcode == Instruction::Trunc || Opcode == Instruction::FPTrunc) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_493' href='#L_CASTS_493'><pre>493</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> "Unexpected instruction for shrinking");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_494' href='#L_CASTS_494'><pre>494</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_495' href='#L_CASTS_495'><pre>495</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> auto *InsElt = dyn_cast<InsertElementInst>(Trunc.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_496' href='#L_CASTS_496'><pre>496</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>!InsElt || <span class='tooltip-content'>82.2k</span></div><div class='tooltip'><span class='red'>!InsElt->hasOneUse()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_497' href='#L_CASTS_497'><pre>497</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_498' href='#L_CASTS_498'><pre>498</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_499' href='#L_CASTS_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Type *DestTy = Trunc.getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_500' href='#L_CASTS_500'><pre>500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *DestScalarTy = DestTy->getScalarType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_501' href='#L_CASTS_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *VecOp = InsElt->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_502' href='#L_CASTS_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ScalarOp = InsElt->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_503' href='#L_CASTS_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Index = InsElt->getOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_504' href='#L_CASTS_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_505' href='#L_CASTS_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<UndefValue>(VecOp)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_506' href='#L_CASTS_506'><pre>506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // trunc (inselt undef, X, Index) --> inselt undef, (trunc X), Index</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_507' href='#L_CASTS_507'><pre>507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fptrunc (inselt undef, X, Index) --> inselt undef, (fptrunc X), Index</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_508' href='#L_CASTS_508'><pre>508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue *NarrowUndef = UndefValue::get(DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_509' href='#L_CASTS_509'><pre>509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NarrowOp = Builder.CreateCast(Opcode, ScalarOp, DestScalarTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_510' href='#L_CASTS_510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertElementInst::Create(NarrowUndef, NarrowOp, Index);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_511' href='#L_CASTS_511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_512' href='#L_CASTS_512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_513' href='#L_CASTS_513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_514' href='#L_CASTS_514'><pre>514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_515' href='#L_CASTS_515'><pre>515</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_516' href='#L_CASTS_516'><pre>516</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitTrunc(TruncInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_517' href='#L_CASTS_517'><pre>517</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre> if (Instruction *Result = commonCastTransforms(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_518' href='#L_CASTS_518'><pre>518</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> return Result;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_519' href='#L_CASTS_519'><pre>519</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_520' href='#L_CASTS_520'><pre>520</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre> // Test if the trunc is the user of a select which is part of a</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_521' href='#L_CASTS_521'><pre>521</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre> // minimum or maximum operation. If so, don't do any more simplification.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_522' href='#L_CASTS_522'><pre>522</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre> // Even simplifying demanded bits can break the canonical form of a</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_523' href='#L_CASTS_523'><pre>523</pre></a></td><td class='covered-line'><pre>84.2k</pre></td><td class='code'><pre> // min/max.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_524' href='#L_CASTS_524'><pre>524</pre></a></td><td class='covered-line'><pre>83.3k</pre></td><td class='code'><pre> Value *LHS, *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_525' href='#L_CASTS_525'><pre>525</pre></a></td><td class='covered-line'><pre>83.3k</pre></td><td class='code'><pre> if (SelectInst *SI = dyn_cast<SelectInst>(CI.getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_526' href='#L_CASTS_526'><pre>526</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.20k</span></div><div class='tooltip'>matchSelectPattern(SI, LHS, RHS).Flavor != SPF_UNKNOWN<span class='tooltip-content'>2.20k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_527' href='#L_CASTS_527'><pre>527</pre></a></td><td class='covered-line'><pre>1.61k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_528' href='#L_CASTS_528'><pre>528</pre></a></td><td class='covered-line'><pre>83.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_529' href='#L_CASTS_529'><pre>529</pre></a></td><td class='covered-line'><pre>83.3k</pre></td><td class='code'><pre> // See if we can simplify any instructions used by the input whose sole</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_530' href='#L_CASTS_530'><pre>530</pre></a></td><td class='covered-line'><pre>83.3k</pre></td><td class='code'><pre> // purpose is to compute bits we don't care about.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_531' href='#L_CASTS_531'><pre>531</pre></a></td><td class='covered-line'><pre>81.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>81.7k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(CI)<span class='tooltip-content'>81.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_532' href='#L_CASTS_532'><pre>532</pre></a></td><td class='covered-line'><pre>953</pre></td><td class='code'><pre> return &CI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_533' href='#L_CASTS_533'><pre>533</pre></a></td><td class='covered-line'><pre>81.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_534' href='#L_CASTS_534'><pre>534</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_535' href='#L_CASTS_535'><pre>535</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> Type *DestTy = CI.getType(), *SrcTy = Src->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_536' href='#L_CASTS_536'><pre>536</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_537' href='#L_CASTS_537'><pre>537</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // Attempt to truncate the entire input expression tree to the destination</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_538' href='#L_CASTS_538'><pre>538</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // type. Only do this if the dest type is a simple type, don't convert the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_539' href='#L_CASTS_539'><pre>539</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // expression tree to something weird like i93 unless the source is also</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_540' href='#L_CASTS_540'><pre>540</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // strange.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_541' href='#L_CASTS_541'><pre>541</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>(DestTy->isVectorTy() || <span class='tooltip-content'>80.7k</span></div><div class='tooltip'>shouldChangeType(SrcTy, DestTy)<span class='tooltip-content'>80.7k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_542' href='#L_CASTS_542'><pre>542</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> <div class='tooltip'>canEvaluateTruncated(Src, DestTy, *this, &CI)<span class='tooltip-content'>79.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>758</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_543' href='#L_CASTS_543'><pre>543</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_544' href='#L_CASTS_544'><pre>544</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> // If this cast is a truncate, evaluting in a different type always</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_545' href='#L_CASTS_545'><pre>545</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> // eliminates the cast, so it is always a win.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_546' href='#L_CASTS_546'><pre>546</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> DEBUG(dbgs() << "ICE: EvaluateInDifferentType converting expression type"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_547' href='#L_CASTS_547'><pre>547</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> " to avoid cast: " << CI << '\n');</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_548' href='#L_CASTS_548'><pre>548</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> Value *Res = EvaluateInDifferentType(Src, DestTy, false);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_549' href='#L_CASTS_549'><pre>549</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> assert(Res->getType() == DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_550' href='#L_CASTS_550'><pre>550</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, Res);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_551' href='#L_CASTS_551'><pre>551</pre></a></td><td class='covered-line'><pre>758</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_552' href='#L_CASTS_552'><pre>552</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_553' href='#L_CASTS_553'><pre>553</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // Canonicalize trunc x to i1 -> (icmp ne (and x, 1), 0), likewise for vector.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_554' href='#L_CASTS_554'><pre>554</pre></a></td><td class='covered-line'><pre>80.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>80.0k</span></div><div class='tooltip'>DestTy->getScalarSizeInBits() == 1<span class='tooltip-content'>80.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.52k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_555' href='#L_CASTS_555'><pre>555</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> Constant *One = ConstantInt::get(SrcTy, 1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_556' href='#L_CASTS_556'><pre>556</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> Src = Builder->CreateAnd(Src, One);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_557' href='#L_CASTS_557'><pre>557</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> Value *Zero = Constant::getNullValue(Src->getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_558' href='#L_CASTS_558'><pre>558</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Src, Zero);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_559' href='#L_CASTS_559'><pre>559</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_560' href='#L_CASTS_560'><pre>560</pre></a></td><td class='covered-line'><pre>80.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_561' href='#L_CASTS_561'><pre>561</pre></a></td><td class='covered-line'><pre>80.0k</pre></td><td class='code'><pre> // Transform trunc(lshr (zext A), Cst) to eliminate one type conversion.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_562' href='#L_CASTS_562'><pre>562</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> Value *A = nullptr; ConstantInt *Cst = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_563' href='#L_CASTS_563'><pre>563</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> if (Src->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_564' href='#L_CASTS_564'><pre>564</pre></a></td><td class='covered-line'><pre>40.5k</pre></td><td class='code'><pre> <div class='tooltip'>match(Src, m_LShr(m_ZExt(m_Value(A)), m_ConstantInt(Cst)))<span class='tooltip-content'>40.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_565' href='#L_CASTS_565'><pre>565</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // We have three types to worry about here, the type of A, the source of</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_566' href='#L_CASTS_566'><pre>566</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // the truncate (MidSize), and the destination of the truncate. We know that</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_567' href='#L_CASTS_567'><pre>567</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // ASize < MidSize and MidSize > ResultSize, but don't know the relation</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_568' href='#L_CASTS_568'><pre>568</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // between ASize and ResultSize.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_569' href='#L_CASTS_569'><pre>569</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> unsigned ASize = A->getType()->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_570' href='#L_CASTS_570'><pre>570</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_571' href='#L_CASTS_571'><pre>571</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // If the shift amount is larger than the size of A, then the result is</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_572' href='#L_CASTS_572'><pre>572</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // known to be zero because all the input bits got shifted out.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_573' href='#L_CASTS_573'><pre>573</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (Cst->getZExtValue() >= ASize)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_574' href='#L_CASTS_574'><pre>574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(CI, Constant::getNullValue(DestTy))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_575' href='#L_CASTS_575'><pre>575</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_576' href='#L_CASTS_576'><pre>576</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // Since we're doing an lshr and a zero extend, and know that the shift</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_577' href='#L_CASTS_577'><pre>577</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // amount is smaller than ASize, it is always safe to do the shift in A's</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_578' href='#L_CASTS_578'><pre>578</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // type, then zero extend or truncate to the result.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_579' href='#L_CASTS_579'><pre>579</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *Shift = Builder->CreateLShr(A, Cst->getZExtValue());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_580' href='#L_CASTS_580'><pre>580</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Shift->takeName(Src);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_581' href='#L_CASTS_581'><pre>581</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return CastInst::CreateIntegerCast(Shift, DestTy, false);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_582' href='#L_CASTS_582'><pre>582</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_583' href='#L_CASTS_583'><pre>583</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_584' href='#L_CASTS_584'><pre>584</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // Transform trunc(lshr (sext A), Cst) to ashr A, Cst to eliminate type</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_585' href='#L_CASTS_585'><pre>585</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // conversion.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_586' href='#L_CASTS_586'><pre>586</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // It works because bits coming from sign extension have the same value as</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_587' href='#L_CASTS_587'><pre>587</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // the sign bit of the original value; performing ashr instead of lshr</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_588' href='#L_CASTS_588'><pre>588</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // generates bits of the same value as the sign bit.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_589' href='#L_CASTS_589'><pre>589</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>78.4k</span></div><div class='tooltip'>Src->hasOneUse() &&<span class='tooltip-content'>78.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_590' href='#L_CASTS_590'><pre>590</pre></a></td><td class='covered-line'><pre>40.5k</pre></td><td class='code'><pre> match(Src, m_LShr(m_SExt(m_Value(A)), m_ConstantInt(Cst))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_591' href='#L_CASTS_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>cast<Instruction>(Src)->getOperand(0)->hasOneUse()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_592' href='#L_CASTS_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const unsigned ASize = A->getType()->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_593' href='#L_CASTS_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This optimization can be only performed when zero bits generated by</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_594' href='#L_CASTS_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the original lshr aren't pulled into the value after truncation, so we</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_595' href='#L_CASTS_595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // can only shift by values smaller than the size of destination type (in</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_596' href='#L_CASTS_596'><pre>596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bits).</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_597' href='#L_CASTS_597'><pre>597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Cst->getValue().ult(ASize)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_598' href='#L_CASTS_598'><pre>598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Shift = Builder->CreateAShr(A, Cst->getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_599' href='#L_CASTS_599'><pre>599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Shift->takeName(Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_600' href='#L_CASTS_600'><pre>600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::CreateIntegerCast(Shift, CI.getType(), true);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_601' href='#L_CASTS_601'><pre>601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_602' href='#L_CASTS_602'><pre>602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_603' href='#L_CASTS_603'><pre>603</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_604' href='#L_CASTS_604'><pre>604</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>78.4k</span></div><div class='tooltip'>I<span class='tooltip-content'>78.4k</span></div> = shrinkBitwiseLogic(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_605' href='#L_CASTS_605'><pre>605</pre></a></td><td class='covered-line'><pre>200</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_606' href='#L_CASTS_606'><pre>606</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_607' href='#L_CASTS_607'><pre>607</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>78.2k</span></div><div class='tooltip'>I<span class='tooltip-content'>78.2k</span></div> = shrinkSplatShuffle(CI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_608' href='#L_CASTS_608'><pre>608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_609' href='#L_CASTS_609'><pre>609</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_610' href='#L_CASTS_610'><pre>610</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>78.2k</span></div><div class='tooltip'>I<span class='tooltip-content'>78.2k</span></div> = shrinkInsertElt(CI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_611' href='#L_CASTS_611'><pre>611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_612' href='#L_CASTS_612'><pre>612</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_613' href='#L_CASTS_613'><pre>613</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>78.2k</span></div><div class='tooltip'>Src->hasOneUse() && <span class='tooltip-content'>78.2k</span></div><div class='tooltip'>isa<IntegerType>(SrcTy)<span class='tooltip-content'>40.3k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_614' href='#L_CASTS_614'><pre>614</pre></a></td><td class='covered-line'><pre>40.3k</pre></td><td class='code'><pre> <div class='tooltip'>shouldChangeType(SrcTy, DestTy)<span class='tooltip-content'>40.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>39.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_615' href='#L_CASTS_615'><pre>615</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> // Transform "trunc (shl X, cst)" -> "shl (trunc X), cst" so long as the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_616' href='#L_CASTS_616'><pre>616</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> // dest type is native and cst < dest size.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_617' href='#L_CASTS_617'><pre>617</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> if (match(Src, m_Shl(m_Value(A), m_ConstantInt(Cst))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_618' href='#L_CASTS_618'><pre>618</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> <div class='tooltip'>!match(A, m_Shr(m_Value(), m_Constant()))<span class='tooltip-content'>56</span></div>) <div class='tooltip'>{<span class='tooltip-content'>41</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_619' href='#L_CASTS_619'><pre>619</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> // Skip shifts of shift by constants. It undoes a combine in</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_620' href='#L_CASTS_620'><pre>620</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> // FoldShiftByConstant and is the extend in reg pattern.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_621' href='#L_CASTS_621'><pre>621</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> const unsigned DestSize = DestTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_622' href='#L_CASTS_622'><pre>622</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> if (<div class='tooltip'>Cst->getValue().ult(DestSize)<span class='tooltip-content'>41</span></div>) <div class='tooltip'>{<span class='tooltip-content'>41</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_623' href='#L_CASTS_623'><pre>623</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> Value *NewTrunc = Builder->CreateTrunc(A, DestTy, A->getName() + ".tr");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_624' href='#L_CASTS_624'><pre>624</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_625' href='#L_CASTS_625'><pre>625</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> return BinaryOperator::Create(</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_626' href='#L_CASTS_626'><pre>626</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> Instruction::Shl, NewTrunc,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_627' href='#L_CASTS_627'><pre>627</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> ConstantInt::get(DestTy, Cst->getValue().trunc(DestSize)));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_628' href='#L_CASTS_628'><pre>628</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_629' href='#L_CASTS_629'><pre>629</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_630' href='#L_CASTS_630'><pre>630</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_631' href='#L_CASTS_631'><pre>631</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_632' href='#L_CASTS_632'><pre>632</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>78.2k</span></div><div class='tooltip'>I<span class='tooltip-content'>78.2k</span></div> = foldVecTruncToExtElt(CI, *this, DL))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_633' href='#L_CASTS_633'><pre>633</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_634' href='#L_CASTS_634'><pre>634</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_635' href='#L_CASTS_635'><pre>635</pre></a></td><td class='covered-line'><pre>77.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_636' href='#L_CASTS_636'><pre>636</pre></a></td><td class='covered-line'><pre>78.2k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_637' href='#L_CASTS_637'><pre>637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_638' href='#L_CASTS_638'><pre>638</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::transformZExtICmp(ICmpInst *ICI, ZExtInst &CI,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_639' href='#L_CASTS_639'><pre>639</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> bool DoTransform) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_640' href='#L_CASTS_640'><pre>640</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // If we are just checking for a icmp eq of a single bit and zext'ing it</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_641' href='#L_CASTS_641'><pre>641</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // to an integer, then shift the bit to the appropriate place and then</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_642' href='#L_CASTS_642'><pre>642</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // cast to integer to avoid the comparison.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_643' href='#L_CASTS_643'><pre>643</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Op1C<span class='tooltip-content'>23.7k</span></div> = dyn_cast<ConstantInt>(ICI->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>16.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_644' href='#L_CASTS_644'><pre>644</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> const APInt &Op1CV = Op1C->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_645' href='#L_CASTS_645'><pre>645</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_646' href='#L_CASTS_646'><pre>646</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (x <s 0) to i32 --> x>>u31 true if signbit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_647' href='#L_CASTS_647'><pre>647</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (x >s -1) to i32 --> (x>>u31)^1 true if signbit clear.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_648' href='#L_CASTS_648'><pre>648</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>(ICI->getPredicate() == ICmpInst::ICMP_SLT && <span class='tooltip-content'>16.0k</span></div><div class='tooltip'>Op1CV == 0<span class='tooltip-content'>210</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_649' href='#L_CASTS_649'><pre>649</pre></a></td><td class='covered-line'><pre>15.9k</pre></td><td class='code'><pre> <div class='tooltip'>(ICI->getPredicate() == ICmpInst::ICMP_SGT && <span class='tooltip-content'>15.9k</span></div><div class='tooltip'>Op1CV.isAllOnesValue()<span class='tooltip-content'>899</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>59</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_650' href='#L_CASTS_650'><pre>650</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> if (<div class='tooltip'>!DoTransform<span class='tooltip-content'>59</span></div>) <div class='tooltip'>return ICI<span class='tooltip-content'>8</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_651' href='#L_CASTS_651'><pre>651</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_652' href='#L_CASTS_652'><pre>652</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Value *In = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_653' href='#L_CASTS_653'><pre>653</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Value *Sh = ConstantInt::get(In->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_654' href='#L_CASTS_654'><pre>654</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> In->getType()->getScalarSizeInBits() - 1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_655' href='#L_CASTS_655'><pre>655</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> In = Builder->CreateLShr(In, Sh, In->getName() + ".lobit");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_656' href='#L_CASTS_656'><pre>656</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> if (In->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_657' href='#L_CASTS_657'><pre>657</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> In = Builder->CreateIntCast(In, CI.getType(), false/*ZExt*/);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_658' href='#L_CASTS_658'><pre>658</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_659' href='#L_CASTS_659'><pre>659</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> if (<div class='tooltip'>ICI->getPredicate() == ICmpInst::ICMP_SGT<span class='tooltip-content'>51</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_660' href='#L_CASTS_660'><pre>660</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Constant *One = ConstantInt::get(In->getType(), 1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_661' href='#L_CASTS_661'><pre>661</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> In = Builder->CreateXor(In, One, In->getName() + ".not");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_662' href='#L_CASTS_662'><pre>662</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_663' href='#L_CASTS_663'><pre>663</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_664' href='#L_CASTS_664'><pre>664</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, In);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_665' href='#L_CASTS_665'><pre>665</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_666' href='#L_CASTS_666'><pre>666</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_667' href='#L_CASTS_667'><pre>667</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X == 0) to i32 --> X^1 iff X has only the low bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_668' href='#L_CASTS_668'><pre>668</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X == 0) to i32 --> (X>>1)^1 iff X has only the 2nd bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_669' href='#L_CASTS_669'><pre>669</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X == 1) to i32 --> X iff X has only the low bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_670' href='#L_CASTS_670'><pre>670</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X == 2) to i32 --> X>>1 iff X has only the 2nd bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_671' href='#L_CASTS_671'><pre>671</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X != 0) to i32 --> X iff X has only the low bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_672' href='#L_CASTS_672'><pre>672</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X != 0) to i32 --> X>>1 iff X has only the 2nd bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_673' href='#L_CASTS_673'><pre>673</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X != 1) to i32 --> X^1 iff X has only the low bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_674' href='#L_CASTS_674'><pre>674</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> // zext (X != 2) to i32 --> (X>>1)^1 iff X has only the 2nd bit set.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_675' href='#L_CASTS_675'><pre>675</pre></a></td><td class='covered-line'><pre>15.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.9k</span></div><div class='tooltip'>(Op1CV == 0 || <span class='tooltip-content'>15.9k</span></div><div class='tooltip'>Op1CV.isPowerOf2()<span class='tooltip-content'>7.09k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_676' href='#L_CASTS_676'><pre>676</pre></a></td><td class='covered-line'><pre>15.9k</pre></td><td class='code'><pre> // This only works for EQ and NE</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_677' href='#L_CASTS_677'><pre>677</pre></a></td><td class='covered-line'><pre>11.4k</pre></td><td class='code'><pre> <div class='tooltip'>ICI->isEquality()<span class='tooltip-content'>11.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_678' href='#L_CASTS_678'><pre>678</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> // If Op1C some other power of two, convert:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_679' href='#L_CASTS_679'><pre>679</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> uint32_t BitWidth = Op1C->getType()->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_680' href='#L_CASTS_680'><pre>680</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_681' href='#L_CASTS_681'><pre>681</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> computeKnownBits(ICI->getOperand(0), KnownZero, KnownOne, 0, &CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_682' href='#L_CASTS_682'><pre>682</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_683' href='#L_CASTS_683'><pre>683</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> APInt KnownZeroMask(~KnownZero);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_684' href='#L_CASTS_684'><pre>684</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>KnownZeroMask.isPowerOf2()<span class='tooltip-content'>10.0k</span></div>) <div class='tooltip'>{ // Exactly 1 possible 1?<span class='tooltip-content'>403</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_685' href='#L_CASTS_685'><pre>685</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> if (<div class='tooltip'>!DoTransform<span class='tooltip-content'>403</span></div>) <div class='tooltip'><span class='red'>return ICI</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_686' href='#L_CASTS_686'><pre>686</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_687' href='#L_CASTS_687'><pre>687</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> bool isNE = ICI->getPredicate() == ICmpInst::ICMP_NE;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_688' href='#L_CASTS_688'><pre>688</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> if (<div class='tooltip'>Op1CV != 0 && <span class='tooltip-content'>403</span></div><div class='tooltip'>(Op1CV != KnownZeroMask)<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_689' href='#L_CASTS_689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X&4) == 2 --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_690' href='#L_CASTS_690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X&4) != 2 --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_691' href='#L_CASTS_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Res = ConstantInt::get(Type::getInt1Ty(CI.getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_692' href='#L_CASTS_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isNE);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_693' href='#L_CASTS_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Res = ConstantExpr::getZExt(Res, CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_694' href='#L_CASTS_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, Res);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_695' href='#L_CASTS_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_696' href='#L_CASTS_696'><pre>696</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_697' href='#L_CASTS_697'><pre>697</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> uint32_t ShAmt = KnownZeroMask.logBase2();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_698' href='#L_CASTS_698'><pre>698</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> Value *In = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_699' href='#L_CASTS_699'><pre>699</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> if (<div class='tooltip'>ShAmt<span class='tooltip-content'>403</span></div>) <div class='tooltip'>{<span class='tooltip-content'>151</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_700' href='#L_CASTS_700'><pre>700</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> // Perform a logical shr by shiftamt.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_701' href='#L_CASTS_701'><pre>701</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> // Insert the shift to put the result in the low bit.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_702' href='#L_CASTS_702'><pre>702</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> In = Builder->CreateLShr(In, ConstantInt::get(In->getType(), ShAmt),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_703' href='#L_CASTS_703'><pre>703</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> In->getName() + ".lobit");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_704' href='#L_CASTS_704'><pre>704</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_705' href='#L_CASTS_705'><pre>705</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_706' href='#L_CASTS_706'><pre>706</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> if (<div class='tooltip'>(Op1CV != 0) == isNE<span class='tooltip-content'>403</span></div>) <div class='tooltip'>{ // Toggle the low bit.<span class='tooltip-content'>43</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_707' href='#L_CASTS_707'><pre>707</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> Constant *One = ConstantInt::get(In->getType(), 1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_708' href='#L_CASTS_708'><pre>708</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> In = Builder->CreateXor(In, One);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_709' href='#L_CASTS_709'><pre>709</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_710' href='#L_CASTS_710'><pre>710</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_711' href='#L_CASTS_711'><pre>711</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> if (CI.getType() == In->getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_712' href='#L_CASTS_712'><pre>712</pre></a></td><td class='covered-line'><pre>308</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, In);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_713' href='#L_CASTS_713'><pre>713</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_714' href='#L_CASTS_714'><pre>714</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> Value *IntCast = Builder->CreateIntCast(In, CI.getType(), false);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_715' href='#L_CASTS_715'><pre>715</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, IntCast);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_716' href='#L_CASTS_716'><pre>716</pre></a></td><td class='covered-line'><pre>403</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_717' href='#L_CASTS_717'><pre>717</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_718' href='#L_CASTS_718'><pre>718</pre></a></td><td class='covered-line'><pre>15.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_719' href='#L_CASTS_719'><pre>719</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_720' href='#L_CASTS_720'><pre>720</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // icmp ne A, B is equal to xor A, B when A and B only really have one bit.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_721' href='#L_CASTS_721'><pre>721</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // It is also profitable to transform icmp eq into not(xor(A, B)) because that</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_722' href='#L_CASTS_722'><pre>722</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // may lead to additional simplifications.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_723' href='#L_CASTS_723'><pre>723</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>23.2k</span></div><div class='tooltip'>ICI->isEquality() && <span class='tooltip-content'>23.2k</span></div><div class='tooltip'>CI.getType() == ICI->getOperand(0)->getType()<span class='tooltip-content'>19.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.91k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_724' href='#L_CASTS_724'><pre>724</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> if (IntegerType *<div class='tooltip'>ITy<span class='tooltip-content'>9.91k</span></div> = dyn_cast<IntegerType>(CI.getType())) <div class='tooltip'>{<span class='tooltip-content'>9.91k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_725' href='#L_CASTS_725'><pre>725</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> uint32_t BitWidth = ITy->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_726' href='#L_CASTS_726'><pre>726</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> Value *LHS = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_727' href='#L_CASTS_727'><pre>727</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> Value *RHS = ICI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_728' href='#L_CASTS_728'><pre>728</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_729' href='#L_CASTS_729'><pre>729</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> APInt KnownZeroLHS(BitWidth, 0), KnownOneLHS(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_730' href='#L_CASTS_730'><pre>730</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> APInt KnownZeroRHS(BitWidth, 0), KnownOneRHS(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_731' href='#L_CASTS_731'><pre>731</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> computeKnownBits(LHS, KnownZeroLHS, KnownOneLHS, 0, &CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_732' href='#L_CASTS_732'><pre>732</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> computeKnownBits(RHS, KnownZeroRHS, KnownOneRHS, 0, &CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_733' href='#L_CASTS_733'><pre>733</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_734' href='#L_CASTS_734'><pre>734</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> if (<div class='tooltip'>KnownZeroLHS == KnownZeroRHS && <span class='tooltip-content'>9.91k</span></div><div class='tooltip'>KnownOneLHS == KnownOneRHS<span class='tooltip-content'>2.21k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.10k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_735' href='#L_CASTS_735'><pre>735</pre></a></td><td class='covered-line'><pre>2.10k</pre></td><td class='code'><pre> APInt KnownBits = KnownZeroLHS | KnownOneLHS;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_736' href='#L_CASTS_736'><pre>736</pre></a></td><td class='covered-line'><pre>2.10k</pre></td><td class='code'><pre> APInt UnknownBit = ~KnownBits;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_737' href='#L_CASTS_737'><pre>737</pre></a></td><td class='covered-line'><pre>2.10k</pre></td><td class='code'><pre> if (<div class='tooltip'>UnknownBit.countPopulation() == 1<span class='tooltip-content'>2.10k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_738' href='#L_CASTS_738'><pre>738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DoTransform</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return ICI</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_739' href='#L_CASTS_739'><pre>739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_740' href='#L_CASTS_740'><pre>740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Result = Builder->CreateXor(LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_741' href='#L_CASTS_741'><pre>741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_742' href='#L_CASTS_742'><pre>742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Mask off any bits that are set and won't be shifted away.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_743' href='#L_CASTS_743'><pre>743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>KnownOneLHS.uge(UnknownBit)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_744' href='#L_CASTS_744'><pre>744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Result = Builder->CreateAnd(Result,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_745' href='#L_CASTS_745'><pre>745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(ITy, UnknownBit))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_746' href='#L_CASTS_746'><pre>746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_747' href='#L_CASTS_747'><pre>747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Shift the bit we're testing down to the lsb.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_748' href='#L_CASTS_748'><pre>748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result = Builder->CreateLShr(</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_749' href='#L_CASTS_749'><pre>749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result, ConstantInt::get(ITy, UnknownBit.countTrailingZeros()));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_750' href='#L_CASTS_750'><pre>750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_751' href='#L_CASTS_751'><pre>751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ICI->getPredicate() == ICmpInst::ICMP_EQ</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_752' href='#L_CASTS_752'><pre>752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Result = Builder->CreateXor(Result, ConstantInt::get(ITy, 1))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_753' href='#L_CASTS_753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result->takeName(ICI);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_754' href='#L_CASTS_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, Result)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_755' href='#L_CASTS_755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_756' href='#L_CASTS_756'><pre>756</pre></a></td><td class='covered-line'><pre>2.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_757' href='#L_CASTS_757'><pre>757</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_758' href='#L_CASTS_758'><pre>758</pre></a></td><td class='covered-line'><pre>9.91k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_759' href='#L_CASTS_759'><pre>759</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_760' href='#L_CASTS_760'><pre>760</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_761' href='#L_CASTS_761'><pre>761</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_762' href='#L_CASTS_762'><pre>762</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_763' href='#L_CASTS_763'><pre>763</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Determine if the specified value can be computed in the specified wider type</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_764' href='#L_CASTS_764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and produce the same low bits. If not, return false.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_765' href='#L_CASTS_765'><pre>765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_766' href='#L_CASTS_766'><pre>766</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If this function returns true, it can also return a non-zero number of bits</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_767' href='#L_CASTS_767'><pre>767</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (in BitsToClear) which indicates that the value it computes is correct for</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_768' href='#L_CASTS_768'><pre>768</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the zero extend, but that the additional BitsToClear bits need to be zero'd</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_769' href='#L_CASTS_769'><pre>769</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// out. For example, to promote something like:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_770' href='#L_CASTS_770'><pre>770</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_771' href='#L_CASTS_771'><pre>771</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %B = trunc i64 %A to i32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_772' href='#L_CASTS_772'><pre>772</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %C = lshr i32 %B, 8</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_773' href='#L_CASTS_773'><pre>773</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %E = zext i32 %C to i64</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_774' href='#L_CASTS_774'><pre>774</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_775' href='#L_CASTS_775'><pre>775</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// CanEvaluateZExtd for the 'lshr' will return true, and BitsToClear will be</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_776' href='#L_CASTS_776'><pre>776</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// set to 8 to indicate that the promoted value needs to have bits 24-31</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_777' href='#L_CASTS_777'><pre>777</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// cleared in addition to bits 32-63. Since an 'and' will be generated to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_778' href='#L_CASTS_778'><pre>778</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// clear the top bits anyway, doing this has no extra cost.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_779' href='#L_CASTS_779'><pre>779</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_780' href='#L_CASTS_780'><pre>780</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function works on both vectors and scalars.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_781' href='#L_CASTS_781'><pre>781</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canEvaluateZExtd(Value *V, Type *Ty, unsigned &BitsToClear,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_782' href='#L_CASTS_782'><pre>782</pre></a></td><td class='covered-line'><pre>293k</pre></td><td class='code'><pre> InstCombiner &IC, Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_783' href='#L_CASTS_783'><pre>783</pre></a></td><td class='covered-line'><pre>293k</pre></td><td class='code'><pre> BitsToClear = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_784' href='#L_CASTS_784'><pre>784</pre></a></td><td class='covered-line'><pre>293k</pre></td><td class='code'><pre> if (isa<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_785' href='#L_CASTS_785'><pre>785</pre></a></td><td class='covered-line'><pre>4.50k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_786' href='#L_CASTS_786'><pre>786</pre></a></td><td class='covered-line'><pre>293k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_787' href='#L_CASTS_787'><pre>787</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_788' href='#L_CASTS_788'><pre>788</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>289k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>15.1k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_789' href='#L_CASTS_789'><pre>789</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_790' href='#L_CASTS_790'><pre>790</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> // If the input is a truncate from the destination type, we can trivially</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_791' href='#L_CASTS_791'><pre>791</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> // eliminate it.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_792' href='#L_CASTS_792'><pre>792</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>273k</span></div><div class='tooltip'>isa<TruncInst>(I) && <span class='tooltip-content'>273k</span></div><div class='tooltip'>I->getOperand(0)->getType() == Ty<span class='tooltip-content'>845</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_793' href='#L_CASTS_793'><pre>793</pre></a></td><td class='covered-line'><pre>771</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_794' href='#L_CASTS_794'><pre>794</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_795' href='#L_CASTS_795'><pre>795</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> // We can't extend or shrink something that has multiple uses: doing so would</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_796' href='#L_CASTS_796'><pre>796</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> // require duplicating the instruction in general, which isn't profitable.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_797' href='#L_CASTS_797'><pre>797</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>273k</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>273k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>128k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_798' href='#L_CASTS_798'><pre>798</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_799' href='#L_CASTS_799'><pre>799</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre> unsigned Opc = I->getOpcode(), Tmp;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_800' href='#L_CASTS_800'><pre>800</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre> switch (Opc) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_801' href='#L_CASTS_801'><pre>801</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> case Instruction::ZExt: // zext(zext(x)) -> zext(x).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_802' href='#L_CASTS_802'><pre>802</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> case Instruction::SExt: // zext(sext(x)) -> sext(x).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_803' href='#L_CASTS_803'><pre>803</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> case Instruction::Trunc: // zext(trunc(x)) -> trunc(x) or zext(x)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_804' href='#L_CASTS_804'><pre>804</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_805' href='#L_CASTS_805'><pre>805</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_806' href='#L_CASTS_806'><pre>806</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_807' href='#L_CASTS_807'><pre>807</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_808' href='#L_CASTS_808'><pre>808</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_809' href='#L_CASTS_809'><pre>809</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_810' href='#L_CASTS_810'><pre>810</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_811' href='#L_CASTS_811'><pre>811</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> if (!canEvaluateZExtd(I->getOperand(0), Ty, BitsToClear, IC, CxtI) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_812' href='#L_CASTS_812'><pre>812</pre></a></td><td class='covered-line'><pre>1.94k</pre></td><td class='code'><pre> !canEvaluateZExtd(I->getOperand(1), Ty, Tmp, IC, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_813' href='#L_CASTS_813'><pre>813</pre></a></td><td class='covered-line'><pre>31.7k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_814' href='#L_CASTS_814'><pre>814</pre></a></td><td class='covered-line'><pre>32.2k</pre></td><td class='code'><pre> // These can all be promoted if neither operand has 'bits to clear'.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_815' href='#L_CASTS_815'><pre>815</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>431</span></div><div class='tooltip'>BitsToClear == 0 && <span class='tooltip-content'>431</span></div><div class='tooltip'>Tmp == 0<span class='tooltip-content'>415</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_816' href='#L_CASTS_816'><pre>816</pre></a></td><td class='covered-line'><pre>415</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_817' href='#L_CASTS_817'><pre>817</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_818' href='#L_CASTS_818'><pre>818</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // If the operation is an AND/OR/XOR and the bits to clear are zero in the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_819' href='#L_CASTS_819'><pre>819</pre></a></td><td class='covered-line'><pre>431</pre></td><td class='code'><pre> // other side, BitsToClear is ok.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_820' href='#L_CASTS_820'><pre>820</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16</span></div><div class='tooltip'>Tmp == 0 && <span class='tooltip-content'>16</span></div><div class='tooltip'>I->isBitwiseLogicOp()<span class='tooltip-content'>16</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_821' href='#L_CASTS_821'><pre>821</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // We use MaskedValueIsZero here for generality, but the case we care</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_822' href='#L_CASTS_822'><pre>822</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // about the most is constant RHS.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_823' href='#L_CASTS_823'><pre>823</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> unsigned VSize = V->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_824' href='#L_CASTS_824'><pre>824</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (IC.MaskedValueIsZero(I->getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_825' href='#L_CASTS_825'><pre>825</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> APInt::getHighBitsSet(VSize, BitsToClear),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_826' href='#L_CASTS_826'><pre>826</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> 0, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_827' href='#L_CASTS_827'><pre>827</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_828' href='#L_CASTS_828'><pre>828</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_829' href='#L_CASTS_829'><pre>829</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_830' href='#L_CASTS_830'><pre>830</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // Otherwise, we don't know how to analyze this BitsToClear case yet.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_831' href='#L_CASTS_831'><pre>831</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_832' href='#L_CASTS_832'><pre>832</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_833' href='#L_CASTS_833'><pre>833</pre></a></td><td class='covered-line'><pre>1.44k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_834' href='#L_CASTS_834'><pre>834</pre></a></td><td class='covered-line'><pre>1.44k</pre></td><td class='code'><pre> // We can promote shl(x, cst) if we can promote x. Since shl overwrites the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_835' href='#L_CASTS_835'><pre>835</pre></a></td><td class='covered-line'><pre>1.44k</pre></td><td class='code'><pre> // upper bits we can reduce BitsToClear by the shift amount.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_836' href='#L_CASTS_836'><pre>836</pre></a></td><td class='covered-line'><pre>1.44k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Amt<span class='tooltip-content'>1.44k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>1.27k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_837' href='#L_CASTS_837'><pre>837</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> if (!canEvaluateZExtd(I->getOperand(0), Ty, BitsToClear, IC, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_838' href='#L_CASTS_838'><pre>838</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_839' href='#L_CASTS_839'><pre>839</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> uint64_t ShiftAmt = Amt->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_840' href='#L_CASTS_840'><pre>840</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> BitsToClear = ShiftAmt < BitsToClear ? <div class='tooltip'><span class='red'>BitsToClear - ShiftAmt</span><span class='tooltip-content'>0</span></div> : <div class='tooltip'>0<span class='tooltip-content'>137</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_841' href='#L_CASTS_841'><pre>841</pre></a></td><td class='covered-line'><pre>137</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_842' href='#L_CASTS_842'><pre>842</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_843' href='#L_CASTS_843'><pre>843</pre></a></td><td class='covered-line'><pre>170</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_844' href='#L_CASTS_844'><pre>844</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_845' href='#L_CASTS_845'><pre>845</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> // We can promote lshr(x, cst) if we can promote x. This requires the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_846' href='#L_CASTS_846'><pre>846</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> // ultimate 'and' to clear out the high zero bits we're clearing out though.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_847' href='#L_CASTS_847'><pre>847</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Amt<span class='tooltip-content'>5.29k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>4.94k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_848' href='#L_CASTS_848'><pre>848</pre></a></td><td class='covered-line'><pre>4.94k</pre></td><td class='code'><pre> if (!canEvaluateZExtd(I->getOperand(0), Ty, BitsToClear, IC, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_849' href='#L_CASTS_849'><pre>849</pre></a></td><td class='covered-line'><pre>4.88k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_850' href='#L_CASTS_850'><pre>850</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> BitsToClear += Amt->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_851' href='#L_CASTS_851'><pre>851</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> if (BitsToClear > V->getType()->getScalarSizeInBits())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_852' href='#L_CASTS_852'><pre>852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BitsToClear = V->getType()->getScalarSizeInBits()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_853' href='#L_CASTS_853'><pre>853</pre></a></td><td class='covered-line'><pre>58</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_854' href='#L_CASTS_854'><pre>854</pre></a></td><td class='covered-line'><pre>4.94k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_855' href='#L_CASTS_855'><pre>855</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> // Cannot promote variable LSHR.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_856' href='#L_CASTS_856'><pre>856</pre></a></td><td class='covered-line'><pre>350</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_857' href='#L_CASTS_857'><pre>857</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> case Instruction::Select:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_858' href='#L_CASTS_858'><pre>858</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> if (!canEvaluateZExtd(I->getOperand(1), Ty, Tmp, IC, CxtI) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_859' href='#L_CASTS_859'><pre>859</pre></a></td><td class='covered-line'><pre>947</pre></td><td class='code'><pre> !canEvaluateZExtd(I->getOperand(2), Ty, BitsToClear, IC, CxtI) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_860' href='#L_CASTS_860'><pre>860</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> // TODO: If important, we could handle the case when the BitsToClear are</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_861' href='#L_CASTS_861'><pre>861</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> // known zero in the disagreeing side.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_862' href='#L_CASTS_862'><pre>862</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> Tmp != BitsToClear)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_863' href='#L_CASTS_863'><pre>863</pre></a></td><td class='covered-line'><pre>1.57k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_864' href='#L_CASTS_864'><pre>864</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_865' href='#L_CASTS_865'><pre>865</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_866' href='#L_CASTS_866'><pre>866</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_867' href='#L_CASTS_867'><pre>867</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> // We can change a phi if we can change all operands. Note that we never</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_868' href='#L_CASTS_868'><pre>868</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> // get into trouble with cyclic PHIs here because we only consider</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_869' href='#L_CASTS_869'><pre>869</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> // instructions with a single use.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_870' href='#L_CASTS_870'><pre>870</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> PHINode *PN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_871' href='#L_CASTS_871'><pre>871</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> if (!canEvaluateZExtd(PN->getIncomingValue(0), Ty, BitsToClear, IC, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_872' href='#L_CASTS_872'><pre>872</pre></a></td><td class='covered-line'><pre>3.41k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_873' href='#L_CASTS_873'><pre>873</pre></a></td><td class='covered-line'><pre>2.09k</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 1, e = PN->getNumIncomingValues(); <span class='tooltip-content'>1.38k</span></div><div class='tooltip'>i != e<span class='tooltip-content'>2.09k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>708</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_874' href='#L_CASTS_874'><pre>874</pre></a></td><td class='covered-line'><pre>2.02k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.02k</span></div><div class='tooltip'>!canEvaluateZExtd(PN->getIncomingValue(i), Ty, Tmp, IC, CxtI) ||<span class='tooltip-content'>2.02k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_875' href='#L_CASTS_875'><pre>875</pre></a></td><td class='covered-line'><pre>2.02k</pre></td><td class='code'><pre> // TODO: If important, we could handle the case when the BitsToClear</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_876' href='#L_CASTS_876'><pre>876</pre></a></td><td class='covered-line'><pre>2.02k</pre></td><td class='code'><pre> // are known zero in the disagreeing input.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_877' href='#L_CASTS_877'><pre>877</pre></a></td><td class='covered-line'><pre>708</pre></td><td class='code'><pre> Tmp != BitsToClear)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_878' href='#L_CASTS_878'><pre>878</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_879' href='#L_CASTS_879'><pre>879</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_880' href='#L_CASTS_880'><pre>880</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_881' href='#L_CASTS_881'><pre>881</pre></a></td><td class='covered-line'><pre>98.3k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_882' href='#L_CASTS_882'><pre>882</pre></a></td><td class='covered-line'><pre>98.3k</pre></td><td class='code'><pre> // TODO: Can handle more cases here.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_883' href='#L_CASTS_883'><pre>883</pre></a></td><td class='covered-line'><pre>98.3k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_884' href='#L_CASTS_884'><pre>884</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_885' href='#L_CASTS_885'><pre>885</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_886' href='#L_CASTS_886'><pre>886</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_887' href='#L_CASTS_887'><pre>887</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitZExt(ZExtInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_888' href='#L_CASTS_888'><pre>888</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> // If this zero extend is only used by a truncate, let the truncate be</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_889' href='#L_CASTS_889'><pre>889</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> // eliminated before we try to optimize this zext.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_890' href='#L_CASTS_890'><pre>890</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> if (<div class='tooltip'>CI.hasOneUse() && <span class='tooltip-content'>244k</span></div><div class='tooltip'>isa<TruncInst>(CI.user_back())<span class='tooltip-content'>205k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_891' href='#L_CASTS_891'><pre>891</pre></a></td><td class='covered-line'><pre>404</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_892' href='#L_CASTS_892'><pre>892</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_893' href='#L_CASTS_893'><pre>893</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> // If one of the common conversion will work, do it.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_894' href='#L_CASTS_894'><pre>894</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>244k</span></div><div class='tooltip'>Result<span class='tooltip-content'>244k</span></div> = commonCastTransforms(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_895' href='#L_CASTS_895'><pre>895</pre></a></td><td class='covered-line'><pre>445</pre></td><td class='code'><pre> return Result;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_896' href='#L_CASTS_896'><pre>896</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_897' href='#L_CASTS_897'><pre>897</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_898' href='#L_CASTS_898'><pre>898</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> Type *SrcTy = Src->getType(), *DestTy = CI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_899' href='#L_CASTS_899'><pre>899</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_900' href='#L_CASTS_900'><pre>900</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // Attempt to extend the entire input expression tree to the destination</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_901' href='#L_CASTS_901'><pre>901</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // type. Only do this if the dest type is a simple type, don't convert the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_902' href='#L_CASTS_902'><pre>902</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // expression tree to something weird like i93 unless the source is also</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_903' href='#L_CASTS_903'><pre>903</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // strange.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_904' href='#L_CASTS_904'><pre>904</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> unsigned BitsToClear;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_905' href='#L_CASTS_905'><pre>905</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> if (<div class='tooltip'>(DestTy->isVectorTy() || <span class='tooltip-content'>243k</span></div><div class='tooltip'>shouldChangeType(SrcTy, DestTy)<span class='tooltip-content'>243k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_906' href='#L_CASTS_906'><pre>906</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> <div class='tooltip'>canEvaluateZExtd(Src, DestTy, BitsToClear, *this, &CI)<span class='tooltip-content'>243k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>827</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_907' href='#L_CASTS_907'><pre>907</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> assert(BitsToClear < SrcTy->getScalarSizeInBits() &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_908' href='#L_CASTS_908'><pre>908</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> "Unreasonable BitsToClear");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_909' href='#L_CASTS_909'><pre>909</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_910' href='#L_CASTS_910'><pre>910</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> // Okay, we can transform this! Insert the new expression now.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_911' href='#L_CASTS_911'><pre>911</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> DEBUG(dbgs() << "ICE: EvaluateInDifferentType converting expression type"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_912' href='#L_CASTS_912'><pre>912</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> " to avoid zero extend: " << CI << '\n');</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_913' href='#L_CASTS_913'><pre>913</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> Value *Res = EvaluateInDifferentType(Src, DestTy, false);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_914' href='#L_CASTS_914'><pre>914</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> assert(Res->getType() == DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_915' href='#L_CASTS_915'><pre>915</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_916' href='#L_CASTS_916'><pre>916</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> uint32_t SrcBitsKept = SrcTy->getScalarSizeInBits()-BitsToClear;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_917' href='#L_CASTS_917'><pre>917</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> uint32_t DestBitSize = DestTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_918' href='#L_CASTS_918'><pre>918</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_919' href='#L_CASTS_919'><pre>919</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> // If the high bits are already filled with zeros, just replace this</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_920' href='#L_CASTS_920'><pre>920</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> // cast with the result.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_921' href='#L_CASTS_921'><pre>921</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> if (MaskedValueIsZero(Res,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_922' href='#L_CASTS_922'><pre>922</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> APInt::getHighBitsSet(DestBitSize,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_923' href='#L_CASTS_923'><pre>923</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> DestBitSize-SrcBitsKept),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_924' href='#L_CASTS_924'><pre>924</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> 0, &CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_925' href='#L_CASTS_925'><pre>925</pre></a></td><td class='covered-line'><pre>242</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, Res);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_926' href='#L_CASTS_926'><pre>926</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_927' href='#L_CASTS_927'><pre>927</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> // We need to emit an AND to clear the high bits.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_928' href='#L_CASTS_928'><pre>928</pre></a></td><td class='covered-line'><pre>585</pre></td><td class='code'><pre> Constant *C = ConstantInt::get(Res->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_929' href='#L_CASTS_929'><pre>929</pre></a></td><td class='covered-line'><pre>585</pre></td><td class='code'><pre> APInt::getLowBitsSet(DestBitSize, SrcBitsKept));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_930' href='#L_CASTS_930'><pre>930</pre></a></td><td class='covered-line'><pre>585</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Res, C);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_931' href='#L_CASTS_931'><pre>931</pre></a></td><td class='covered-line'><pre>827</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_932' href='#L_CASTS_932'><pre>932</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_933' href='#L_CASTS_933'><pre>933</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // If this is a TRUNC followed by a ZEXT then we are dealing with integral</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_934' href='#L_CASTS_934'><pre>934</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // types and if the sizes are just right we can convert this into a logical</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_935' href='#L_CASTS_935'><pre>935</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> // 'and' which will be much cheaper than the pair of casts.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_936' href='#L_CASTS_936'><pre>936</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> <div class='tooltip'>if (TruncInst *<span class='tooltip-content'>243k</span></div><div class='tooltip'>CSrc<span class='tooltip-content'>243k</span></div> = dyn_cast<TruncInst>(Src)) <div class='tooltip'>{ // A->B->C cast<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_937' href='#L_CASTS_937'><pre>937</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // TODO: Subsume this into EvaluateInDifferentType.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_938' href='#L_CASTS_938'><pre>938</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_939' href='#L_CASTS_939'><pre>939</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Get the sizes of the types involved. We know that the intermediate type</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_940' href='#L_CASTS_940'><pre>940</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // will be smaller than A or C, but don't know the relation between A and C.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_941' href='#L_CASTS_941'><pre>941</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *A = CSrc->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_942' href='#L_CASTS_942'><pre>942</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned SrcSize = A->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_943' href='#L_CASTS_943'><pre>943</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned MidSize = CSrc->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_944' href='#L_CASTS_944'><pre>944</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned DstSize = CI.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_945' href='#L_CASTS_945'><pre>945</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If we're actually extending zero bits, then if</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_946' href='#L_CASTS_946'><pre>946</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // SrcSize < DstSize: zext(a & mask)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_947' href='#L_CASTS_947'><pre>947</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // SrcSize == DstSize: a & mask</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_948' href='#L_CASTS_948'><pre>948</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // SrcSize > DstSize: trunc(a) & mask</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_949' href='#L_CASTS_949'><pre>949</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>SrcSize < DstSize<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_950' href='#L_CASTS_950'><pre>950</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> APInt AndValue(APInt::getLowBitsSet(SrcSize, MidSize));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_951' href='#L_CASTS_951'><pre>951</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Constant *AndConst = ConstantInt::get(A->getType(), AndValue);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_952' href='#L_CASTS_952'><pre>952</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(A, AndConst, CSrc->getName()+".mask");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_953' href='#L_CASTS_953'><pre>953</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ZExtInst(And, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_954' href='#L_CASTS_954'><pre>954</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_955' href='#L_CASTS_955'><pre>955</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_956' href='#L_CASTS_956'><pre>956</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5</span></div><div class='tooltip'>SrcSize == DstSize<span class='tooltip-content'>5</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_957' href='#L_CASTS_957'><pre>957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt AndValue(APInt::getLowBitsSet(SrcSize, MidSize));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_958' href='#L_CASTS_958'><pre>958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(A, ConstantInt::get(A->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_959' href='#L_CASTS_959'><pre>959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AndValue));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_960' href='#L_CASTS_960'><pre>960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_961' href='#L_CASTS_961'><pre>961</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5</span></div><div class='tooltip'>SrcSize > DstSize<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_962' href='#L_CASTS_962'><pre>962</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *Trunc = Builder->CreateTrunc(A, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_963' href='#L_CASTS_963'><pre>963</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> APInt AndValue(APInt::getLowBitsSet(DstSize, MidSize));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_964' href='#L_CASTS_964'><pre>964</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Trunc,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_965' href='#L_CASTS_965'><pre>965</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> ConstantInt::get(Trunc->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_966' href='#L_CASTS_966'><pre>966</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> AndValue));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_967' href='#L_CASTS_967'><pre>967</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_968' href='#L_CASTS_968'><pre>968</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_969' href='#L_CASTS_969'><pre>969</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_970' href='#L_CASTS_970'><pre>970</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>243k</span></div><div class='tooltip'>ICI<span class='tooltip-content'>243k</span></div> = dyn_cast<ICmpInst>(Src))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_971' href='#L_CASTS_971'><pre>971</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> return transformZExtICmp(ICI, CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_972' href='#L_CASTS_972'><pre>972</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_973' href='#L_CASTS_973'><pre>973</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> BinaryOperator *SrcI = dyn_cast<BinaryOperator>(Src);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_974' href='#L_CASTS_974'><pre>974</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> if (<div class='tooltip'>SrcI && <span class='tooltip-content'>219k</span></div><div class='tooltip'>SrcI->getOpcode() == Instruction::Or<span class='tooltip-content'>42.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.73k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_975' href='#L_CASTS_975'><pre>975</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // zext (or icmp, icmp) -> or (zext icmp), (zext icmp) if at least one</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_976' href='#L_CASTS_976'><pre>976</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // of the (zext icmp) can be eliminated. If so, immediately perform the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_977' href='#L_CASTS_977'><pre>977</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // according elimination.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_978' href='#L_CASTS_978'><pre>978</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> ICmpInst *LHS = dyn_cast<ICmpInst>(SrcI->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_979' href='#L_CASTS_979'><pre>979</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> ICmpInst *RHS = dyn_cast<ICmpInst>(SrcI->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_980' href='#L_CASTS_980'><pre>980</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS && <span class='tooltip-content'>2.73k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>348</span></div> && <div class='tooltip'>LHS->hasOneUse()<span class='tooltip-content'>305</span></div> && <div class='tooltip'>RHS->hasOneUse()<span class='tooltip-content'>266</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_981' href='#L_CASTS_981'><pre>981</pre></a></td><td class='covered-line'><pre>202</pre></td><td class='code'><pre> (transformZExtICmp(LHS, CI, false) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_982' href='#L_CASTS_982'><pre>982</pre></a></td><td class='covered-line'><pre>202</pre></td><td class='code'><pre> <div class='tooltip'>transformZExtICmp(RHS, CI, false)<span class='tooltip-content'>202</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_983' href='#L_CASTS_983'><pre>983</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // zext (or icmp, icmp) -> or (zext icmp), (zext icmp)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_984' href='#L_CASTS_984'><pre>984</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *LCast = Builder->CreateZExt(LHS, CI.getType(), LHS->getName());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_985' href='#L_CASTS_985'><pre>985</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *RCast = Builder->CreateZExt(RHS, CI.getType(), RHS->getName());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_986' href='#L_CASTS_986'><pre>986</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> BinaryOperator *Or = BinaryOperator::Create(Instruction::Or, LCast, RCast);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_987' href='#L_CASTS_987'><pre>987</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_988' href='#L_CASTS_988'><pre>988</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Perform the elimination.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_989' href='#L_CASTS_989'><pre>989</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (auto *LZExt = dyn_cast<ZExtInst>(LCast))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_990' href='#L_CASTS_990'><pre>990</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> transformZExtICmp(LHS, *LZExt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_991' href='#L_CASTS_991'><pre>991</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (auto *RZExt = dyn_cast<ZExtInst>(RCast))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_992' href='#L_CASTS_992'><pre>992</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> transformZExtICmp(RHS, *RZExt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_993' href='#L_CASTS_993'><pre>993</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_994' href='#L_CASTS_994'><pre>994</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return Or;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_995' href='#L_CASTS_995'><pre>995</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_996' href='#L_CASTS_996'><pre>996</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_997' href='#L_CASTS_997'><pre>997</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_998' href='#L_CASTS_998'><pre>998</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> // zext(trunc(X) & C) -> (X & zext(C)).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_999' href='#L_CASTS_999'><pre>999</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> Constant *C;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1000' href='#L_CASTS_1000'><pre>1000</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1001' href='#L_CASTS_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> if (SrcI &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1002' href='#L_CASTS_1002'><pre>1002</pre></a></td><td class='covered-line'><pre>42.6k</pre></td><td class='code'><pre> match(SrcI, m_OneUse(m_And(m_Trunc(m_Value(X)), m_Constant(C)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1003' href='#L_CASTS_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>X->getType() == CI.getType()</span>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1004' href='#L_CASTS_1004'><pre>1004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(X, ConstantExpr::getZExt(C, CI.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1005' href='#L_CASTS_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1006' href='#L_CASTS_1006'><pre>1006</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> // zext((trunc(X) & C) ^ C) -> ((X & zext(C)) ^ zext(C)).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1007' href='#L_CASTS_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> Value *And;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1008' href='#L_CASTS_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> if (<div class='tooltip'>SrcI && <span class='tooltip-content'>219k</span></div><div class='tooltip'>match(SrcI, m_OneUse(m_Xor(m_Value(And), m_Constant(C))))<span class='tooltip-content'>42.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1009' href='#L_CASTS_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> match(And, m_OneUse(m_And(m_Trunc(m_Value(X)), m_Specific(C)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1010' href='#L_CASTS_1010'><pre>1010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>X->getType() == CI.getType()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1011' href='#L_CASTS_1011'><pre>1011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *ZC = ConstantExpr::getZExt(C, CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1012' href='#L_CASTS_1012'><pre>1012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateXor(Builder->CreateAnd(X, ZC), ZC);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1013' href='#L_CASTS_1013'><pre>1013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1014' href='#L_CASTS_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1015' href='#L_CASTS_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1016' href='#L_CASTS_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1017' href='#L_CASTS_1017'><pre>1017</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1018' href='#L_CASTS_1018'><pre>1018</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Transform (sext icmp) to bitwise / integer operations to eliminate the icmp.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1019' href='#L_CASTS_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre>Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1020' href='#L_CASTS_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre> Value *Op0 = ICI->getOperand(0), *Op1 = ICI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1021' href='#L_CASTS_1021'><pre>1021</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = ICI->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1022' href='#L_CASTS_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1023' href='#L_CASTS_1023'><pre>1023</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre> // Don't bother if Op1 isn't of vector or integer type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1024' href='#L_CASTS_1024'><pre>1024</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre> if (!Op1->getType()->isIntOrIntVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1025' href='#L_CASTS_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1026' href='#L_CASTS_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1027' href='#L_CASTS_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>539</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>539</span></div><div class='tooltip'>Op1C<span class='tooltip-content'>539</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>344</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1028' href='#L_CASTS_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> // (x <s 0) ? -1 : 0 -> ashr x, 31 -> all ones if negative</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1029' href='#L_CASTS_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> // (x >s -1) ? -1 : 0 -> not (ashr x, 31) -> all ones if positive</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1030' href='#L_CASTS_1030'><pre>1030</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> if (<div class='tooltip'>(Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>344</span></div><div class='tooltip'>Op1C->isNullValue()<span class='tooltip-content'>109</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1031' href='#L_CASTS_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> <div class='tooltip'>(Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>343</span></div><div class='tooltip'>Op1C->isAllOnesValue()<span class='tooltip-content'>32</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1032' href='#L_CASTS_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1033' href='#L_CASTS_1033'><pre>1033</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *Sh = ConstantInt::get(Op0->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1034' href='#L_CASTS_1034'><pre>1034</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Op0->getType()->getScalarSizeInBits()-1);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1035' href='#L_CASTS_1035'><pre>1035</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *In = Builder->CreateAShr(Op0, Sh, Op0->getName()+".lobit");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1036' href='#L_CASTS_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (In->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1037' href='#L_CASTS_1037'><pre>1037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>In = Builder->CreateIntCast(In, CI.getType(), true/*SExt*/)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1038' href='#L_CASTS_1038'><pre>1038</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1039' href='#L_CASTS_1039'><pre>1039</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (Pred == ICmpInst::ICMP_SGT)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1040' href='#L_CASTS_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>In = Builder->CreateNot(In, In->getName()+".not")</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1041' href='#L_CASTS_1041'><pre>1041</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, In);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1042' href='#L_CASTS_1042'><pre>1042</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1043' href='#L_CASTS_1043'><pre>1043</pre></a></td><td class='covered-line'><pre>344</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1044' href='#L_CASTS_1044'><pre>1044</pre></a></td><td class='covered-line'><pre>539</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1045' href='#L_CASTS_1045'><pre>1045</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>538</span></div><div class='tooltip'>Op1C<span class='tooltip-content'>538</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>343</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1046' href='#L_CASTS_1046'><pre>1046</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> // If we know that only one bit of the LHS of the icmp can be set and we</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1047' href='#L_CASTS_1047'><pre>1047</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> // have an equality comparison with zero or a power of 2, we can transform</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1048' href='#L_CASTS_1048'><pre>1048</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> // the icmp and sext into bitwise/integer operations.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1049' href='#L_CASTS_1049'><pre>1049</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> if (ICI->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1050' href='#L_CASTS_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>313</pre></td><td class='code'><pre> <div class='tooltip'>ICI->isEquality()<span class='tooltip-content'>313</span></div> && <div class='tooltip'>(Op1C->isZero() || <span class='tooltip-content'>192</span></div><div class='tooltip'>Op1C->getValue().isPowerOf2()<span class='tooltip-content'>74</span></div>))<div class='tooltip'>{<span class='tooltip-content'>155</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1051' href='#L_CASTS_1051'><pre>1051</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> unsigned BitWidth = Op1C->getType()->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1052' href='#L_CASTS_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1053' href='#L_CASTS_1053'><pre>1053</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> computeKnownBits(Op0, KnownZero, KnownOne, 0, &CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1054' href='#L_CASTS_1054'><pre>1054</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1055' href='#L_CASTS_1055'><pre>1055</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> APInt KnownZeroMask(~KnownZero);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1056' href='#L_CASTS_1056'><pre>1056</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> if (<div class='tooltip'>KnownZeroMask.isPowerOf2()<span class='tooltip-content'>155</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1057' href='#L_CASTS_1057'><pre>1057</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *In = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1058' href='#L_CASTS_1058'><pre>1058</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1059' href='#L_CASTS_1059'><pre>1059</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If the icmp tests for a known zero bit we can constant fold it.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1060' href='#L_CASTS_1060'><pre>1060</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>!Op1C->isZero() && <span class='tooltip-content'>7</span></div><div class='tooltip'><span class='red'>Op1C->getValue() != KnownZeroMask</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1061' href='#L_CASTS_1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = Pred == ICmpInst::ICMP_NE ?</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1062' href='#L_CASTS_1062'><pre>1062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantInt::getAllOnesValue(CI.getType())</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1063' href='#L_CASTS_1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantInt::getNullValue(CI.getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1064' href='#L_CASTS_1064'><pre>1064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(CI, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1065' href='#L_CASTS_1065'><pre>1065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1066' href='#L_CASTS_1066'><pre>1066</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1067' href='#L_CASTS_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7</span></div><div class='tooltip'>!Op1C->isZero() == (Pred == ICmpInst::ICMP_NE)<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1068' href='#L_CASTS_1068'><pre>1068</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // sext ((x & 2^n) == 0) -> (x >> n) - 1</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1069' href='#L_CASTS_1069'><pre>1069</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // sext ((x & 2^n) != 2^n) -> (x >> n) - 1</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1070' href='#L_CASTS_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> unsigned ShiftAmt = KnownZeroMask.countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1071' href='#L_CASTS_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // Perform a right shift to place the desired bit in the LSB.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1072' href='#L_CASTS_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1073' href='#L_CASTS_1073'><pre>1073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>In = Builder->CreateLShr(In,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1074' href='#L_CASTS_1074'><pre>1074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(In->getType(), ShiftAmt))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1075' href='#L_CASTS_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1076' href='#L_CASTS_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // At this point "In" is either 1 or 0. Subtract 1 to turn</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1077' href='#L_CASTS_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // {1, 0} -> {0, -1}.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1078' href='#L_CASTS_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> In = Builder->CreateAdd(In,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1079' href='#L_CASTS_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ConstantInt::getAllOnesValue(In->getType()),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1080' href='#L_CASTS_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> "sext");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1081' href='#L_CASTS_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1082' href='#L_CASTS_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // sext ((x & 2^n) != 0) -> (x << bitwidth-n) a>> bitwidth-1</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1083' href='#L_CASTS_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // sext ((x & 2^n) == 2^n) -> (x << bitwidth-n) a>> bitwidth-1</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1084' href='#L_CASTS_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> unsigned ShiftAmt = KnownZeroMask.countLeadingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1085' href='#L_CASTS_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Perform a left shift to place the desired bit in the MSB.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1086' href='#L_CASTS_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1087' href='#L_CASTS_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> In = Builder->CreateShl(In,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1088' href='#L_CASTS_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ConstantInt::get(In->getType(), ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1089' href='#L_CASTS_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1090' href='#L_CASTS_1090'><pre>1090</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Distribute the bit over the whole bit width.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1091' href='#L_CASTS_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> In = Builder->CreateAShr(In, ConstantInt::get(In->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1092' href='#L_CASTS_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> BitWidth - 1), "sext");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1093' href='#L_CASTS_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1094' href='#L_CASTS_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1095' href='#L_CASTS_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (CI.getType() == In->getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1096' href='#L_CASTS_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, In);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1097' href='#L_CASTS_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return CastInst::CreateIntegerCast(In, CI.getType(), true/*SExt*/);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1098' href='#L_CASTS_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1099' href='#L_CASTS_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>155</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1100' href='#L_CASTS_1100'><pre>1100</pre></a></td><td class='covered-line'><pre>343</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1101' href='#L_CASTS_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1102' href='#L_CASTS_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>531</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1103' href='#L_CASTS_1103'><pre>1103</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1104' href='#L_CASTS_1104'><pre>1104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1105' href='#L_CASTS_1105'><pre>1105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we can take the specified value and return it as type Ty</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1106' href='#L_CASTS_1106'><pre>1106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// without inserting any new casts and without changing the value of the common</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1107' href='#L_CASTS_1107'><pre>1107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// low bits. This is used by code that tries to promote integer operations to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1108' href='#L_CASTS_1108'><pre>1108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a wider types will allow us to eliminate the extension.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1109' href='#L_CASTS_1109'><pre>1109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1110' href='#L_CASTS_1110'><pre>1110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function works on both vectors and scalars.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1111' href='#L_CASTS_1111'><pre>1111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1112' href='#L_CASTS_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre>static bool canEvaluateSExtd(Value *V, Type *Ty) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1113' href='#L_CASTS_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre> assert(V->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits() &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1114' href='#L_CASTS_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre> "Can't sign extend type to a smaller type");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1115' href='#L_CASTS_1115'><pre>1115</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre> // If this is a constant, it can be trivially promoted.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1116' href='#L_CASTS_1116'><pre>1116</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre> if (isa<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1117' href='#L_CASTS_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>1.58k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1118' href='#L_CASTS_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>348k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1119' href='#L_CASTS_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>346k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1120' href='#L_CASTS_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>346k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>346k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>29.0k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1121' href='#L_CASTS_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>346k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1122' href='#L_CASTS_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>346k</pre></td><td class='code'><pre> // If this is a truncate from the dest type, we can trivially eliminate it.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1123' href='#L_CASTS_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>317k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>317k</span></div><div class='tooltip'>isa<TruncInst>(I) && <span class='tooltip-content'>317k</span></div><div class='tooltip'>I->getOperand(0)->getType() == Ty<span class='tooltip-content'>1.66k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1124' href='#L_CASTS_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>1.45k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1125' href='#L_CASTS_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>317k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1126' href='#L_CASTS_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>317k</pre></td><td class='code'><pre> // We can't extend or shrink something that has multiple uses: doing so would</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1127' href='#L_CASTS_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>317k</pre></td><td class='code'><pre> // require duplicating the instruction in general, which isn't profitable.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1128' href='#L_CASTS_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>316k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>316k</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>316k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>152k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1129' href='#L_CASTS_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>316k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1130' href='#L_CASTS_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1131' href='#L_CASTS_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>767</pre></td><td class='code'><pre> case Instruction::SExt: // sext(sext(x)) -> sext(x)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1132' href='#L_CASTS_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>767</pre></td><td class='code'><pre> case Instruction::ZExt: // sext(zext(x)) -> zext(x)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1133' href='#L_CASTS_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>767</pre></td><td class='code'><pre> case Instruction::Trunc: // sext(trunc(x)) -> trunc(x) or sext(x)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1134' href='#L_CASTS_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>767</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1135' href='#L_CASTS_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1136' href='#L_CASTS_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1137' href='#L_CASTS_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1138' href='#L_CASTS_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1139' href='#L_CASTS_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1140' href='#L_CASTS_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1141' href='#L_CASTS_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> // These operators can all arbitrarily be extended if their inputs can.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1142' href='#L_CASTS_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> return canEvaluateSExtd(I->getOperand(0), Ty) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1143' href='#L_CASTS_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> canEvaluateSExtd(I->getOperand(1), Ty);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1144' href='#L_CASTS_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1145' href='#L_CASTS_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> //case Instruction::Shl: TODO</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1146' href='#L_CASTS_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre> //case Instruction::LShr: TODO</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1147' href='#L_CASTS_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1148' href='#L_CASTS_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> case Instruction::Select:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1149' href='#L_CASTS_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> return canEvaluateSExtd(I->getOperand(1), Ty) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1150' href='#L_CASTS_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>136</pre></td><td class='code'><pre> canEvaluateSExtd(I->getOperand(2), Ty);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1151' href='#L_CASTS_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>55.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1152' href='#L_CASTS_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1153' href='#L_CASTS_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> // We can change a phi if we can change all operands. Note that we never</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1154' href='#L_CASTS_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> // get into trouble with cyclic PHIs here because we only consider</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1155' href='#L_CASTS_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> // instructions with a single use.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1156' href='#L_CASTS_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> PHINode *PN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1157' href='#L_CASTS_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> for (Value *IncValue : PN->incoming_values())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1158' href='#L_CASTS_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>6.81k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.81k</span></div><div class='tooltip'>!canEvaluateSExtd(IncValue, Ty)<span class='tooltip-content'>6.81k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>5.93k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1159' href='#L_CASTS_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1160' href='#L_CASTS_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>5.99k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1161' href='#L_CASTS_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>99.7k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1162' href='#L_CASTS_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>99.7k</pre></td><td class='code'><pre> // TODO: Can handle more cases here.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1163' href='#L_CASTS_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>99.7k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1164' href='#L_CASTS_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1165' href='#L_CASTS_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1166' href='#L_CASTS_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>99.7k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1167' href='#L_CASTS_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>163k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1168' href='#L_CASTS_1168'><pre>1168</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1169' href='#L_CASTS_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSExt(SExtInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1170' href='#L_CASTS_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre> // If this sign extend is only used by a truncate, let the truncate be</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1171' href='#L_CASTS_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre> // eliminated before we try to optimize this sext.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1172' href='#L_CASTS_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre> if (<div class='tooltip'>CI.hasOneUse() && <span class='tooltip-content'>285k</span></div><div class='tooltip'>isa<TruncInst>(CI.user_back())<span class='tooltip-content'>225k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1173' href='#L_CASTS_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1174' href='#L_CASTS_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1175' href='#L_CASTS_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>285k</span></div><div class='tooltip'>I<span class='tooltip-content'>285k</span></div> = commonCastTransforms(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1176' href='#L_CASTS_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1177' href='#L_CASTS_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>285k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1178' href='#L_CASTS_1178'><pre>1178</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1179' href='#L_CASTS_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> Type *SrcTy = Src->getType(), *DestTy = CI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1180' href='#L_CASTS_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1181' href='#L_CASTS_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // If we know that the value being extended is positive, we can use a zext</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1182' href='#L_CASTS_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // instead.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1183' href='#L_CASTS_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> bool KnownZero, KnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1184' href='#L_CASTS_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> ComputeSignBit(Src, KnownZero, KnownOne, 0, &CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1185' href='#L_CASTS_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> if (<div class='tooltip'>KnownZero<span class='tooltip-content'>283k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>552</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1186' href='#L_CASTS_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> Value *ZExt = Builder->CreateZExt(Src, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1187' href='#L_CASTS_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, ZExt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1188' href='#L_CASTS_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1189' href='#L_CASTS_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1190' href='#L_CASTS_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // Attempt to extend the entire input expression tree to the destination</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1191' href='#L_CASTS_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // type. Only do this if the dest type is a simple type, don't convert the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1192' href='#L_CASTS_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // expression tree to something weird like i93 unless the source is also</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1193' href='#L_CASTS_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>283k</pre></td><td class='code'><pre> // strange.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1194' href='#L_CASTS_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>282k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>282k</span></div><div class='tooltip'>(DestTy->isVectorTy() || <span class='tooltip-content'>282k</span></div><div class='tooltip'>shouldChangeType(SrcTy, DestTy)<span class='tooltip-content'>282k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1195' href='#L_CASTS_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>282k</pre></td><td class='code'><pre> <div class='tooltip'>canEvaluateSExtd(Src, DestTy)<span class='tooltip-content'>282k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.07k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1196' href='#L_CASTS_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // Okay, we can transform this! Insert the new expression now.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1197' href='#L_CASTS_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> DEBUG(dbgs() << "ICE: EvaluateInDifferentType converting expression type"</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1198' href='#L_CASTS_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> " to avoid sign extend: " << CI << '\n');</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1199' href='#L_CASTS_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> Value *Res = EvaluateInDifferentType(Src, DestTy, true);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1200' href='#L_CASTS_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> assert(Res->getType() == DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1201' href='#L_CASTS_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1202' href='#L_CASTS_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> uint32_t SrcBitSize = SrcTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1203' href='#L_CASTS_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> uint32_t DestBitSize = DestTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1204' href='#L_CASTS_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1205' href='#L_CASTS_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // If the high bits are already filled with sign bit, just replace this</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1206' href='#L_CASTS_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // cast with the result.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1207' href='#L_CASTS_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> if (ComputeNumSignBits(Res, 0, &CI) > DestBitSize - SrcBitSize)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1208' href='#L_CASTS_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, Res);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1209' href='#L_CASTS_1209'><pre>1209</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1210' href='#L_CASTS_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // We need to emit a shl + ashr to do the sign extend.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1211' href='#L_CASTS_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>926</pre></td><td class='code'><pre> Value *ShAmt = ConstantInt::get(DestTy, DestBitSize-SrcBitSize);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1212' href='#L_CASTS_1212'><pre>1212</pre></a></td><td class='covered-line'><pre>926</pre></td><td class='code'><pre> return BinaryOperator::CreateAShr(Builder->CreateShl(Res, ShAmt, "sext"),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1213' href='#L_CASTS_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>926</pre></td><td class='code'><pre> ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1214' href='#L_CASTS_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1215' href='#L_CASTS_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>282k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1216' href='#L_CASTS_1216'><pre>1216</pre></a></td><td class='covered-line'><pre>282k</pre></td><td class='code'><pre> // If the input is a trunc from the destination type, then turn sext(trunc(x))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1217' href='#L_CASTS_1217'><pre>1217</pre></a></td><td class='covered-line'><pre>282k</pre></td><td class='code'><pre> // into shifts.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1218' href='#L_CASTS_1218'><pre>1218</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1219' href='#L_CASTS_1219'><pre>1219</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Src, m_OneUse(m_Trunc(m_Value(X)))) && <span class='tooltip-content'>281k</span></div><div class='tooltip'><span class='red'>X->getType() == DestTy</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1220' href='#L_CASTS_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // sext(trunc(X)) --> ashr(shl(X, C), C)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1221' href='#L_CASTS_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SrcBitSize = SrcTy->getScalarSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1222' href='#L_CASTS_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned DestBitSize = DestTy->getScalarSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1223' href='#L_CASTS_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *ShAmt = ConstantInt::get(DestTy, DestBitSize - SrcBitSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1224' href='#L_CASTS_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAShr(Builder->CreateShl(X, ShAmt), ShAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1225' href='#L_CASTS_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1226' href='#L_CASTS_1226'><pre>1226</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1227' href='#L_CASTS_1227'><pre>1227</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>281k</span></div><div class='tooltip'>ICI<span class='tooltip-content'>281k</span></div> = dyn_cast<ICmpInst>(Src))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1228' href='#L_CASTS_1228'><pre>1228</pre></a></td><td class='covered-line'><pre>623</pre></td><td class='code'><pre> return transformSExtICmp(ICI, CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1229' href='#L_CASTS_1229'><pre>1229</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1230' href='#L_CASTS_1230'><pre>1230</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // If the input is a shl/ashr pair of a same constant, then this is a sign</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1231' href='#L_CASTS_1231'><pre>1231</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // extension from a smaller value. If we could trust arbitrary bitwidth</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1232' href='#L_CASTS_1232'><pre>1232</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // integers, we could turn this into a truncate to the smaller bit and then</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1233' href='#L_CASTS_1233'><pre>1233</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // use a sext for the whole extension. Since we don't, look deeper and check</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1234' href='#L_CASTS_1234'><pre>1234</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // for a truncate. If the source and dest are the same type, eliminate the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1235' href='#L_CASTS_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // trunc and extend and just do shifts. For example, turn:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1236' href='#L_CASTS_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %a = trunc i32 %i to i8</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1237' href='#L_CASTS_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %b = shl i8 %a, 6</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1238' href='#L_CASTS_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %c = ashr i8 %b, 6</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1239' href='#L_CASTS_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %d = sext i8 %c to i32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1240' href='#L_CASTS_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // into:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1241' href='#L_CASTS_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %a = shl i32 %i, 30</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1242' href='#L_CASTS_1242'><pre>1242</pre></a></td><td class='covered-line'><pre>281k</pre></td><td class='code'><pre> // %d = ashr i32 %a, 30</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1243' href='#L_CASTS_1243'><pre>1243</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> Value *A = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1244' href='#L_CASTS_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> // TODO: Eventually this could be subsumed by EvaluateInDifferentType.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1245' href='#L_CASTS_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> ConstantInt *BA = nullptr, *CA = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1246' href='#L_CASTS_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> if (match(Src, m_AShr(m_Shl(m_Trunc(m_Value(A)), m_ConstantInt(BA)),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1247' href='#L_CASTS_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> m_ConstantInt(CA))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1248' href='#L_CASTS_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>BA == CA<span class='tooltip-content'>1</span></div> && <div class='tooltip'>A->getType() == CI.getType()<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1249' href='#L_CASTS_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned MidSize = Src->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1250' href='#L_CASTS_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned SrcDstSize = CI.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1251' href='#L_CASTS_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned ShAmt = CA->getZExtValue()+SrcDstSize-MidSize;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1252' href='#L_CASTS_1252'><pre>1252</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *ShAmtV = ConstantInt::get(CI.getType(), ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1253' href='#L_CASTS_1253'><pre>1253</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> A = Builder->CreateShl(A, ShAmtV, CI.getName());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1254' href='#L_CASTS_1254'><pre>1254</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateAShr(A, ShAmtV);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1255' href='#L_CASTS_1255'><pre>1255</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1256' href='#L_CASTS_1256'><pre>1256</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1257' href='#L_CASTS_1257'><pre>1257</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1258' href='#L_CASTS_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1259' href='#L_CASTS_1259'><pre>1259</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1260' href='#L_CASTS_1260'><pre>1260</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1261' href='#L_CASTS_1261'><pre>1261</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return a Constant* for the specified floating-point constant if it fits</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1262' href='#L_CASTS_1262'><pre>1262</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// in the specified FP type without changing its value.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1263' href='#L_CASTS_1263'><pre>1263</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre>static Constant *fitsInFPType(ConstantFP *CFP, const fltSemantics &Sem) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1264' href='#L_CASTS_1264'><pre>1264</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre> bool losesInfo;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1265' href='#L_CASTS_1265'><pre>1265</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre> APFloat F = CFP->getValueAPF();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1266' href='#L_CASTS_1266'><pre>1266</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre> (void)F.convert(Sem, APFloat::rmNearestTiesToEven, &losesInfo);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1267' href='#L_CASTS_1267'><pre>1267</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre> if (!losesInfo)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1268' href='#L_CASTS_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>536</pre></td><td class='code'><pre> return ConstantFP::get(CFP->getContext(), F);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1269' href='#L_CASTS_1269'><pre>1269</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1270' href='#L_CASTS_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>644</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1271' href='#L_CASTS_1271'><pre>1271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1272' href='#L_CASTS_1272'><pre>1272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Look through floating-point extensions until we get the source value.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1273' href='#L_CASTS_1273'><pre>1273</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre>static Value *lookThroughFPExtensions(Value *V) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1274' href='#L_CASTS_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>7.79k</pre></td><td class='code'><pre> while (auto *FPExt = dyn_cast<FPExtInst>(V))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1275' href='#L_CASTS_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre> V = FPExt->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1276' href='#L_CASTS_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1277' href='#L_CASTS_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre> // If this value is a constant, return the constant in the smallest FP type</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1278' href='#L_CASTS_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre> // that can accurately represent it. This allows us to turn</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1279' href='#L_CASTS_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre> // (float)((double)X+2.0) into x+2.0f.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1280' href='#L_CASTS_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>CFP<span class='tooltip-content'>5.73k</span></div> = dyn_cast<ConstantFP>(V)) <div class='tooltip'>{<span class='tooltip-content'>590</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1281' href='#L_CASTS_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>590</pre></td><td class='code'><pre> if (CFP->getType() == Type::getPPC_FP128Ty(V->getContext()))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1282' href='#L_CASTS_1282'><pre>1282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return V</span>; // No constant folding of this.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1283' href='#L_CASTS_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>590</pre></td><td class='code'><pre> // See if the value can be truncated to half and then reextended.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1284' href='#L_CASTS_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>590</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>590</span></div><div class='tooltip'>V<span class='tooltip-content'>590</span></div> = fitsInFPType(CFP, APFloat::IEEEhalf()))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1285' href='#L_CASTS_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>536</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1286' href='#L_CASTS_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>590</pre></td><td class='code'><pre> // See if the value can be truncated to float and then reextended.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1287' href='#L_CASTS_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>54</span></div><div class='tooltip'>V<span class='tooltip-content'>54</span></div> = fitsInFPType(CFP, APFloat::IEEEsingle()))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1288' href='#L_CASTS_1288'><pre>1288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return V</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1289' href='#L_CASTS_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>54</span></div><div class='tooltip'>CFP->getType()->isDoubleTy()<span class='tooltip-content'>54</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1290' href='#L_CASTS_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> return V; // Won't shrink.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1291' href='#L_CASTS_1291'><pre>1291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = fitsInFPType(CFP, APFloat::IEEEdouble()))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1292' href='#L_CASTS_1292'><pre>1292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return V</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1293' href='#L_CASTS_1293'><pre>1293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't try to shrink to various long double types.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1294' href='#L_CASTS_1294'><pre>1294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1295' href='#L_CASTS_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1296' href='#L_CASTS_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>5.14k</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1297' href='#L_CASTS_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>5.73k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1298' href='#L_CASTS_1298'><pre>1298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1299' href='#L_CASTS_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1300' href='#L_CASTS_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> if (Instruction *I = commonCastTransforms(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1301' href='#L_CASTS_1301'><pre>1301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1302' href='#L_CASTS_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // If we have fptrunc(OpI (fpextend x), (fpextend y)), we would like to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1303' href='#L_CASTS_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // simplify this expression to avoid one or more of the trunc/extend</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1304' href='#L_CASTS_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // operations if we can do so without changing the numerical results.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1305' href='#L_CASTS_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1306' href='#L_CASTS_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // The exact manner in which the widths of the operands interact to limit</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1307' href='#L_CASTS_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // what we can and cannot do safely varies from operation to operation, and</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1308' href='#L_CASTS_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // is explained below in the various case statements.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1309' href='#L_CASTS_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> BinaryOperator *OpI = dyn_cast<BinaryOperator>(CI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1310' href='#L_CASTS_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpI && <span class='tooltip-content'>3.98k</span></div><div class='tooltip'>OpI->hasOneUse()<span class='tooltip-content'>2.97k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.86k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1311' href='#L_CASTS_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> Value *LHSOrig = lookThroughFPExtensions(OpI->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1312' href='#L_CASTS_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> Value *RHSOrig = lookThroughFPExtensions(OpI->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1313' href='#L_CASTS_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> unsigned OpWidth = OpI->getType()->getFPMantissaWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1314' href='#L_CASTS_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> unsigned LHSWidth = LHSOrig->getType()->getFPMantissaWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1315' href='#L_CASTS_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> unsigned RHSWidth = RHSOrig->getType()->getFPMantissaWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1316' href='#L_CASTS_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> unsigned SrcWidth = std::max(LHSWidth, RHSWidth);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1317' href='#L_CASTS_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> unsigned DstWidth = CI.getType()->getFPMantissaWidth();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1318' href='#L_CASTS_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> switch (OpI->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1319' href='#L_CASTS_1319'><pre>1319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default: break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1320' href='#L_CASTS_1320'><pre>1320</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre><span class='red'> </span>case Instruction::FAdd:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1321' href='#L_CASTS_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> case Instruction::FSub:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1322' href='#L_CASTS_1322'><pre>1322</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // For addition and subtraction, the infinitely precise result can</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1323' href='#L_CASTS_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // essentially be arbitrarily wide; proving that double rounding</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1324' href='#L_CASTS_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // will not occur because the result of OpI is exact (as we will for</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1325' href='#L_CASTS_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // FMul, for example) is hopeless. However, we *can* nonetheless</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1326' href='#L_CASTS_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // frequently know that double rounding cannot occur (or that it is</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1327' href='#L_CASTS_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // innocuous) by taking advantage of the specific structure of</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1328' href='#L_CASTS_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // infinitely-precise results that admit double rounding.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1329' href='#L_CASTS_1329'><pre>1329</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1330' href='#L_CASTS_1330'><pre>1330</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // Specifically, if OpWidth >= 2*DstWdith+1 and DstWidth is sufficient</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1331' href='#L_CASTS_1331'><pre>1331</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // to represent both sources, we can guarantee that the double</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1332' href='#L_CASTS_1332'><pre>1332</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // rounding is innocuous (See p50 of Figueroa's 2000 PhD thesis,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1333' href='#L_CASTS_1333'><pre>1333</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // "A Rigorous Framework for Fully Supporting the IEEE Standard ..."</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1334' href='#L_CASTS_1334'><pre>1334</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // for proof of this fact).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1335' href='#L_CASTS_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1336' href='#L_CASTS_1336'><pre>1336</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // Note: Figueroa does not consider the case where DstFormat !=</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1337' href='#L_CASTS_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // SrcFormat. It's possible (likely even!) that this analysis</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1338' href='#L_CASTS_1338'><pre>1338</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // could be tightened for those cases, but they are rare (the main</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1339' href='#L_CASTS_1339'><pre>1339</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> // case of interest here is (float)((double)float + float)).</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1340' href='#L_CASTS_1340'><pre>1340</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpWidth >= 2*DstWidth+1 && <span class='tooltip-content'>1.21k</span></div><div class='tooltip'>DstWidth >= SrcWidth<span class='tooltip-content'>1.21k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1341' href='#L_CASTS_1341'><pre>1341</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (LHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1342' href='#L_CASTS_1342'><pre>1342</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> LHSOrig = Builder->CreateFPExt(LHSOrig, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1343' href='#L_CASTS_1343'><pre>1343</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (RHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1344' href='#L_CASTS_1344'><pre>1344</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> RHSOrig = Builder->CreateFPExt(RHSOrig, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1345' href='#L_CASTS_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Instruction *RI =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1346' href='#L_CASTS_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> BinaryOperator::Create(OpI->getOpcode(), LHSOrig, RHSOrig);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1347' href='#L_CASTS_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> RI->copyFastMathFlags(OpI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1348' href='#L_CASTS_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1349' href='#L_CASTS_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1350' href='#L_CASTS_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>1.20k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1351' href='#L_CASTS_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> case Instruction::FMul:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1352' href='#L_CASTS_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> // For multiplication, the infinitely precise result has at most</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1353' href='#L_CASTS_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> // LHSWidth + RHSWidth significant bits; if OpWidth is sufficient</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1354' href='#L_CASTS_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> // that such a value can be exactly represented, then no double</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1355' href='#L_CASTS_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> // rounding can possibly occur; we can safely perform the operation</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1356' href='#L_CASTS_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> // in the destination format if it can represent both sources.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1357' href='#L_CASTS_1357'><pre>1357</pre></a></td><td class='covered-line'><pre>1.59k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpWidth >= LHSWidth + RHSWidth && <span class='tooltip-content'>1.59k</span></div><div class='tooltip'>DstWidth >= SrcWidth<span class='tooltip-content'>11</span></div>) <div class='tooltip'>{<span class='tooltip-content'>11</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1358' href='#L_CASTS_1358'><pre>1358</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> if (LHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1359' href='#L_CASTS_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHSOrig = Builder->CreateFPExt(LHSOrig, CI.getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1360' href='#L_CASTS_1360'><pre>1360</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> if (RHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1361' href='#L_CASTS_1361'><pre>1361</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> RHSOrig = Builder->CreateFPExt(RHSOrig, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1362' href='#L_CASTS_1362'><pre>1362</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Instruction *RI =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1363' href='#L_CASTS_1363'><pre>1363</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> BinaryOperator::CreateFMul(LHSOrig, RHSOrig);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1364' href='#L_CASTS_1364'><pre>1364</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> RI->copyFastMathFlags(OpI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1365' href='#L_CASTS_1365'><pre>1365</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1366' href='#L_CASTS_1366'><pre>1366</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1367' href='#L_CASTS_1367'><pre>1367</pre></a></td><td class='covered-line'><pre>1.58k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1368' href='#L_CASTS_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> case Instruction::FDiv:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1369' href='#L_CASTS_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // For division, we use again use the bound from Figueroa's</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1370' href='#L_CASTS_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // dissertation. I am entirely certain that this bound can be</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1371' href='#L_CASTS_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // tightened in the unbalanced operand case by an analysis based on</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1372' href='#L_CASTS_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // the diophantine rational approximation bound, but the well-known</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1373' href='#L_CASTS_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // condition used here is a good conservative first pass.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1374' href='#L_CASTS_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // TODO: Tighten bound via rigorous analysis of the unbalanced case.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1375' href='#L_CASTS_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> if (<div class='tooltip'>OpWidth >= 2*DstWidth && <span class='tooltip-content'>63</span></div><div class='tooltip'>DstWidth >= SrcWidth<span class='tooltip-content'>63</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1376' href='#L_CASTS_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (LHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1377' href='#L_CASTS_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> LHSOrig = Builder->CreateFPExt(LHSOrig, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1378' href='#L_CASTS_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (RHSOrig->getType() != CI.getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1379' href='#L_CASTS_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> RHSOrig = Builder->CreateFPExt(RHSOrig, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1380' href='#L_CASTS_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Instruction *RI =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1381' href='#L_CASTS_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> BinaryOperator::CreateFDiv(LHSOrig, RHSOrig);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1382' href='#L_CASTS_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> RI->copyFastMathFlags(OpI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1383' href='#L_CASTS_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1384' href='#L_CASTS_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1385' href='#L_CASTS_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1386' href='#L_CASTS_1386'><pre>1386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Instruction::FRem:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1387' href='#L_CASTS_1387'><pre>1387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Remainder is straightforward. Remainder is always exact, so the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1388' href='#L_CASTS_1388'><pre>1388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // type of OpI doesn't enter into things at all. We simply evaluate</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1389' href='#L_CASTS_1389'><pre>1389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // in whichever source type is larger, then convert to the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1390' href='#L_CASTS_1390'><pre>1390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // destination type.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1391' href='#L_CASTS_1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>SrcWidth == OpWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1392' href='#L_CASTS_1392'><pre>1392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1393' href='#L_CASTS_1393'><pre>1393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LHSWidth < SrcWidth</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1394' href='#L_CASTS_1394'><pre>1394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1395' href='#L_CASTS_1395'><pre>1395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHSWidth <= SrcWidth</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1396' href='#L_CASTS_1396'><pre>1396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1397' href='#L_CASTS_1397'><pre>1397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>LHSOrig != OpI->getOperand(0) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHSOrig != OpI->getOperand(1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1398' href='#L_CASTS_1398'><pre>1398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1399' href='#L_CASTS_1399'><pre>1399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>RI</span><span class='red'> = dyn_cast<Instruction>(ExactResult))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1400' href='#L_CASTS_1400'><pre>1400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>RI->copyFastMathFlags(OpI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1401' href='#L_CASTS_1401'><pre>1401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::CreateFPCast(ExactResult, CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1402' href='#L_CASTS_1402'><pre>1402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1403' href='#L_CASTS_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1404' href='#L_CASTS_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1405' href='#L_CASTS_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>2.86k</pre></td><td class='code'><pre> // (fptrunc (fneg x)) -> (fneg (fptrunc x))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1406' href='#L_CASTS_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.84k</span></div><div class='tooltip'>BinaryOperator::isFNeg(OpI)<span class='tooltip-content'>2.84k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1407' href='#L_CASTS_1407'><pre>1407</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *InnerTrunc = Builder->CreateFPTrunc(OpI->getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1408' href='#L_CASTS_1408'><pre>1408</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1409' href='#L_CASTS_1409'><pre>1409</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Instruction *RI = BinaryOperator::CreateFNeg(InnerTrunc);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1410' href='#L_CASTS_1410'><pre>1410</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> RI->copyFastMathFlags(OpI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1411' href='#L_CASTS_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1412' href='#L_CASTS_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1413' href='#L_CASTS_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1414' href='#L_CASTS_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1415' href='#L_CASTS_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // (fptrunc (select cond, R1, Cst)) --></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1416' href='#L_CASTS_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // (select cond, (fptrunc R1), (fptrunc Cst))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1417' href='#L_CASTS_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1418' href='#L_CASTS_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // - but only if this isn't part of a min/max operation, else we'll</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1419' href='#L_CASTS_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // ruin min/max canonical form which is to have the select and</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1420' href='#L_CASTS_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> // compare's operands be of the same type with no casts to look through.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1421' href='#L_CASTS_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> Value *LHS, *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1422' href='#L_CASTS_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> SelectInst *SI = dyn_cast<SelectInst>(CI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1423' href='#L_CASTS_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> if (SI &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1424' href='#L_CASTS_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> (isa<ConstantFP>(SI->getOperand(1)) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1425' href='#L_CASTS_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> isa<ConstantFP>(SI->getOperand(2))) &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1426' href='#L_CASTS_1426'><pre>1426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>matchSelectPattern(SI, LHS, RHS).Flavor == SPF_UNKNOWN</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1427' href='#L_CASTS_1427'><pre>1427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LHSTrunc = Builder->CreateFPTrunc(SI->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1428' href='#L_CASTS_1428'><pre>1428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1429' href='#L_CASTS_1429'><pre>1429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RHSTrunc = Builder->CreateFPTrunc(SI->getOperand(2),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1430' href='#L_CASTS_1430'><pre>1430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1431' href='#L_CASTS_1431'><pre>1431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(SI->getOperand(0), LHSTrunc, RHSTrunc);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1432' href='#L_CASTS_1432'><pre>1432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1433' href='#L_CASTS_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1434' href='#L_CASTS_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1435' href='#L_CASTS_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> if (<div class='tooltip'>II<span class='tooltip-content'>3.95k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1436' href='#L_CASTS_1436'><pre>1436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (II->getIntrinsicID()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1437' href='#L_CASTS_1437'><pre>1437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default: break;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1438' href='#L_CASTS_1438'><pre>1438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::fabs:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1439' href='#L_CASTS_1439'><pre>1439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ceil:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1440' href='#L_CASTS_1440'><pre>1440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::floor:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1441' href='#L_CASTS_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::rint:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1442' href='#L_CASTS_1442'><pre>1442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::round:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1443' href='#L_CASTS_1443'><pre>1443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::nearbyint:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1444' href='#L_CASTS_1444'><pre>1444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::trunc: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1445' href='#L_CASTS_1445'><pre>1445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Do unary FP operation on smaller type.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1446' href='#L_CASTS_1446'><pre>1446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (fptrunc (fabs x)) -> (fabs (fptrunc x))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1447' href='#L_CASTS_1447'><pre>1447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *InnerTrunc = Builder->CreateFPTrunc(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1448' href='#L_CASTS_1448'><pre>1448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1449' href='#L_CASTS_1449'><pre>1449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntrinsicType[] = { CI.getType() };</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1450' href='#L_CASTS_1450'><pre>1450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Function *Overload = Intrinsic::getDeclaration(</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1451' href='#L_CASTS_1451'><pre>1451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CI.getModule(), II->getIntrinsicID(), IntrinsicType);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1452' href='#L_CASTS_1452'><pre>1452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1453' href='#L_CASTS_1453'><pre>1453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<OperandBundleDef, 1> OpBundles;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1454' href='#L_CASTS_1454'><pre>1454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getOperandBundlesAsDefs(OpBundles);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1455' href='#L_CASTS_1455'><pre>1455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1456' href='#L_CASTS_1456'><pre>1456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Args[] = { InnerTrunc };</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1457' href='#L_CASTS_1457'><pre>1457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewCI = CallInst::Create(Overload, Args,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1458' href='#L_CASTS_1458'><pre>1458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OpBundles, II->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1459' href='#L_CASTS_1459'><pre>1459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCI->copyFastMathFlags(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1460' href='#L_CASTS_1460'><pre>1460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewCI</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1461' href='#L_CASTS_1461'><pre>1461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1462' href='#L_CASTS_1462'><pre>1462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1463' href='#L_CASTS_1463'><pre>1463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1464' href='#L_CASTS_1464'><pre>1464</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1465' href='#L_CASTS_1465'><pre>1465</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>3.95k</span></div><div class='tooltip'>I<span class='tooltip-content'>3.95k</span></div> = shrinkInsertElt(CI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1466' href='#L_CASTS_1466'><pre>1466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1467' href='#L_CASTS_1467'><pre>1467</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1468' href='#L_CASTS_1468'><pre>1468</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1469' href='#L_CASTS_1469'><pre>1469</pre></a></td><td class='covered-line'><pre>3.95k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1470' href='#L_CASTS_1470'><pre>1470</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1471' href='#L_CASTS_1471'><pre>1471</pre></a></td><td class='covered-line'><pre>8.77k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFPExt(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1472' href='#L_CASTS_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>8.77k</pre></td><td class='code'><pre> return commonCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1473' href='#L_CASTS_1473'><pre>1473</pre></a></td><td class='covered-line'><pre>8.77k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1474' href='#L_CASTS_1474'><pre>1474</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1475' href='#L_CASTS_1475'><pre>1475</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// fpto{s/u}i({u/s}itofp(X)) --> X or zext(X) or sext(X) or trunc(X)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1476' href='#L_CASTS_1476'><pre>1476</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This is safe if the intermediate type has enough bits in its mantissa to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1477' href='#L_CASTS_1477'><pre>1477</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// accurately represent all values of X. For example, this won't work with</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1478' href='#L_CASTS_1478'><pre>1478</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// i64 -> float -> i64.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1479' href='#L_CASTS_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>6.32k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldItoFPtoI(Instruction &FI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1480' href='#L_CASTS_1480'><pre>1480</pre></a></td><td class='covered-line'><pre>6.32k</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<UIToFPInst>(FI.getOperand(0)) && <span class='tooltip-content'>6.32k</span></div><div class='tooltip'>!isa<SIToFPInst>(FI.getOperand(0))<span class='tooltip-content'>6.32k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1481' href='#L_CASTS_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>6.32k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1482' href='#L_CASTS_1482'><pre>1482</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Instruction *OpI = cast<Instruction>(FI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1483' href='#L_CASTS_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1484' href='#L_CASTS_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *SrcI = OpI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1485' href='#L_CASTS_1485'><pre>1485</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Type *FITy = FI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1486' href='#L_CASTS_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Type *OpITy = OpI->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1487' href='#L_CASTS_1487'><pre>1487</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Type *SrcTy = SrcI->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1488' href='#L_CASTS_1488'><pre>1488</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> bool IsInputSigned = isa<SIToFPInst>(OpI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1489' href='#L_CASTS_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> bool IsOutputSigned = isa<FPToSIInst>(FI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1490' href='#L_CASTS_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1491' href='#L_CASTS_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // We can safely assume the conversion won't overflow the output range,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1492' href='#L_CASTS_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // because (for example) (uint8_t)18293.f is undefined behavior.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1493' href='#L_CASTS_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1494' href='#L_CASTS_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Since we can assume the conversion won't overflow, our decision as to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1495' href='#L_CASTS_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // whether the input will fit in the float should depend on the minimum</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1496' href='#L_CASTS_1496'><pre>1496</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // of the input range and output range.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1497' href='#L_CASTS_1497'><pre>1497</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1498' href='#L_CASTS_1498'><pre>1498</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // This means this is also safe for a signed input and unsigned output, since</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1499' href='#L_CASTS_1499'><pre>1499</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // a negative input would lead to undefined behavior.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1500' href='#L_CASTS_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> int InputSize = (int)SrcTy->getScalarSizeInBits() - IsInputSigned;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1501' href='#L_CASTS_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> int OutputSize = (int)FITy->getScalarSizeInBits() - IsOutputSigned;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1502' href='#L_CASTS_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> int ActualSize = std::min(InputSize, OutputSize);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1503' href='#L_CASTS_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1504' href='#L_CASTS_1504'><pre>1504</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>ActualSize <= OpITy->getFPMantissaWidth()<span class='tooltip-content'>2</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1505' href='#L_CASTS_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>FITy->getScalarSizeInBits() > SrcTy->getScalarSizeInBits()<span class='tooltip-content'>2</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1506' href='#L_CASTS_1506'><pre>1506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsInputSigned && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IsOutputSigned</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1507' href='#L_CASTS_1507'><pre>1507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new SExtInst(SrcI, FITy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1508' href='#L_CASTS_1508'><pre>1508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ZExtInst(SrcI, FITy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1509' href='#L_CASTS_1509'><pre>1509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1510' href='#L_CASTS_1510'><pre>1510</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>FITy->getScalarSizeInBits() < SrcTy->getScalarSizeInBits()<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1511' href='#L_CASTS_1511'><pre>1511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new TruncInst(SrcI, FITy)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1512' href='#L_CASTS_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>SrcTy == FITy<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1513' href='#L_CASTS_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(FI, SrcI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1514' href='#L_CASTS_1514'><pre>1514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new BitCastInst(SrcI, FITy)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1515' href='#L_CASTS_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1516' href='#L_CASTS_1516'><pre>1516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1517' href='#L_CASTS_1517'><pre>1517</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1518' href='#L_CASTS_1518'><pre>1518</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1519' href='#L_CASTS_1519'><pre>1519</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFPToUI(FPToUIInst &FI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1520' href='#L_CASTS_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1521' href='#L_CASTS_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> if (!OpI)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1522' href='#L_CASTS_1522'><pre>1522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return commonCastTransforms(FI)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1523' href='#L_CASTS_1523'><pre>1523</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1524' href='#L_CASTS_1524'><pre>1524</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.37k</span></div><div class='tooltip'>I<span class='tooltip-content'>1.37k</span></div> = FoldItoFPtoI(FI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1525' href='#L_CASTS_1525'><pre>1525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1526' href='#L_CASTS_1526'><pre>1526</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1527' href='#L_CASTS_1527'><pre>1527</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> return commonCastTransforms(FI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1528' href='#L_CASTS_1528'><pre>1528</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1529' href='#L_CASTS_1529'><pre>1529</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1530' href='#L_CASTS_1530'><pre>1530</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFPToSI(FPToSIInst &FI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1531' href='#L_CASTS_1531'><pre>1531</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre> Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1532' href='#L_CASTS_1532'><pre>1532</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre> if (!OpI)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1533' href='#L_CASTS_1533'><pre>1533</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return commonCastTransforms(FI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1534' href='#L_CASTS_1534'><pre>1534</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1535' href='#L_CASTS_1535'><pre>1535</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>4.95k</span></div><div class='tooltip'>I<span class='tooltip-content'>4.95k</span></div> = FoldItoFPtoI(FI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1536' href='#L_CASTS_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1537' href='#L_CASTS_1537'><pre>1537</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1538' href='#L_CASTS_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre> return commonCastTransforms(FI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1539' href='#L_CASTS_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>4.95k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1540' href='#L_CASTS_1540'><pre>1540</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1541' href='#L_CASTS_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitUIToFP(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1542' href='#L_CASTS_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre> return commonCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1543' href='#L_CASTS_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1544' href='#L_CASTS_1544'><pre>1544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1545' href='#L_CASTS_1545'><pre>1545</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSIToFP(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1546' href='#L_CASTS_1546'><pre>1546</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> return commonCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1547' href='#L_CASTS_1547'><pre>1547</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1548' href='#L_CASTS_1548'><pre>1548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1549' href='#L_CASTS_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitIntToPtr(IntToPtrInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1550' href='#L_CASTS_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> // If the source integer type is not the intptr_t type for this target, do a</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1551' href='#L_CASTS_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> // trunc or zext to the intptr_t type, then inttoptr of it. This allows the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1552' href='#L_CASTS_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> // cast to be exposed to other transforms.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1553' href='#L_CASTS_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> unsigned AS = CI.getAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1554' href='#L_CASTS_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> if (CI.getOperand(0)->getType()->getScalarSizeInBits() !=</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1555' href='#L_CASTS_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> DL.getPointerSizeInBits(AS)) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1556' href='#L_CASTS_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Type *Ty = DL.getIntPtrType(CI.getContext(), AS);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1557' href='#L_CASTS_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (CI.getType()->isVectorTy()) // Handle vectors of pointers.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1558' href='#L_CASTS_1558'><pre>1558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ty = VectorType::get(Ty, CI.getType()->getVectorNumElements())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1559' href='#L_CASTS_1559'><pre>1559</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1560' href='#L_CASTS_1560'><pre>1560</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *P = Builder->CreateZExtOrTrunc(CI.getOperand(0), Ty);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1561' href='#L_CASTS_1561'><pre>1561</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new IntToPtrInst(P, CI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1562' href='#L_CASTS_1562'><pre>1562</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1563' href='#L_CASTS_1563'><pre>1563</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1564' href='#L_CASTS_1564'><pre>1564</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>35.6k</span></div><div class='tooltip'>I<span class='tooltip-content'>35.6k</span></div> = commonCastTransforms(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1565' href='#L_CASTS_1565'><pre>1565</pre></a></td><td class='covered-line'><pre>5.46k</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1566' href='#L_CASTS_1566'><pre>1566</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1567' href='#L_CASTS_1567'><pre>1567</pre></a></td><td class='covered-line'><pre>30.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1568' href='#L_CASTS_1568'><pre>1568</pre></a></td><td class='covered-line'><pre>35.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1569' href='#L_CASTS_1569'><pre>1569</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1570' href='#L_CASTS_1570'><pre>1570</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// @brief Implement the transforms for cast of pointer (bitcast/ptrtoint)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1571' href='#L_CASTS_1571'><pre>1571</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre>Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1572' href='#L_CASTS_1572'><pre>1572</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1573' href='#L_CASTS_1573'><pre>1573</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1574' href='#L_CASTS_1574'><pre>1574</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre> if (GetElementPtrInst *<div class='tooltip'>GEP<span class='tooltip-content'>1.39M</span></div> = dyn_cast<GetElementPtrInst>(Src)) <div class='tooltip'>{<span class='tooltip-content'>670k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1575' href='#L_CASTS_1575'><pre>1575</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> // If casting the result of a getelementptr instruction with no offset, turn</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1576' href='#L_CASTS_1576'><pre>1576</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> // this into a cast of the original pointer!</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1577' href='#L_CASTS_1577'><pre>1577</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> if (GEP->hasAllZeroIndices() &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1578' href='#L_CASTS_1578'><pre>1578</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> // If CI is an addrspacecast and GEP changes the poiner type, merging</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1579' href='#L_CASTS_1579'><pre>1579</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> // GEP into CI would undo canonicalizing addrspacecast with different</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1580' href='#L_CASTS_1580'><pre>1580</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> // pointer types, causing infinite loops.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1581' href='#L_CASTS_1581'><pre>1581</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> (!isa<AddrSpaceCastInst>(CI) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1582' href='#L_CASTS_1582'><pre>1582</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>GEP->getType() == GEP->getPointerOperand()->getType()</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>17.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1583' href='#L_CASTS_1583'><pre>1583</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> // Changing the cast operand is usually not a good idea but it is safe</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1584' href='#L_CASTS_1584'><pre>1584</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> // here because the pointer operand is being replaced with another</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1585' href='#L_CASTS_1585'><pre>1585</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> // pointer operand so the opcode doesn't need to change.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1586' href='#L_CASTS_1586'><pre>1586</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> Worklist.Add(GEP);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1587' href='#L_CASTS_1587'><pre>1587</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> CI.setOperand(0, GEP->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1588' href='#L_CASTS_1588'><pre>1588</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> return &CI;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1589' href='#L_CASTS_1589'><pre>1589</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1590' href='#L_CASTS_1590'><pre>1590</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1591' href='#L_CASTS_1591'><pre>1591</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1592' href='#L_CASTS_1592'><pre>1592</pre></a></td><td class='covered-line'><pre>1.38M</pre></td><td class='code'><pre> return commonCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1593' href='#L_CASTS_1593'><pre>1593</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1594' href='#L_CASTS_1594'><pre>1594</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1595' href='#L_CASTS_1595'><pre>1595</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitPtrToInt(PtrToIntInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1596' href='#L_CASTS_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> // If the destination integer type is not the intptr_t type for this target,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1597' href='#L_CASTS_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> // do a ptrtoint to intptr_t then do a trunc or zext. This allows the cast</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1598' href='#L_CASTS_1598'><pre>1598</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> // to be exposed to other transforms.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1599' href='#L_CASTS_1599'><pre>1599</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1600' href='#L_CASTS_1600'><pre>1600</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> Type *Ty = CI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1601' href='#L_CASTS_1601'><pre>1601</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> unsigned AS = CI.getPointerAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1602' href='#L_CASTS_1602'><pre>1602</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1603' href='#L_CASTS_1603'><pre>1603</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre> if (Ty->getScalarSizeInBits() == DL.getPointerSizeInBits(AS))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1604' href='#L_CASTS_1604'><pre>1604</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> return commonPointerCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1605' href='#L_CASTS_1605'><pre>1605</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1606' href='#L_CASTS_1606'><pre>1606</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> Type *PtrTy = DL.getIntPtrType(CI.getContext(), AS);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1607' href='#L_CASTS_1607'><pre>1607</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> if (Ty->isVectorTy()) // Handle vectors of pointers.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1608' href='#L_CASTS_1608'><pre>1608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>PtrTy = VectorType::get(PtrTy, Ty->getVectorNumElements())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1609' href='#L_CASTS_1609'><pre>1609</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1610' href='#L_CASTS_1610'><pre>1610</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> Value *P = Builder->CreatePtrToInt(CI.getOperand(0), PtrTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1611' href='#L_CASTS_1611'><pre>1611</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> return CastInst::CreateIntegerCast(P, Ty, /*isSigned=*/false);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1612' href='#L_CASTS_1612'><pre>1612</pre></a></td><td class='covered-line'><pre>79.8k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1613' href='#L_CASTS_1613'><pre>1613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1614' href='#L_CASTS_1614'><pre>1614</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This input value (which is known to have vector type) is being zero extended</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1615' href='#L_CASTS_1615'><pre>1615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// or truncated to the specified vector type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1616' href='#L_CASTS_1616'><pre>1616</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to replace it with a shuffle (and vector/vector bitcast) if possible.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1617' href='#L_CASTS_1617'><pre>1617</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1618' href='#L_CASTS_1618'><pre>1618</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The source and destination vector types may have different element types.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1619' href='#L_CASTS_1619'><pre>1619</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1620' href='#L_CASTS_1620'><pre>1620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1621' href='#L_CASTS_1621'><pre>1621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We can only do this optimization if the output is a multiple of the input</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1622' href='#L_CASTS_1622'><pre>1622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // element size, or the input is a multiple of the output element size.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1623' href='#L_CASTS_1623'><pre>1623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Convert the input type to have the same element type as the output.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1624' href='#L_CASTS_1624'><pre>1624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *SrcTy = cast<VectorType>(InVal->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1625' href='#L_CASTS_1625'><pre>1625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1626' href='#L_CASTS_1626'><pre>1626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SrcTy->getElementType() != DestTy->getElementType()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1627' href='#L_CASTS_1627'><pre>1627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The input types don't need to be identical, but for now they must be the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1628' href='#L_CASTS_1628'><pre>1628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // same size. There is no specific reason we couldn't handle things like</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1629' href='#L_CASTS_1629'><pre>1629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // <4 x i16> -> <4 x i32> by bitcasting to <2 x i32> but haven't gotten</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1630' href='#L_CASTS_1630'><pre>1630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // there yet.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1631' href='#L_CASTS_1631'><pre>1631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>SrcTy->getElementType()->getPrimitiveSizeInBits() !=</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1632' href='#L_CASTS_1632'><pre>1632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DestTy->getElementType()->getPrimitiveSizeInBits()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1633' href='#L_CASTS_1633'><pre>1633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1634' href='#L_CASTS_1634'><pre>1634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1635' href='#L_CASTS_1635'><pre>1635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SrcTy = VectorType::get(DestTy->getElementType(), SrcTy->getNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1636' href='#L_CASTS_1636'><pre>1636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InVal = IC.Builder->CreateBitCast(InVal, SrcTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1637' href='#L_CASTS_1637'><pre>1637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1638' href='#L_CASTS_1638'><pre>1638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1639' href='#L_CASTS_1639'><pre>1639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Now that the element types match, get the shuffle mask and RHS of the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1640' href='#L_CASTS_1640'><pre>1640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shuffle to use, which depends on whether we're increasing or decreasing the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1641' href='#L_CASTS_1641'><pre>1641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // size of the input.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1642' href='#L_CASTS_1642'><pre>1642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SmallVector<uint32_t, 16> ShuffleMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1643' href='#L_CASTS_1643'><pre>1643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V2;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1644' href='#L_CASTS_1644'><pre>1644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1645' href='#L_CASTS_1645'><pre>1645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SrcTy->getNumElements() > DestTy->getNumElements()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1646' href='#L_CASTS_1646'><pre>1646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we're shrinking the number of elements, just shuffle in the low</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1647' href='#L_CASTS_1647'><pre>1647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements from the input and use undef as the second shuffle input.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1648' href='#L_CASTS_1648'><pre>1648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V2 = UndefValue::get(SrcTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1649' href='#L_CASTS_1649'><pre>1649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = DestTy->getNumElements(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1650' href='#L_CASTS_1650'><pre>1650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1651' href='#L_CASTS_1651'><pre>1651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1652' href='#L_CASTS_1652'><pre>1652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1653' href='#L_CASTS_1653'><pre>1653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we're increasing the number of elements, shuffle in all of the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1654' href='#L_CASTS_1654'><pre>1654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements from InVal and fill the rest of the result elements with zeros</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1655' href='#L_CASTS_1655'><pre>1655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // from a constant zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1656' href='#L_CASTS_1656'><pre>1656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V2 = Constant::getNullValue(SrcTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1657' href='#L_CASTS_1657'><pre>1657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SrcElts = SrcTy->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1658' href='#L_CASTS_1658'><pre>1658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = SrcElts; </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1659' href='#L_CASTS_1659'><pre>1659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1660' href='#L_CASTS_1660'><pre>1660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1661' href='#L_CASTS_1661'><pre>1661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The excess elements reference the first element of the zero input.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1662' href='#L_CASTS_1662'><pre>1662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = DestTy->getNumElements()-SrcElts; </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1663' href='#L_CASTS_1663'><pre>1663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask.push_back(SrcElts)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1664' href='#L_CASTS_1664'><pre>1664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1665' href='#L_CASTS_1665'><pre>1665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1666' href='#L_CASTS_1666'><pre>1666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ShuffleVectorInst(InVal, V2,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1667' href='#L_CASTS_1667'><pre>1667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantDataVector::get(V2->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1668' href='#L_CASTS_1668'><pre>1668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShuffleMask))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1669' href='#L_CASTS_1669'><pre>1669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1670' href='#L_CASTS_1670'><pre>1670</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1671' href='#L_CASTS_1671'><pre>1671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isMultipleOfTypeSize(unsigned Value, Type *Ty) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1672' href='#L_CASTS_1672'><pre>1672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Value % Ty->getPrimitiveSizeInBits() == 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1673' href='#L_CASTS_1673'><pre>1673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1674' href='#L_CASTS_1674'><pre>1674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1675' href='#L_CASTS_1675'><pre>1675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static unsigned getTypeSizeIndex(unsigned Value, Type *Ty) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1676' href='#L_CASTS_1676'><pre>1676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Value / Ty->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1677' href='#L_CASTS_1677'><pre>1677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1678' href='#L_CASTS_1678'><pre>1678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1679' href='#L_CASTS_1679'><pre>1679</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// V is a value which is inserted into a vector of VecEltTy.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1680' href='#L_CASTS_1680'><pre>1680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Look through the value to see if we can decompose it into</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1681' href='#L_CASTS_1681'><pre>1681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// insertions into the vector. See the example in the comment for</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1682' href='#L_CASTS_1682'><pre>1682</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// OptimizeIntegerToVectorInsertions for the pattern this handles.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1683' href='#L_CASTS_1683'><pre>1683</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The type of V is always a non-zero multiple of VecEltTy's size.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1684' href='#L_CASTS_1684'><pre>1684</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Shift is the number of bits between the lsb of V and the lsb of</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1685' href='#L_CASTS_1685'><pre>1685</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the vector.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1686' href='#L_CASTS_1686'><pre>1686</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1687' href='#L_CASTS_1687'><pre>1687</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This returns false if the pattern can't be matched or true if it can,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1688' href='#L_CASTS_1688'><pre>1688</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// filling in Elements with the elements found here.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1689' href='#L_CASTS_1689'><pre>1689</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool collectInsertionElements(Value *V, unsigned Shift,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1690' href='#L_CASTS_1690'><pre>1690</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SmallVectorImpl<Value *> &Elements,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1691' href='#L_CASTS_1691'><pre>1691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Type *VecEltTy, bool isBigEndian) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1692' href='#L_CASTS_1692'><pre>1692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(isMultipleOfTypeSize(Shift, VecEltTy) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1693' href='#L_CASTS_1693'><pre>1693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Shift should be a multiple of the element type size");</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1694' href='#L_CASTS_1694'><pre>1694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1695' href='#L_CASTS_1695'><pre>1695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Undef values never contribute useful bits to the result.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1696' href='#L_CASTS_1696'><pre>1696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<UndefValue>(V)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return true</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1697' href='#L_CASTS_1697'><pre>1697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1698' href='#L_CASTS_1698'><pre>1698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we got down to a value of the right type, we win, try inserting into the</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1699' href='#L_CASTS_1699'><pre>1699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // right element.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1700' href='#L_CASTS_1700'><pre>1700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V->getType() == VecEltTy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1701' href='#L_CASTS_1701'><pre>1701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Inserting null doesn't actually insert any elements.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1702' href='#L_CASTS_1702'><pre>1702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Constant *</span><span class='red'>C</span><span class='red'> = dyn_cast<Constant>(V))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1703' href='#L_CASTS_1703'><pre>1703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1704' href='#L_CASTS_1704'><pre>1704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1705' href='#L_CASTS_1705'><pre>1705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1706' href='#L_CASTS_1706'><pre>1706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned ElementIndex = getTypeSizeIndex(Shift, VecEltTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1707' href='#L_CASTS_1707'><pre>1707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isBigEndian</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1708' href='#L_CASTS_1708'><pre>1708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ElementIndex = Elements.size() - ElementIndex - 1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1709' href='#L_CASTS_1709'><pre>1709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1710' href='#L_CASTS_1710'><pre>1710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Fail if multiple elements are inserted into this slot.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1711' href='#L_CASTS_1711'><pre>1711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Elements[ElementIndex]</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1712' href='#L_CASTS_1712'><pre>1712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1713' href='#L_CASTS_1713'><pre>1713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1714' href='#L_CASTS_1714'><pre>1714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Elements[ElementIndex] = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1715' href='#L_CASTS_1715'><pre>1715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1716' href='#L_CASTS_1716'><pre>1716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1717' href='#L_CASTS_1717'><pre>1717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1718' href='#L_CASTS_1718'><pre>1718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Constant *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(V)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1719' href='#L_CASTS_1719'><pre>1719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Figure out the # elements this provides, and bitcast it or slice it up</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1720' href='#L_CASTS_1720'><pre>1720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // as required.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1721' href='#L_CASTS_1721'><pre>1721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumElts = getTypeSizeIndex(C->getType()->getPrimitiveSizeInBits(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1722' href='#L_CASTS_1722'><pre>1722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VecEltTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1723' href='#L_CASTS_1723'><pre>1723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the constant is the size of a vector element, we just need to bitcast</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1724' href='#L_CASTS_1724'><pre>1724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // it to the right type so it gets properly inserted.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1725' href='#L_CASTS_1725'><pre>1725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NumElts == 1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1726' href='#L_CASTS_1726'><pre>1726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return collectInsertionElements(ConstantExpr::getBitCast(C, VecEltTy),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1727' href='#L_CASTS_1727'><pre>1727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Shift, Elements, VecEltTy, isBigEndian)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1728' href='#L_CASTS_1728'><pre>1728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1729' href='#L_CASTS_1729'><pre>1729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Okay, this is a constant that covers multiple elements. Slice it up into</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1730' href='#L_CASTS_1730'><pre>1730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // pieces and insert each element-sized piece into the vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1731' href='#L_CASTS_1731'><pre>1731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<IntegerType>(C->getType())</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1732' href='#L_CASTS_1732'><pre>1732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>C = ConstantExpr::getBitCast(C, IntegerType::get(V->getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1733' href='#L_CASTS_1733'><pre>1733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> C->getType()->getPrimitiveSizeInBits()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1734' href='#L_CASTS_1734'><pre>1734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ElementSize = VecEltTy->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1735' href='#L_CASTS_1735'><pre>1735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *ElementIntTy = IntegerType::get(C->getContext(), ElementSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1736' href='#L_CASTS_1736'><pre>1736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1737' href='#L_CASTS_1737'><pre>1737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1738' href='#L_CASTS_1738'><pre>1738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ShiftI = Shift+i*ElementSize;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1739' href='#L_CASTS_1739'><pre>1739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Piece = ConstantExpr::getLShr(C, ConstantInt::get(C->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1740' href='#L_CASTS_1740'><pre>1740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ShiftI));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1741' href='#L_CASTS_1741'><pre>1741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Piece = ConstantExpr::getTrunc(Piece, ElementIntTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1742' href='#L_CASTS_1742'><pre>1742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!collectInsertionElements(Piece, ShiftI, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1743' href='#L_CASTS_1743'><pre>1743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1744' href='#L_CASTS_1744'><pre>1744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1745' href='#L_CASTS_1745'><pre>1745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1746' href='#L_CASTS_1746'><pre>1746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1747' href='#L_CASTS_1747'><pre>1747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1748' href='#L_CASTS_1748'><pre>1748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1749' href='#L_CASTS_1749'><pre>1749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!V->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1750' href='#L_CASTS_1750'><pre>1750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1751' href='#L_CASTS_1751'><pre>1751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Instruction *I = dyn_cast<Instruction>(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1752' href='#L_CASTS_1752'><pre>1752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1753' href='#L_CASTS_1753'><pre>1753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>switch (I->getOpcode()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1754' href='#L_CASTS_1754'><pre>1754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default: return false; // Unhandled case.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1755' href='#L_CASTS_1755'><pre>1755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::BitCast:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1756' href='#L_CASTS_1756'><pre>1756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return collectInsertionElements(I->getOperand(0), Shift, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1757' href='#L_CASTS_1757'><pre>1757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1758' href='#L_CASTS_1758'><pre>1758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::ZExt:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1759' href='#L_CASTS_1759'><pre>1759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!isMultipleOfTypeSize(</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1760' href='#L_CASTS_1760'><pre>1760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->getOperand(0)->getType()->getPrimitiveSizeInBits(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1761' href='#L_CASTS_1761'><pre>1761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VecEltTy)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1762' href='#L_CASTS_1762'><pre>1762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1763' href='#L_CASTS_1763'><pre>1763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return collectInsertionElements(I->getOperand(0), Shift, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1764' href='#L_CASTS_1764'><pre>1764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1765' href='#L_CASTS_1765'><pre>1765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Or:</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1766' href='#L_CASTS_1766'><pre>1766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return collectInsertionElements(I->getOperand(0), Shift, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1767' href='#L_CASTS_1767'><pre>1767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1768' href='#L_CASTS_1768'><pre>1768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>collectInsertionElements(I->getOperand(1), Shift, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1769' href='#L_CASTS_1769'><pre>1769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1770' href='#L_CASTS_1770'><pre>1770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Shl: {</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1771' href='#L_CASTS_1771'><pre>1771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Must be shifting by a constant that is a multiple of the element size.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1772' href='#L_CASTS_1772'><pre>1772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1773' href='#L_CASTS_1773'><pre>1773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1774' href='#L_CASTS_1774'><pre>1774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Shift += CI->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1775' href='#L_CASTS_1775'><pre>1775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!isMultipleOfTypeSize(Shift, VecEltTy)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1776' href='#L_CASTS_1776'><pre>1776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return collectInsertionElements(I->getOperand(0), Shift, Elements, VecEltTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1777' href='#L_CASTS_1777'><pre>1777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isBigEndian)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1778' href='#L_CASTS_1778'><pre>1778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1779' href='#L_CASTS_1779'><pre>1779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1780' href='#L_CASTS_1780'><pre>1780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1781' href='#L_CASTS_1781'><pre>1781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1782' href='#L_CASTS_1782'><pre>1782</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1783' href='#L_CASTS_1783'><pre>1783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1784' href='#L_CASTS_1784'><pre>1784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If the input is an 'or' instruction, we may be doing shifts and ors to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1785' href='#L_CASTS_1785'><pre>1785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// assemble the elements of the vector manually.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1786' href='#L_CASTS_1786'><pre>1786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to rip the code out and replace it with insertelements. This is to</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1787' href='#L_CASTS_1787'><pre>1787</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// optimize code like this:</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1788' href='#L_CASTS_1788'><pre>1788</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1789' href='#L_CASTS_1789'><pre>1789</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp37 = bitcast float %inc to i32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1790' href='#L_CASTS_1790'><pre>1790</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp38 = zext i32 %tmp37 to i64</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1791' href='#L_CASTS_1791'><pre>1791</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp31 = bitcast float %inc5 to i32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1792' href='#L_CASTS_1792'><pre>1792</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp32 = zext i32 %tmp31 to i64</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1793' href='#L_CASTS_1793'><pre>1793</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp33 = shl i64 %tmp32, 32</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1794' href='#L_CASTS_1794'><pre>1794</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %ins35 = or i64 %tmp33, %tmp38</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1795' href='#L_CASTS_1795'><pre>1795</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %tmp43 = bitcast i64 %ins35 to <2 x float></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1796' href='#L_CASTS_1796'><pre>1796</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1797' href='#L_CASTS_1797'><pre>1797</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Into two insertelements that do "buildvector{%inc, %inc5}".</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1798' href='#L_CASTS_1798'><pre>1798</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *optimizeIntegerToVectorInsertions(BitCastInst &CI,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1799' href='#L_CASTS_1799'><pre>1799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1800' href='#L_CASTS_1800'><pre>1800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *DestVecTy = cast<VectorType>(CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1801' href='#L_CASTS_1801'><pre>1801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *IntInput = CI.getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1802' href='#L_CASTS_1802'><pre>1802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1803' href='#L_CASTS_1803'><pre>1803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Value*, 8> Elements(DestVecTy->getNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1804' href='#L_CASTS_1804'><pre>1804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!collectInsertionElements(IntInput, 0, Elements,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1805' href='#L_CASTS_1805'><pre>1805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DestVecTy->getElementType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1806' href='#L_CASTS_1806'><pre>1806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.getDataLayout().isBigEndian())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1807' href='#L_CASTS_1807'><pre>1807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1808' href='#L_CASTS_1808'><pre>1808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1809' href='#L_CASTS_1809'><pre>1809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we succeeded, we know that all of the element are specified by Elements</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1810' href='#L_CASTS_1810'><pre>1810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // or are zero if Elements has a null entry. Recast this as a set of</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1811' href='#L_CASTS_1811'><pre>1811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // insertions.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1812' href='#L_CASTS_1812'><pre>1812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *Result = Constant::getNullValue(CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1813' href='#L_CASTS_1813'><pre>1813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = Elements.size(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1814' href='#L_CASTS_1814'><pre>1814</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Elements[i]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>continue</span><span class='tooltip-content'>0</span></div><span class='red'>; // Unset element.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1815' href='#L_CASTS_1815'><pre>1815</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1816' href='#L_CASTS_1816'><pre>1816</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Result = IC.Builder->CreateInsertElement(Result, Elements[i],</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1817' href='#L_CASTS_1817'><pre>1817</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Builder->getInt32(i));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1818' href='#L_CASTS_1818'><pre>1818</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1819' href='#L_CASTS_1819'><pre>1819</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1820' href='#L_CASTS_1820'><pre>1820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Result</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1821' href='#L_CASTS_1821'><pre>1821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1822' href='#L_CASTS_1822'><pre>1822</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1823' href='#L_CASTS_1823'><pre>1823</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Canonicalize scalar bitcasts of extracted elements into a bitcast of the</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1824' href='#L_CASTS_1824'><pre>1824</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// vector followed by extract element. The backend tends to handle bitcasts of</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1825' href='#L_CASTS_1825'><pre>1825</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// vectors better than bitcasts of scalars because vector registers are</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1826' href='#L_CASTS_1826'><pre>1826</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// usually not type-specific like scalar integer or scalar floating-point.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1827' href='#L_CASTS_1827'><pre>1827</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *canonicalizeBitCastExtElt(BitCastInst &BitCast,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1828' href='#L_CASTS_1828'><pre>1828</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1829' href='#L_CASTS_1829'><pre>1829</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1830' href='#L_CASTS_1830'><pre>1830</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // TODO: Create and use a pattern matcher for ExtractElementInst.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1831' href='#L_CASTS_1831'><pre>1831</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> auto *ExtElt = dyn_cast<ExtractElementInst>(BitCast.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1832' href='#L_CASTS_1832'><pre>1832</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> if (<div class='tooltip'>!ExtElt || <span class='tooltip-content'>1.32M</span></div><div class='tooltip'>!ExtElt->hasOneUse()<span class='tooltip-content'>70</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1833' href='#L_CASTS_1833'><pre>1833</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1834' href='#L_CASTS_1834'><pre>1834</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1835' href='#L_CASTS_1835'><pre>1835</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // The bitcast must be to a vectorizable type, otherwise we can't make a new</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1836' href='#L_CASTS_1836'><pre>1836</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // type to extract from.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1837' href='#L_CASTS_1837'><pre>1837</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> Type *DestType = BitCast.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1838' href='#L_CASTS_1838'><pre>1838</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> if (!VectorType::isValidElementType(DestType))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1839' href='#L_CASTS_1839'><pre>1839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1840' href='#L_CASTS_1840'><pre>1840</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1841' href='#L_CASTS_1841'><pre>1841</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> unsigned NumElts = ExtElt->getVectorOperandType()->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1842' href='#L_CASTS_1842'><pre>1842</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> auto *NewVecType = VectorType::get(DestType, NumElts);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1843' href='#L_CASTS_1843'><pre>1843</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> auto *NewBC = IC.Builder->CreateBitCast(ExtElt->getVectorOperand(),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1844' href='#L_CASTS_1844'><pre>1844</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> NewVecType, "bc");</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1845' href='#L_CASTS_1845'><pre>1845</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> return ExtractElementInst::Create(NewBC, ExtElt->getIndexOperand());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1846' href='#L_CASTS_1846'><pre>1846</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1847' href='#L_CASTS_1847'><pre>1847</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1848' href='#L_CASTS_1848'><pre>1848</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Change the type of a bitwise logic operation if we can eliminate a bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1849' href='#L_CASTS_1849'><pre>1849</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldBitCastBitwiseLogic(BitCastInst &BitCast,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1850' href='#L_CASTS_1850'><pre>1850</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1851' href='#L_CASTS_1851'><pre>1851</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> Type *DestTy = BitCast.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1852' href='#L_CASTS_1852'><pre>1852</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> BinaryOperator *BO;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1853' href='#L_CASTS_1853'><pre>1853</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> if (!DestTy->getScalarType()->isIntegerTy() ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1854' href='#L_CASTS_1854'><pre>1854</pre></a></td><td class='covered-line'><pre>3.59k</pre></td><td class='code'><pre> !match(BitCast.getOperand(0), m_OneUse(m_BinOp(BO))) ||</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1855' href='#L_CASTS_1855'><pre>1855</pre></a></td><td class='covered-line'><pre>966</pre></td><td class='code'><pre> !BO->isBitwiseLogicOp())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1856' href='#L_CASTS_1856'><pre>1856</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1857' href='#L_CASTS_1857'><pre>1857</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> </pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1858' href='#L_CASTS_1858'><pre>1858</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // FIXME: This transform is restricted to vector types to avoid backend</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1859' href='#L_CASTS_1859'><pre>1859</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // problems caused by creating potentially illegal operations. If a fix-up is</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1860' href='#L_CASTS_1860'><pre>1860</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // added to handle that situation, we can remove this check.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1861' href='#L_CASTS_1861'><pre>1861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!DestTy->isVectorTy() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!BO->getType()->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1862' href='#L_CASTS_1862'><pre>1862</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1863' href='#L_CASTS_1863'><pre>1863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1864' href='#L_CASTS_1864'><pre>1864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *X;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1865' href='#L_CASTS_1865'><pre>1865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(BO->getOperand(0), m_OneUse(m_BitCast(m_Value(X)))) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1866' href='#L_CASTS_1866'><pre>1866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>X->getType() == DestTy</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!isa<Constant>(X)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1867' href='#L_CASTS_1867'><pre>1867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bitcast(logic(bitcast(X), Y)) --> logic'(X, bitcast(Y))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1868' href='#L_CASTS_1868'><pre>1868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CastedOp1 = Builder.CreateBitCast(BO->getOperand(1), DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1869' href='#L_CASTS_1869'><pre>1869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(BO->getOpcode(), X, CastedOp1);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1870' href='#L_CASTS_1870'><pre>1870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1871' href='#L_CASTS_1871'><pre>1871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1872' href='#L_CASTS_1872'><pre>1872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(BO->getOperand(1), m_OneUse(m_BitCast(m_Value(X)))) &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1873' href='#L_CASTS_1873'><pre>1873</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>X->getType() == DestTy</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>!isa<Constant>(X)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1874' href='#L_CASTS_1874'><pre>1874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bitcast(logic(Y, bitcast(X))) --> logic'(bitcast(Y), X)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1875' href='#L_CASTS_1875'><pre>1875</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CastedOp0 = Builder.CreateBitCast(BO->getOperand(0), DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1876' href='#L_CASTS_1876'><pre>1876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(BO->getOpcode(), CastedOp0, X);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1877' href='#L_CASTS_1877'><pre>1877</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1878' href='#L_CASTS_1878'><pre>1878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1879' href='#L_CASTS_1879'><pre>1879</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1880' href='#L_CASTS_1880'><pre>1880</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1881' href='#L_CASTS_1881'><pre>1881</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1882' href='#L_CASTS_1882'><pre>1882</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Change the type of a select if we can eliminate a bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1883' href='#L_CASTS_1883'><pre>1883</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldBitCastSelect(BitCastInst &BitCast,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1884' href='#L_CASTS_1884'><pre>1884</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1885' href='#L_CASTS_1885'><pre>1885</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> Value *Cond, *TVal, *FVal;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1886' href='#L_CASTS_1886'><pre>1886</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> if (!match(BitCast.getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1887' href='#L_CASTS_1887'><pre>1887</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> m_OneUse(m_Select(m_Value(Cond), m_Value(TVal), m_Value(FVal)))))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1888' href='#L_CASTS_1888'><pre>1888</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1889' href='#L_CASTS_1889'><pre>1889</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1890' href='#L_CASTS_1890'><pre>1890</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // A vector select must maintain the same number of elements in its operands.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1891' href='#L_CASTS_1891'><pre>1891</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> Type *CondTy = Cond->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1892' href='#L_CASTS_1892'><pre>1892</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> Type *DestTy = BitCast.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1893' href='#L_CASTS_1893'><pre>1893</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> if (<div class='tooltip'>CondTy->isVectorTy()<span class='tooltip-content'>1.33k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1894' href='#L_CASTS_1894'><pre>1894</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!DestTy->isVectorTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1895' href='#L_CASTS_1895'><pre>1895</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1896' href='#L_CASTS_1896'><pre>1896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DestTy->getVectorNumElements() != CondTy->getVectorNumElements()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1897' href='#L_CASTS_1897'><pre>1897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1898' href='#L_CASTS_1898'><pre>1898</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1899' href='#L_CASTS_1899'><pre>1899</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1900' href='#L_CASTS_1900'><pre>1900</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // FIXME: This transform is restricted from changing the select between</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1901' href='#L_CASTS_1901'><pre>1901</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // scalars and vectors to avoid backend problems caused by creating</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1902' href='#L_CASTS_1902'><pre>1902</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // potentially illegal operations. If a fix-up is added to handle that</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1903' href='#L_CASTS_1903'><pre>1903</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // situation, we can remove this check.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1904' href='#L_CASTS_1904'><pre>1904</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.33k</span></div><div class='tooltip'>DestTy->isVectorTy() != TVal->getType()->isVectorTy()<span class='tooltip-content'>1.33k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1905' href='#L_CASTS_1905'><pre>1905</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1906' href='#L_CASTS_1906'><pre>1906</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1907' href='#L_CASTS_1907'><pre>1907</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> auto *Sel = cast<Instruction>(BitCast.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1908' href='#L_CASTS_1908'><pre>1908</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1909' href='#L_CASTS_1909'><pre>1909</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(TVal, m_OneUse(m_BitCast(m_Value(X)))) && <span class='tooltip-content'>1.33k</span></div><div class='tooltip'>X->getType() == DestTy<span class='tooltip-content'>6</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1910' href='#L_CASTS_1910'><pre>1910</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> <div class='tooltip'>!isa<Constant>(X)<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1911' href='#L_CASTS_1911'><pre>1911</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // bitcast(select(Cond, bitcast(X), Y)) --> select'(Cond, X, bitcast(Y))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1912' href='#L_CASTS_1912'><pre>1912</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *CastedVal = Builder.CreateBitCast(FVal, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1913' href='#L_CASTS_1913'><pre>1913</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return SelectInst::Create(Cond, X, CastedVal, "", nullptr, Sel);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1914' href='#L_CASTS_1914'><pre>1914</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1915' href='#L_CASTS_1915'><pre>1915</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1916' href='#L_CASTS_1916'><pre>1916</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.32k</span></div><div class='tooltip'>match(FVal, m_OneUse(m_BitCast(m_Value(X)))) && <span class='tooltip-content'>1.32k</span></div><div class='tooltip'>X->getType() == DestTy<span class='tooltip-content'>1</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1917' href='#L_CASTS_1917'><pre>1917</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>!isa<Constant>(X)<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1918' href='#L_CASTS_1918'><pre>1918</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // bitcast(select(Cond, Y, bitcast(X))) --> select'(Cond, bitcast(Y), X)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1919' href='#L_CASTS_1919'><pre>1919</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *CastedVal = Builder.CreateBitCast(TVal, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1920' href='#L_CASTS_1920'><pre>1920</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return SelectInst::Create(Cond, CastedVal, X, "", nullptr, Sel);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1921' href='#L_CASTS_1921'><pre>1921</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1922' href='#L_CASTS_1922'><pre>1922</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1923' href='#L_CASTS_1923'><pre>1923</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1924' href='#L_CASTS_1924'><pre>1924</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1925' href='#L_CASTS_1925'><pre>1925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1926' href='#L_CASTS_1926'><pre>1926</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Check if all users of CI are StoreInsts.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1927' href='#L_CASTS_1927'><pre>1927</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre>static bool hasStoreUsersOnly(CastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1928' href='#L_CASTS_1928'><pre>1928</pre></a></td><td class='covered-line'><pre>46.5k</pre></td><td class='code'><pre> for (User *U : CI.users()) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1929' href='#L_CASTS_1929'><pre>1929</pre></a></td><td class='covered-line'><pre>46.5k</pre></td><td class='code'><pre> if (!isa<StoreInst>(U))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1930' href='#L_CASTS_1930'><pre>1930</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1931' href='#L_CASTS_1931'><pre>1931</pre></a></td><td class='covered-line'><pre>46.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1932' href='#L_CASTS_1932'><pre>1932</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1933' href='#L_CASTS_1933'><pre>1933</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1934' href='#L_CASTS_1934'><pre>1934</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1935' href='#L_CASTS_1935'><pre>1935</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function handles following case</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1936' href='#L_CASTS_1936'><pre>1936</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1937' href='#L_CASTS_1937'><pre>1937</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// A -> B cast</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1938' href='#L_CASTS_1938'><pre>1938</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// PHI</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1939' href='#L_CASTS_1939'><pre>1939</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// B -> A cast</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1940' href='#L_CASTS_1940'><pre>1940</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1941' href='#L_CASTS_1941'><pre>1941</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// All the related PHI nodes can be replaced by new PHI nodes with type A.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1942' href='#L_CASTS_1942'><pre>1942</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The uses of \p CI can be changed to the new PHI node corresponding to \p PN.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1943' href='#L_CASTS_1943'><pre>1943</pre></a></td><td class='covered-line'><pre>45.6k</pre></td><td class='code'><pre>Instruction *InstCombiner::optimizeBitCastFromPhi(CastInst &CI, PHINode *PN) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1944' href='#L_CASTS_1944'><pre>1944</pre></a></td><td class='covered-line'><pre>45.6k</pre></td><td class='code'><pre> // BitCast used by Store can be handled in InstCombineLoadStoreAlloca.cpp.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1945' href='#L_CASTS_1945'><pre>1945</pre></a></td><td class='covered-line'><pre>45.6k</pre></td><td class='code'><pre> if (hasStoreUsersOnly(CI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1946' href='#L_CASTS_1946'><pre>1946</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1947' href='#L_CASTS_1947'><pre>1947</pre></a></td><td class='covered-line'><pre>45.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1948' href='#L_CASTS_1948'><pre>1948</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1949' href='#L_CASTS_1949'><pre>1949</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> Type *SrcTy = Src->getType(); // Type B</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1950' href='#L_CASTS_1950'><pre>1950</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> Type *DestTy = CI.getType(); // Type A</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1951' href='#L_CASTS_1951'><pre>1951</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1952' href='#L_CASTS_1952'><pre>1952</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> SmallVector<PHINode *, 4> PhiWorklist;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1953' href='#L_CASTS_1953'><pre>1953</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> SmallSetVector<PHINode *, 4> OldPhiNodes;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1954' href='#L_CASTS_1954'><pre>1954</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1955' href='#L_CASTS_1955'><pre>1955</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> // Find all of the A->B casts and PHI nodes.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1956' href='#L_CASTS_1956'><pre>1956</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> // We need to inpect all related PHI nodes, but PHIs can be cyclic, so</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1957' href='#L_CASTS_1957'><pre>1957</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> // OldPhiNodes is used to track all known PHI nodes, before adding a new</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1958' href='#L_CASTS_1958'><pre>1958</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> // PHI to PhiWorklist, it is checked against and added to OldPhiNodes first.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1959' href='#L_CASTS_1959'><pre>1959</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> PhiWorklist.push_back(PN);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1960' href='#L_CASTS_1960'><pre>1960</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> OldPhiNodes.insert(PN);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1961' href='#L_CASTS_1961'><pre>1961</pre></a></td><td class='covered-line'><pre>34.8k</pre></td><td class='code'><pre> while (<div class='tooltip'>!PhiWorklist.empty()<span class='tooltip-content'>34.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1962' href='#L_CASTS_1962'><pre>1962</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> auto *OldPN = PhiWorklist.pop_back_val();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1963' href='#L_CASTS_1963'><pre>1963</pre></a></td><td class='covered-line'><pre>50.4k</pre></td><td class='code'><pre> for (Value *IncValue : OldPN->incoming_values()) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1964' href='#L_CASTS_1964'><pre>1964</pre></a></td><td class='covered-line'><pre>50.4k</pre></td><td class='code'><pre> if (isa<Constant>(IncValue))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1965' href='#L_CASTS_1965'><pre>1965</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1966' href='#L_CASTS_1966'><pre>1966</pre></a></td><td class='covered-line'><pre>50.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1967' href='#L_CASTS_1967'><pre>1967</pre></a></td><td class='covered-line'><pre>47.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>47.9k</span></div><div class='tooltip'>LI<span class='tooltip-content'>47.9k</span></div> = dyn_cast<LoadInst>(IncValue)) <div class='tooltip'>{<span class='tooltip-content'>9.66k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1968' href='#L_CASTS_1968'><pre>1968</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> // If there is a sequence of one or more load instructions, each loaded</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1969' href='#L_CASTS_1969'><pre>1969</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> // value is used as address of later load instruction, bitcast is</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1970' href='#L_CASTS_1970'><pre>1970</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> // necessary to change the value type, don't optimize it. For</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1971' href='#L_CASTS_1971'><pre>1971</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> // simplicity we give up if the load address comes from another load.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1972' href='#L_CASTS_1972'><pre>1972</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> Value *Addr = LI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1973' href='#L_CASTS_1973'><pre>1973</pre></a></td><td class='covered-line'><pre>9.66k</pre></td><td class='code'><pre> if (<div class='tooltip'>Addr == &CI || <span class='tooltip-content'>9.66k</span></div><div class='tooltip'>isa<LoadInst>(Addr)<span class='tooltip-content'>9.44k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1974' href='#L_CASTS_1974'><pre>1974</pre></a></td><td class='covered-line'><pre>221</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1975' href='#L_CASTS_1975'><pre>1975</pre></a></td><td class='covered-line'><pre>9.44k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>9.44k</span></div><div class='tooltip'>LI->hasOneUse() && <span class='tooltip-content'>9.44k</span></div><div class='tooltip'>LI->isSimple()<span class='tooltip-content'>1.97k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1976' href='#L_CASTS_1976'><pre>1976</pre></a></td><td class='covered-line'><pre>1.97k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1977' href='#L_CASTS_1977'><pre>1977</pre></a></td><td class='covered-line'><pre>9.44k</pre></td><td class='code'><pre> // If a LoadInst has more than one use, changing the type of loaded</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1978' href='#L_CASTS_1978'><pre>1978</pre></a></td><td class='covered-line'><pre>9.44k</pre></td><td class='code'><pre> // value may create another bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1979' href='#L_CASTS_1979'><pre>1979</pre></a></td><td class='covered-line'><pre>7.46k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1980' href='#L_CASTS_1980'><pre>1980</pre></a></td><td class='covered-line'><pre>9.44k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1981' href='#L_CASTS_1981'><pre>1981</pre></a></td><td class='covered-line'><pre>47.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1982' href='#L_CASTS_1982'><pre>1982</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>38.2k</span></div><div class='tooltip'>PNode<span class='tooltip-content'>38.2k</span></div> = dyn_cast<PHINode>(IncValue)) <div class='tooltip'>{<span class='tooltip-content'>14.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1983' href='#L_CASTS_1983'><pre>1983</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> if (OldPhiNodes.insert(PNode))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1984' href='#L_CASTS_1984'><pre>1984</pre></a></td><td class='covered-line'><pre>6.78k</pre></td><td class='code'><pre> PhiWorklist.push_back(PNode);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1985' href='#L_CASTS_1985'><pre>1985</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1986' href='#L_CASTS_1986'><pre>1986</pre></a></td><td class='covered-line'><pre>14.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1987' href='#L_CASTS_1987'><pre>1987</pre></a></td><td class='covered-line'><pre>38.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1988' href='#L_CASTS_1988'><pre>1988</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> auto *BCI = dyn_cast<BitCastInst>(IncValue);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1989' href='#L_CASTS_1989'><pre>1989</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> // We can't handle other instructions.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1990' href='#L_CASTS_1990'><pre>1990</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> if (!BCI)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1991' href='#L_CASTS_1991'><pre>1991</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1992' href='#L_CASTS_1992'><pre>1992</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1993' href='#L_CASTS_1993'><pre>1993</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> // Verify it's a A->B cast.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1994' href='#L_CASTS_1994'><pre>1994</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> Type *TyA = BCI->getOperand(0)->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1995' href='#L_CASTS_1995'><pre>1995</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> Type *TyB = BCI->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1996' href='#L_CASTS_1996'><pre>1996</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> if (<div class='tooltip'>TyA != DestTy || <span class='tooltip-content'>2.74k</span></div><div class='tooltip'>TyB != SrcTy<span class='tooltip-content'>1.26k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1997' href='#L_CASTS_1997'><pre>1997</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1998' href='#L_CASTS_1998'><pre>1998</pre></a></td><td class='covered-line'><pre>2.74k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_1999' href='#L_CASTS_1999'><pre>1999</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2000' href='#L_CASTS_2000'><pre>2000</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2001' href='#L_CASTS_2001'><pre>2001</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre> // For each old PHI node, create a corresponding new PHI node with a type A.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2002' href='#L_CASTS_2002'><pre>2002</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre> SmallDenseMap<PHINode *, PHINode *> NewPNodes;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2003' href='#L_CASTS_2003'><pre>2003</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> for (auto *OldPN : OldPhiNodes) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2004' href='#L_CASTS_2004'><pre>2004</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> Builder->SetInsertPoint(OldPN);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2005' href='#L_CASTS_2005'><pre>2005</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> PHINode *NewPN = Builder->CreatePHI(DestTy, OldPN->getNumOperands());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2006' href='#L_CASTS_2006'><pre>2006</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> NewPNodes[OldPN] = NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2007' href='#L_CASTS_2007'><pre>2007</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2008' href='#L_CASTS_2008'><pre>2008</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2009' href='#L_CASTS_2009'><pre>2009</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre> // Fill in the operands of new PHI nodes.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2010' href='#L_CASTS_2010'><pre>2010</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> for (auto *OldPN : OldPhiNodes) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2011' href='#L_CASTS_2011'><pre>2011</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> PHINode *NewPN = NewPNodes[OldPN];</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2012' href='#L_CASTS_2012'><pre>2012</pre></a></td><td class='covered-line'><pre>4.05k</pre></td><td class='code'><pre> for (unsigned j = 0, e = OldPN->getNumOperands(); <div class='tooltip'>j != e<span class='tooltip-content'>4.05k</span></div>; <div class='tooltip'>++j<span class='tooltip-content'>3.01k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.01k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2013' href='#L_CASTS_2013'><pre>2013</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> Value *V = OldPN->getOperand(j);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2014' href='#L_CASTS_2014'><pre>2014</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> Value *NewV = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2015' href='#L_CASTS_2015'><pre>2015</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>C<span class='tooltip-content'>3.01k</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'>{<span class='tooltip-content'>556</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2016' href='#L_CASTS_2016'><pre>2016</pre></a></td><td class='covered-line'><pre>556</pre></td><td class='code'><pre> NewV = ConstantExpr::getBitCast(C, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2017' href='#L_CASTS_2017'><pre>2017</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (auto *<span class='tooltip-content'>2.45k</span></div><div class='tooltip'>LI<span class='tooltip-content'>2.45k</span></div> = dyn_cast<LoadInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>336</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2018' href='#L_CASTS_2018'><pre>2018</pre></a></td><td class='covered-line'><pre>336</pre></td><td class='code'><pre> Builder->SetInsertPoint(LI->getNextNode());</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2019' href='#L_CASTS_2019'><pre>2019</pre></a></td><td class='covered-line'><pre>336</pre></td><td class='code'><pre> NewV = Builder->CreateBitCast(LI, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2020' href='#L_CASTS_2020'><pre>2020</pre></a></td><td class='covered-line'><pre>336</pre></td><td class='code'><pre> Worklist.Add(LI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2021' href='#L_CASTS_2021'><pre>2021</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (auto *<span class='tooltip-content'>2.12k</span></div><div class='tooltip'>BCI<span class='tooltip-content'>2.12k</span></div> = dyn_cast<BitCastInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>856</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2022' href='#L_CASTS_2022'><pre>2022</pre></a></td><td class='covered-line'><pre>856</pre></td><td class='code'><pre> NewV = BCI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2023' href='#L_CASTS_2023'><pre>2023</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (auto *<span class='tooltip-content'>1.26k</span></div><div class='tooltip'>PrevPN<span class='tooltip-content'>1.26k</span></div> = dyn_cast<PHINode>(V)) <div class='tooltip'>{<span class='tooltip-content'>1.26k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2024' href='#L_CASTS_2024'><pre>2024</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> NewV = NewPNodes[PrevPN];</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2025' href='#L_CASTS_2025'><pre>2025</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2026' href='#L_CASTS_2026'><pre>2026</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> assert(NewV);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2027' href='#L_CASTS_2027'><pre>2027</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> NewPN->addIncoming(NewV, OldPN->getIncomingBlock(j));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2028' href='#L_CASTS_2028'><pre>2028</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2029' href='#L_CASTS_2029'><pre>2029</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2030' href='#L_CASTS_2030'><pre>2030</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2031' href='#L_CASTS_2031'><pre>2031</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre> // If there is a store with type B, change it to type A.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2032' href='#L_CASTS_2032'><pre>2032</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> for (User *U : PN->users()) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2033' href='#L_CASTS_2033'><pre>2033</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> auto *SI = dyn_cast<StoreInst>(U);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2034' href='#L_CASTS_2034'><pre>2034</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> if (<div class='tooltip'>SI && <span class='tooltip-content'>2.52k</span></div><div class='tooltip'>SI->isSimple()<span class='tooltip-content'>216</span></div> && <div class='tooltip'>SI->getOperand(0) == PN<span class='tooltip-content'>216</span></div>) <div class='tooltip'>{<span class='tooltip-content'>216</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2035' href='#L_CASTS_2035'><pre>2035</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> Builder->SetInsertPoint(SI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2036' href='#L_CASTS_2036'><pre>2036</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> auto *NewBC =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2037' href='#L_CASTS_2037'><pre>2037</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> cast<BitCastInst>(Builder->CreateBitCast(NewPNodes[PN], SrcTy));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2038' href='#L_CASTS_2038'><pre>2038</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> SI->setOperand(0, NewBC);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2039' href='#L_CASTS_2039'><pre>2039</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> Worklist.Add(SI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2040' href='#L_CASTS_2040'><pre>2040</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> assert(hasStoreUsersOnly(*NewBC));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2041' href='#L_CASTS_2041'><pre>2041</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2042' href='#L_CASTS_2042'><pre>2042</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2043' href='#L_CASTS_2043'><pre>2043</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2044' href='#L_CASTS_2044'><pre>2044</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, NewPNodes[PN]);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2045' href='#L_CASTS_2045'><pre>2045</pre></a></td><td class='covered-line'><pre>30.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2046' href='#L_CASTS_2046'><pre>2046</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2047' href='#L_CASTS_2047'><pre>2047</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2048' href='#L_CASTS_2048'><pre>2048</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // If the operands are integer typed then apply the integer transforms,</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2049' href='#L_CASTS_2049'><pre>2049</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // otherwise just apply the common ones.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2050' href='#L_CASTS_2050'><pre>2050</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> Value *Src = CI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2051' href='#L_CASTS_2051'><pre>2051</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> Type *SrcTy = Src->getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2052' href='#L_CASTS_2052'><pre>2052</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> Type *DestTy = CI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2053' href='#L_CASTS_2053'><pre>2053</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2054' href='#L_CASTS_2054'><pre>2054</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // Get rid of casts from one type to the same type. These are useless and can</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2055' href='#L_CASTS_2055'><pre>2055</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // be replaced by the operand.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2056' href='#L_CASTS_2056'><pre>2056</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> if (DestTy == Src->getType())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2057' href='#L_CASTS_2057'><pre>2057</pre></a></td><td class='covered-line'><pre>5.82k</pre></td><td class='code'><pre> return replaceInstUsesWith(CI, Src);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2058' href='#L_CASTS_2058'><pre>2058</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2059' href='#L_CASTS_2059'><pre>2059</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> <div class='tooltip'>if (PointerType *<span class='tooltip-content'>1.36M</span></div><div class='tooltip'>DstPTy<span class='tooltip-content'>1.36M</span></div> = dyn_cast<PointerType>(DestTy)) <div class='tooltip'>{<span class='tooltip-content'>1.35M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2060' href='#L_CASTS_2060'><pre>2060</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> PointerType *SrcPTy = cast<PointerType>(SrcTy);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2061' href='#L_CASTS_2061'><pre>2061</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Type *DstElTy = DstPTy->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2062' href='#L_CASTS_2062'><pre>2062</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Type *SrcElTy = SrcPTy->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2063' href='#L_CASTS_2063'><pre>2063</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2064' href='#L_CASTS_2064'><pre>2064</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // If we are casting a alloca to a pointer to a type of the same</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2065' href='#L_CASTS_2065'><pre>2065</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // size, rewrite the allocation instruction to allocate the "right" type.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2066' href='#L_CASTS_2066'><pre>2066</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // There is no need to modify malloc calls because it is their bitcast that</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2067' href='#L_CASTS_2067'><pre>2067</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // needs to be cleaned up.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2068' href='#L_CASTS_2068'><pre>2068</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (AllocaInst *AI = dyn_cast<AllocaInst>(Src))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2069' href='#L_CASTS_2069'><pre>2069</pre></a></td><td class='covered-line'><pre>179k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>179k</span></div><div class='tooltip'>V<span class='tooltip-content'>179k</span></div> = PromoteCastOfAllocation(CI, *AI))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2070' href='#L_CASTS_2070'><pre>2070</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2071' href='#L_CASTS_2071'><pre>2071</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2072' href='#L_CASTS_2072'><pre>2072</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // When the type pointed to is not sized the cast cannot be</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2073' href='#L_CASTS_2073'><pre>2073</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // turned into a gep.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2074' href='#L_CASTS_2074'><pre>2074</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Type *PointeeType =</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2075' href='#L_CASTS_2075'><pre>2075</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> cast<PointerType>(Src->getType()->getScalarType())->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2076' href='#L_CASTS_2076'><pre>2076</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (!PointeeType->isSized())</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2077' href='#L_CASTS_2077'><pre>2077</pre></a></td><td class='covered-line'><pre>2.75k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2078' href='#L_CASTS_2078'><pre>2078</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2079' href='#L_CASTS_2079'><pre>2079</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // If the source and destination are pointers, and this cast is equivalent</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2080' href='#L_CASTS_2080'><pre>2080</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // to a getelementptr X, 0, 0, 0... turn it into the appropriate gep.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2081' href='#L_CASTS_2081'><pre>2081</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // This can enhance SROA and other transforms that want type-safe pointers.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2082' href='#L_CASTS_2082'><pre>2082</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre> unsigned NumZeros = 0;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2083' href='#L_CASTS_2083'><pre>2083</pre></a></td><td class='covered-line'><pre>2.86M</pre></td><td class='code'><pre> while (SrcElTy != DstElTy &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2084' href='#L_CASTS_2084'><pre>2084</pre></a></td><td class='covered-line'><pre>2.83M</pre></td><td class='code'><pre> <div class='tooltip'>isa<CompositeType>(SrcElTy)<span class='tooltip-content'>2.83M</span></div> && <div class='tooltip'>!SrcElTy->isPointerTy()<span class='tooltip-content'>1.51M</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2085' href='#L_CASTS_2085'><pre>2085</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>SrcElTy->getNumContainedTypes()<span class='tooltip-content'>1.51M</span></div> /* not "{}" */) <div class='tooltip'>{<span class='tooltip-content'>1.51M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2086' href='#L_CASTS_2086'><pre>2086</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> SrcElTy = cast<CompositeType>(SrcElTy)->getTypeAtIndex(0U);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2087' href='#L_CASTS_2087'><pre>2087</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> ++NumZeros;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2088' href='#L_CASTS_2088'><pre>2088</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2089' href='#L_CASTS_2089'><pre>2089</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2090' href='#L_CASTS_2090'><pre>2090</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre> // If we found a path from the src to dest, create the getelementptr now.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2091' href='#L_CASTS_2091'><pre>2091</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre> if (<div class='tooltip'>SrcElTy == DstElTy<span class='tooltip-content'>1.34M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>30.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2092' href='#L_CASTS_2092'><pre>2092</pre></a></td><td class='covered-line'><pre>30.5k</pre></td><td class='code'><pre> SmallVector<Value *, 8> Idxs(NumZeros + 1, Builder->getInt32(0));</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2093' href='#L_CASTS_2093'><pre>2093</pre></a></td><td class='covered-line'><pre>30.5k</pre></td><td class='code'><pre> return GetElementPtrInst::CreateInBounds(Src, Idxs);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2094' href='#L_CASTS_2094'><pre>2094</pre></a></td><td class='covered-line'><pre>30.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2095' href='#L_CASTS_2095'><pre>2095</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2096' href='#L_CASTS_2096'><pre>2096</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2097' href='#L_CASTS_2097'><pre>2097</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (VectorType *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>DestVTy<span class='tooltip-content'>1.32M</span></div> = dyn_cast<VectorType>(DestTy)) <div class='tooltip'>{<span class='tooltip-content'>352</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2098' href='#L_CASTS_2098'><pre>2098</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> if (<div class='tooltip'>DestVTy->getNumElements() == 1 && <span class='tooltip-content'>352</span></div><div class='tooltip'><span class='red'>!SrcTy->isVectorTy()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2099' href='#L_CASTS_2099'><pre>2099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Elem = Builder->CreateBitCast(Src, DestVTy->getElementType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2100' href='#L_CASTS_2100'><pre>2100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertElementInst::Create(UndefValue::get(DestTy), Elem,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2101' href='#L_CASTS_2101'><pre>2101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(Type::getInt32Ty(CI.getContext())));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2102' href='#L_CASTS_2102'><pre>2102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME: Canonicalize bitcast(insertelement) -> insertelement(bitcast)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2103' href='#L_CASTS_2103'><pre>2103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2104' href='#L_CASTS_2104'><pre>2104</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2105' href='#L_CASTS_2105'><pre>2105</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>352</span></div><div class='tooltip'>isa<IntegerType>(SrcTy)<span class='tooltip-content'>352</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2106' href='#L_CASTS_2106'><pre>2106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If this is a cast from an integer to vector, check to see if the input</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2107' href='#L_CASTS_2107'><pre>2107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is a trunc or zext of a bitcast from vector. If so, we can replace all</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2108' href='#L_CASTS_2108'><pre>2108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the casts with a shuffle and (potentially) a bitcast.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2109' href='#L_CASTS_2109'><pre>2109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<TruncInst>(Src) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ZExtInst>(Src)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2110' href='#L_CASTS_2110'><pre>2110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CastInst *SrcCast = cast<CastInst>(Src);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2111' href='#L_CASTS_2111'><pre>2111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (BitCastInst *</span><span class='red'>BCIn</span><span class='red'> = dyn_cast<BitCastInst>(SrcCast->getOperand(0)))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2112' href='#L_CASTS_2112'><pre>2112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<VectorType>(BCIn->getOperand(0)->getType())</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2113' href='#L_CASTS_2113'><pre>2113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Instruction *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I</span><span class='tooltip-content'>0</span></div><span class='red'> = optimizeVectorResize(BCIn->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2114' href='#L_CASTS_2114'><pre>2114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<VectorType>(DestTy), *this))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2115' href='#L_CASTS_2115'><pre>2115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return I</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2116' href='#L_CASTS_2116'><pre>2116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2117' href='#L_CASTS_2117'><pre>2117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2118' href='#L_CASTS_2118'><pre>2118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the input is an 'or' instruction, we may be doing shifts and ors to</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2119' href='#L_CASTS_2119'><pre>2119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // assemble the elements of the vector manually. Try to rip the code out</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2120' href='#L_CASTS_2120'><pre>2120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // and replace it with insertelements.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2121' href='#L_CASTS_2121'><pre>2121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = optimizeIntegerToVectorInsertions(CI, *this))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2122' href='#L_CASTS_2122'><pre>2122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(CI, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2123' href='#L_CASTS_2123'><pre>2123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2124' href='#L_CASTS_2124'><pre>2124</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2125' href='#L_CASTS_2125'><pre>2125</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2126' href='#L_CASTS_2126'><pre>2126</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (VectorType *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>SrcVTy<span class='tooltip-content'>1.32M</span></div> = dyn_cast<VectorType>(SrcTy)) <div class='tooltip'>{<span class='tooltip-content'>1.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2127' href='#L_CASTS_2127'><pre>2127</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if (<div class='tooltip'>SrcVTy->getNumElements() == 1<span class='tooltip-content'>1.12k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2128' href='#L_CASTS_2128'><pre>2128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If our destination is not a vector, then make this a straight</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2129' href='#L_CASTS_2129'><pre>2129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // scalar-scalar cast.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2130' href='#L_CASTS_2130'><pre>2130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DestTy->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2131' href='#L_CASTS_2131'><pre>2131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Elem =</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2132' href='#L_CASTS_2132'><pre>2132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateExtractElement(Src,</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2133' href='#L_CASTS_2133'><pre>2133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(Type::getInt32Ty(CI.getContext())));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2134' href='#L_CASTS_2134'><pre>2134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::Create(Instruction::BitCast, Elem, DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2135' href='#L_CASTS_2135'><pre>2135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2136' href='#L_CASTS_2136'><pre>2136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2137' href='#L_CASTS_2137'><pre>2137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, see if our source is an insert. If so, then use the scalar</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2138' href='#L_CASTS_2138'><pre>2138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // component directly.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2139' href='#L_CASTS_2139'><pre>2139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (InsertElementInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IEI</span><span class='tooltip-content'>0</span></div><span class='red'> =</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2140' href='#L_CASTS_2140'><pre>2140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> dyn_cast<InsertElementInst>(CI.getOperand(0)))</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2141' href='#L_CASTS_2141'><pre>2141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return CastInst::Create(Instruction::BitCast, IEI->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2142' href='#L_CASTS_2142'><pre>2142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DestTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2143' href='#L_CASTS_2143'><pre>2143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2144' href='#L_CASTS_2144'><pre>2144</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2145' href='#L_CASTS_2145'><pre>2145</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2146' href='#L_CASTS_2146'><pre>2146</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (ShuffleVectorInst *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>SVI<span class='tooltip-content'>1.32M</span></div> = dyn_cast<ShuffleVectorInst>(Src)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2147' href='#L_CASTS_2147'><pre>2147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Okay, we have (bitcast (shuffle ..)). Check to see if this is</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2148' href='#L_CASTS_2148'><pre>2148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // a bitcast to a vector with the same # elts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2149' href='#L_CASTS_2149'><pre>2149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SVI->hasOneUse() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DestTy->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2150' href='#L_CASTS_2150'><pre>2150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DestTy->getVectorNumElements() == SVI->getType()->getNumElements()</span><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2151' href='#L_CASTS_2151'><pre>2151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SVI->getType()->getNumElements() ==</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2152' href='#L_CASTS_2152'><pre>2152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SVI->getOperand(0)->getType()->getVectorNumElements()</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2153' href='#L_CASTS_2153'><pre>2153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BitCastInst *Tmp;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2154' href='#L_CASTS_2154'><pre>2154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If either of the operands is a cast from CI.getType(), then</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2155' href='#L_CASTS_2155'><pre>2155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // evaluating the shuffle in the casted destination's type will allow</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2156' href='#L_CASTS_2156'><pre>2156</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // us to eliminate at least one cast.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2157' href='#L_CASTS_2157'><pre>2157</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>((Tmp = dyn_cast<BitCastInst>(SVI->getOperand(0))) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2158' href='#L_CASTS_2158'><pre>2158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Tmp->getOperand(0)->getType() == DestTy</span><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2159' href='#L_CASTS_2159'><pre>2159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>((Tmp = dyn_cast<BitCastInst>(SVI->getOperand(1))) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2160' href='#L_CASTS_2160'><pre>2160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>Tmp->getOperand(0)->getType() == DestTy</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2161' href='#L_CASTS_2161'><pre>2161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LHS = Builder->CreateBitCast(SVI->getOperand(0), DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2162' href='#L_CASTS_2162'><pre>2162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RHS = Builder->CreateBitCast(SVI->getOperand(1), DestTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2163' href='#L_CASTS_2163'><pre>2163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Return a new shuffle vector. Use the same element ID's, as we</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2164' href='#L_CASTS_2164'><pre>2164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // know the vector types match #elts.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2165' href='#L_CASTS_2165'><pre>2165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ShuffleVectorInst(LHS, RHS, SVI->getOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2166' href='#L_CASTS_2166'><pre>2166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2167' href='#L_CASTS_2167'><pre>2167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2168' href='#L_CASTS_2168'><pre>2168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2169' href='#L_CASTS_2169'><pre>2169</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2170' href='#L_CASTS_2170'><pre>2170</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // Handle the A->B->A cast, and there is an intervening PHI node.</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2171' href='#L_CASTS_2171'><pre>2171</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (PHINode *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>PN<span class='tooltip-content'>1.32M</span></div> = dyn_cast<PHINode>(Src))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2172' href='#L_CASTS_2172'><pre>2172</pre></a></td><td class='covered-line'><pre>45.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>45.6k</span></div><div class='tooltip'>I<span class='tooltip-content'>45.6k</span></div> = optimizeBitCastFromPhi(CI, PN))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2173' href='#L_CASTS_2173'><pre>2173</pre></a></td><td class='covered-line'><pre>620</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2174' href='#L_CASTS_2174'><pre>2174</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2175' href='#L_CASTS_2175'><pre>2175</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>I<span class='tooltip-content'>1.32M</span></div> = canonicalizeBitCastExtElt(CI, *this, DL))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2176' href='#L_CASTS_2176'><pre>2176</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2177' href='#L_CASTS_2177'><pre>2177</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2178' href='#L_CASTS_2178'><pre>2178</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>I<span class='tooltip-content'>1.32M</span></div> = foldBitCastBitwiseLogic(CI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2179' href='#L_CASTS_2179'><pre>2179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2180' href='#L_CASTS_2180'><pre>2180</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2181' href='#L_CASTS_2181'><pre>2181</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>I<span class='tooltip-content'>1.32M</span></div> = foldBitCastSelect(CI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2182' href='#L_CASTS_2182'><pre>2182</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2183' href='#L_CASTS_2183'><pre>2183</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2184' href='#L_CASTS_2184'><pre>2184</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>SrcTy->isPointerTy()<span class='tooltip-content'>1.32M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2185' href='#L_CASTS_2185'><pre>2185</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> return commonPointerCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2186' href='#L_CASTS_2186'><pre>2186</pre></a></td><td class='covered-line'><pre>7.84k</pre></td><td class='code'><pre> return commonCastTransforms(CI);</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2187' href='#L_CASTS_2187'><pre>2187</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2188' href='#L_CASTS_2188'><pre>2188</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2189' href='#L_CASTS_2189'><pre>2189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Instruction *InstCombiner::visitAddrSpaceCast(AddrSpaceCastInst &CI) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2190' href='#L_CASTS_2190'><pre>2190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the destination pointer element type is not the same as the source's</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2191' href='#L_CASTS_2191'><pre>2191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // first do a bitcast to the destination type, and then the addrspacecast.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2192' href='#L_CASTS_2192'><pre>2192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This allows the cast to be exposed to other transforms.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2193' href='#L_CASTS_2193'><pre>2193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Src = CI.getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2194' href='#L_CASTS_2194'><pre>2194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *SrcTy = cast<PointerType>(Src->getType()->getScalarType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2195' href='#L_CASTS_2195'><pre>2195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerType *DestTy = cast<PointerType>(CI.getType()->getScalarType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2196' href='#L_CASTS_2196'><pre>2196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2197' href='#L_CASTS_2197'><pre>2197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *DestElemTy = DestTy->getElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2198' href='#L_CASTS_2198'><pre>2198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SrcTy->getElementType() != DestElemTy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2199' href='#L_CASTS_2199'><pre>2199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *MidTy = PointerType::get(DestElemTy, SrcTy->getAddressSpace());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2200' href='#L_CASTS_2200'><pre>2200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (VectorType *</span><div class='tooltip'><span class='red'>VT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<VectorType>(CI.getType())) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2201' href='#L_CASTS_2201'><pre>2201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle vectors of pointers.</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2202' href='#L_CASTS_2202'><pre>2202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MidTy = VectorType::get(MidTy, VT->getNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2203' href='#L_CASTS_2203'><pre>2203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2204' href='#L_CASTS_2204'><pre>2204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2205' href='#L_CASTS_2205'><pre>2205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewBitCast = Builder->CreateBitCast(Src, MidTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2206' href='#L_CASTS_2206'><pre>2206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new AddrSpaceCastInst(NewBitCast, CI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2207' href='#L_CASTS_2207'><pre>2207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2208' href='#L_CASTS_2208'><pre>2208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2209' href='#L_CASTS_2209'><pre>2209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return commonPointerCastTransforms(CI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_CASTS_2210' href='#L_CASTS_2210'><pre>2210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='COMPARES' href='#COMPARES'>lib/Transforms/InstCombine/InstCombineCompares.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_COMPARES_39'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1' href='#L_COMPARES_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineCompares.cpp --------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2' href='#L_COMPARES_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3' href='#L_COMPARES_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4' href='#L_COMPARES_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_5' href='#L_COMPARES_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_6' href='#L_COMPARES_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_7' href='#L_COMPARES_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_8' href='#L_COMPARES_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_9' href='#L_COMPARES_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_10' href='#L_COMPARES_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitICmp and visitFCmp functions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_11' href='#L_COMPARES_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_12' href='#L_COMPARES_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_13' href='#L_COMPARES_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_14' href='#L_COMPARES_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_15' href='#L_COMPARES_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/APSInt.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_16' href='#L_COMPARES_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/SetVector.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_17' href='#L_COMPARES_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/Statistic.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_18' href='#L_COMPARES_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ConstantFolding.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_19' href='#L_COMPARES_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_20' href='#L_COMPARES_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/MemoryBuiltins.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_21' href='#L_COMPARES_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/TargetLibraryInfo.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_22' href='#L_COMPARES_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/VectorUtils.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_23' href='#L_COMPARES_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/ConstantRange.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_24' href='#L_COMPARES_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DataLayout.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_25' href='#L_COMPARES_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/GetElementPtrTypeIterator.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_26' href='#L_COMPARES_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_27' href='#L_COMPARES_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_28' href='#L_COMPARES_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Support/Debug.h"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_29' href='#L_COMPARES_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_30' href='#L_COMPARES_30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_31' href='#L_COMPARES_31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_32' href='#L_COMPARES_32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_33' href='#L_COMPARES_33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_34' href='#L_COMPARES_34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_35' href='#L_COMPARES_35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// How many times is a select replaced by one of its operands?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_36' href='#L_COMPARES_36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>STATISTIC(NumSel, "Number of select opts");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_37' href='#L_COMPARES_37'><pre>37</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_38' href='#L_COMPARES_38'><pre>38</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_39' href='#L_COMPARES_39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static ConstantInt *extractElement(Constant *V, Constant *Idx) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_40' href='#L_COMPARES_40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return cast<ConstantInt>(ConstantExpr::getExtractElement(V, Idx));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_41' href='#L_COMPARES_41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_42' href='#L_COMPARES_42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_43' href='#L_COMPARES_43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool hasAddOverflow(ConstantInt *Result,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_44' href='#L_COMPARES_44'><pre>44</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *In1, ConstantInt *In2,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_45' href='#L_COMPARES_45'><pre>45</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> bool IsSigned) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_46' href='#L_COMPARES_46'><pre>46</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> if (!IsSigned)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_47' href='#L_COMPARES_47'><pre>47</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> return Result->getValue().ult(In1->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_48' href='#L_COMPARES_48'><pre>48</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_49' href='#L_COMPARES_49'><pre>49</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28</span></div><div class='tooltip'>In2->isNegative()<span class='tooltip-content'>28</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_50' href='#L_COMPARES_50'><pre>50</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return Result->getValue().sgt(In1->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_51' href='#L_COMPARES_51'><pre>51</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return Result->getValue().slt(In1->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_52' href='#L_COMPARES_52'><pre>52</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_53' href='#L_COMPARES_53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_54' href='#L_COMPARES_54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Compute Result = In1+In2, returning true if the result overflowed for this</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_55' href='#L_COMPARES_55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_56' href='#L_COMPARES_56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool addWithOverflow(Constant *&Result, Constant *In1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_57' href='#L_COMPARES_57'><pre>57</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> Constant *In2, bool IsSigned = false) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_58' href='#L_COMPARES_58'><pre>58</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> Result = ConstantExpr::getAdd(In1, In2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_59' href='#L_COMPARES_59'><pre>59</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_60' href='#L_COMPARES_60'><pre>60</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> if (VectorType *<div class='tooltip'>VTy<span class='tooltip-content'>66</span></div> = dyn_cast<VectorType>(In1->getType())) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_61' href='#L_COMPARES_61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = VTy->getNumElements(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_62' href='#L_COMPARES_62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Idx = ConstantInt::get(Type::getInt32Ty(In1->getContext()), i);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_63' href='#L_COMPARES_63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>hasAddOverflow(extractElement(Result, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_64' href='#L_COMPARES_64'><pre>64</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> extractElement(In1, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_65' href='#L_COMPARES_65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> extractElement(In2, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_66' href='#L_COMPARES_66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsSigned)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_67' href='#L_COMPARES_67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_68' href='#L_COMPARES_68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_69' href='#L_COMPARES_69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_70' href='#L_COMPARES_70'><pre>70</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_71' href='#L_COMPARES_71'><pre>71</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_72' href='#L_COMPARES_72'><pre>72</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> return hasAddOverflow(cast<ConstantInt>(Result),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_73' href='#L_COMPARES_73'><pre>73</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> cast<ConstantInt>(In1), cast<ConstantInt>(In2),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_74' href='#L_COMPARES_74'><pre>74</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> IsSigned);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_75' href='#L_COMPARES_75'><pre>75</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_76' href='#L_COMPARES_76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_77' href='#L_COMPARES_77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool hasSubOverflow(ConstantInt *Result,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_78' href='#L_COMPARES_78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *In1, ConstantInt *In2,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_79' href='#L_COMPARES_79'><pre>79</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool IsSigned) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_80' href='#L_COMPARES_80'><pre>80</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!IsSigned</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_81' href='#L_COMPARES_81'><pre>81</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Result->getValue().ugt(In1->getValue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_82' href='#L_COMPARES_82'><pre>82</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_83' href='#L_COMPARES_83'><pre>83</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>In2->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_84' href='#L_COMPARES_84'><pre>84</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Result->getValue().slt(In1->getValue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_85' href='#L_COMPARES_85'><pre>85</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_86' href='#L_COMPARES_86'><pre>86</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Result->getValue().sgt(In1->getValue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_87' href='#L_COMPARES_87'><pre>87</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_88' href='#L_COMPARES_88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_89' href='#L_COMPARES_89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Compute Result = In1-In2, returning true if the result overflowed for this</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_90' href='#L_COMPARES_90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_91' href='#L_COMPARES_91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool subWithOverflow(Constant *&Result, Constant *In1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_92' href='#L_COMPARES_92'><pre>92</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Constant *In2, bool IsSigned = false) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_93' href='#L_COMPARES_93'><pre>93</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Result = ConstantExpr::getSub(In1, In2);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_94' href='#L_COMPARES_94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_95' href='#L_COMPARES_95'><pre>95</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (VectorType *</span><div class='tooltip'><span class='red'>VTy</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<VectorType>(In1->getType())) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_96' href='#L_COMPARES_96'><pre>96</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = VTy->getNumElements(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_97' href='#L_COMPARES_97'><pre>97</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Idx = ConstantInt::get(Type::getInt32Ty(In1->getContext()), i);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_98' href='#L_COMPARES_98'><pre>98</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>hasSubOverflow(extractElement(Result, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_99' href='#L_COMPARES_99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> extractElement(In1, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_100' href='#L_COMPARES_100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> extractElement(In2, Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_101' href='#L_COMPARES_101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsSigned)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_102' href='#L_COMPARES_102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_103' href='#L_COMPARES_103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_104' href='#L_COMPARES_104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_105' href='#L_COMPARES_105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_106' href='#L_COMPARES_106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_107' href='#L_COMPARES_107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return hasSubOverflow(cast<ConstantInt>(Result),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_108' href='#L_COMPARES_108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<ConstantInt>(In1), cast<ConstantInt>(In2),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_109' href='#L_COMPARES_109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsSigned)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_110' href='#L_COMPARES_110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_111' href='#L_COMPARES_111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_112' href='#L_COMPARES_112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given an icmp instruction, return true if any use of this comparison is a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_113' href='#L_COMPARES_113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// branch on sign bit comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_114' href='#L_COMPARES_114'><pre>114</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre>static bool isBranchOnSignBitCheck(ICmpInst &I, bool isSignBit) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_115' href='#L_COMPARES_115'><pre>115</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> for (auto *U : I.users())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_116' href='#L_COMPARES_116'><pre>116</pre></a></td><td class='covered-line'><pre>16.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.5k</span></div><div class='tooltip'>isa<BranchInst>(U)<span class='tooltip-content'>16.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_117' href='#L_COMPARES_117'><pre>117</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> return isSignBit;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_118' href='#L_COMPARES_118'><pre>118</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_119' href='#L_COMPARES_119'><pre>119</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_120' href='#L_COMPARES_120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_121' href='#L_COMPARES_121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given an exploded icmp instruction, return true if the comparison only</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_122' href='#L_COMPARES_122'><pre>122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// checks the sign bit. If it only checks the sign bit, set TrueIfSigned if the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_123' href='#L_COMPARES_123'><pre>123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// result of the comparison is true when the input value is signed.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_124' href='#L_COMPARES_124'><pre>124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool isSignBitCheck(ICmpInst::Predicate Pred, const APInt &RHS,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_125' href='#L_COMPARES_125'><pre>125</pre></a></td><td class='covered-line'><pre>739k</pre></td><td class='code'><pre> bool &TrueIfSigned) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_126' href='#L_COMPARES_126'><pre>126</pre></a></td><td class='covered-line'><pre>739k</pre></td><td class='code'><pre> switch (Pred) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_127' href='#L_COMPARES_127'><pre>127</pre></a></td><td class='covered-line'><pre>52.1k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT: // True if LHS s< 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_128' href='#L_COMPARES_128'><pre>128</pre></a></td><td class='covered-line'><pre>52.1k</pre></td><td class='code'><pre> TrueIfSigned = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_129' href='#L_COMPARES_129'><pre>129</pre></a></td><td class='covered-line'><pre>52.1k</pre></td><td class='code'><pre> return RHS == 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_130' href='#L_COMPARES_130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_SLE: // True if LHS s<= RHS and RHS == -1</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_131' href='#L_COMPARES_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TrueIfSigned = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_132' href='#L_COMPARES_132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RHS.isAllOnesValue()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_133' href='#L_COMPARES_133'><pre>133</pre></a></td><td class='covered-line'><pre>96.2k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT: // True if LHS s> -1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_134' href='#L_COMPARES_134'><pre>134</pre></a></td><td class='covered-line'><pre>96.2k</pre></td><td class='code'><pre> TrueIfSigned = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_135' href='#L_COMPARES_135'><pre>135</pre></a></td><td class='covered-line'><pre>96.2k</pre></td><td class='code'><pre> return RHS.isAllOnesValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_136' href='#L_COMPARES_136'><pre>136</pre></a></td><td class='covered-line'><pre>20.4k</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_137' href='#L_COMPARES_137'><pre>137</pre></a></td><td class='covered-line'><pre>20.4k</pre></td><td class='code'><pre> // True if LHS u> RHS and RHS == high-bit-mask - 1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_138' href='#L_COMPARES_138'><pre>138</pre></a></td><td class='covered-line'><pre>20.4k</pre></td><td class='code'><pre> TrueIfSigned = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_139' href='#L_COMPARES_139'><pre>139</pre></a></td><td class='covered-line'><pre>20.4k</pre></td><td class='code'><pre> return RHS.isMaxSignedValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_140' href='#L_COMPARES_140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case ICmpInst::ICMP_UGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_141' href='#L_COMPARES_141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, 2^31, etc)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_142' href='#L_COMPARES_142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TrueIfSigned = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_143' href='#L_COMPARES_143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RHS.isSignBit()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_144' href='#L_COMPARES_144'><pre>144</pre></a></td><td class='covered-line'><pre>570k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_145' href='#L_COMPARES_145'><pre>145</pre></a></td><td class='covered-line'><pre>570k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_146' href='#L_COMPARES_146'><pre>146</pre></a></td><td class='covered-line'><pre>739k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_147' href='#L_COMPARES_147'><pre>147</pre></a></td><td class='covered-line'><pre>739k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_148' href='#L_COMPARES_148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_149' href='#L_COMPARES_149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Returns true if the exploded icmp can be expressed as a signed comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_150' href='#L_COMPARES_150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to zero and updates the predicate accordingly.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_151' href='#L_COMPARES_151'><pre>151</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The signedness of the comparison is preserved.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_152' href='#L_COMPARES_152'><pre>152</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// TODO: Refactor with decomposeBitTestICmp()?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_153' href='#L_COMPARES_153'><pre>153</pre></a></td><td class='covered-line'><pre>232</pre></td><td class='code'><pre>static bool isSignTest(ICmpInst::Predicate &Pred, const APInt &C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_154' href='#L_COMPARES_154'><pre>154</pre></a></td><td class='covered-line'><pre>232</pre></td><td class='code'><pre> if (!ICmpInst::isSigned(Pred))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_155' href='#L_COMPARES_155'><pre>155</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_156' href='#L_COMPARES_156'><pre>156</pre></a></td><td class='covered-line'><pre>232</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_157' href='#L_COMPARES_157'><pre>157</pre></a></td><td class='covered-line'><pre>205</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>205</span></div><div class='tooltip'>C == 0<span class='tooltip-content'>205</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_158' href='#L_COMPARES_158'><pre>158</pre></a></td><td class='covered-line'><pre>205</pre></td><td class='code'><pre> return ICmpInst::isRelational(Pred);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_159' href='#L_COMPARES_159'><pre>159</pre></a></td><td class='covered-line'><pre>205</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_160' href='#L_COMPARES_160'><pre>160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C == 1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_161' href='#L_COMPARES_161'><pre>161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_162' href='#L_COMPARES_162'><pre>162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::ICMP_SLE;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_163' href='#L_COMPARES_163'><pre>163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_164' href='#L_COMPARES_164'><pre>164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_165' href='#L_COMPARES_165'><pre>165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C.isAllOnesValue()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_166' href='#L_COMPARES_166'><pre>166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_167' href='#L_COMPARES_167'><pre>167</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::ICMP_SGE;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_168' href='#L_COMPARES_168'><pre>168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_169' href='#L_COMPARES_169'><pre>169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_170' href='#L_COMPARES_170'><pre>170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_171' href='#L_COMPARES_171'><pre>171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_172' href='#L_COMPARES_172'><pre>172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_173' href='#L_COMPARES_173'><pre>173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_174' href='#L_COMPARES_174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_175' href='#L_COMPARES_175'><pre>175</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given a signed integer type and a set of known zero and one bits, compute</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_176' href='#L_COMPARES_176'><pre>176</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the maximum and minimum values that could have the specified known zero and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_177' href='#L_COMPARES_177'><pre>177</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// known one bits, returning them in Min/Max.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_178' href='#L_COMPARES_178'><pre>178</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static void computeSignedMinMaxValuesFromKnownBits(const APInt &KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_179' href='#L_COMPARES_179'><pre>179</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APInt &KnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_180' href='#L_COMPARES_180'><pre>180</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> APInt &Min, APInt &Max) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_181' href='#L_COMPARES_181'><pre>181</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> assert(KnownZero.getBitWidth() == KnownOne.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_182' href='#L_COMPARES_182'><pre>182</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> KnownZero.getBitWidth() == Min.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_183' href='#L_COMPARES_183'><pre>183</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> KnownZero.getBitWidth() == Max.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_184' href='#L_COMPARES_184'><pre>184</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> "KnownZero, KnownOne and Min, Max must have equal bitwidth.");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_185' href='#L_COMPARES_185'><pre>185</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> APInt UnknownBits = ~(KnownZero|KnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_186' href='#L_COMPARES_186'><pre>186</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_187' href='#L_COMPARES_187'><pre>187</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> // The minimum value is when all unknown bits are zeros, EXCEPT for the sign</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_188' href='#L_COMPARES_188'><pre>188</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> // bit if it is unknown.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_189' href='#L_COMPARES_189'><pre>189</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> Min = KnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_190' href='#L_COMPARES_190'><pre>190</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> Max = KnownOne|UnknownBits;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_191' href='#L_COMPARES_191'><pre>191</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_192' href='#L_COMPARES_192'><pre>192</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> if (<div class='tooltip'>UnknownBits.isNegative()<span class='tooltip-content'>523k</span></div>) <div class='tooltip'>{ // Sign bit is unknown<span class='tooltip-content'>373k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_193' href='#L_COMPARES_193'><pre>193</pre></a></td><td class='covered-line'><pre>373k</pre></td><td class='code'><pre> Min.setBit(Min.getBitWidth()-1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_194' href='#L_COMPARES_194'><pre>194</pre></a></td><td class='covered-line'><pre>373k</pre></td><td class='code'><pre> Max.clearBit(Max.getBitWidth()-1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_195' href='#L_COMPARES_195'><pre>195</pre></a></td><td class='covered-line'><pre>373k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_196' href='#L_COMPARES_196'><pre>196</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_197' href='#L_COMPARES_197'><pre>197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_198' href='#L_COMPARES_198'><pre>198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Given an unsigned integer type and a set of known zero and one bits, compute</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_199' href='#L_COMPARES_199'><pre>199</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the maximum and minimum values that could have the specified known zero and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_200' href='#L_COMPARES_200'><pre>200</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// known one bits, returning them in Min/Max.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_201' href='#L_COMPARES_201'><pre>201</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static void computeUnsignedMinMaxValuesFromKnownBits(const APInt &KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_202' href='#L_COMPARES_202'><pre>202</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APInt &KnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_203' href='#L_COMPARES_203'><pre>203</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> APInt &Min, APInt &Max) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_204' href='#L_COMPARES_204'><pre>204</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> assert(KnownZero.getBitWidth() == KnownOne.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_205' href='#L_COMPARES_205'><pre>205</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> KnownZero.getBitWidth() == Min.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_206' href='#L_COMPARES_206'><pre>206</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> KnownZero.getBitWidth() == Max.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_207' href='#L_COMPARES_207'><pre>207</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> "Ty, KnownZero, KnownOne and Min, Max must have equal bitwidth.");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_208' href='#L_COMPARES_208'><pre>208</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> APInt UnknownBits = ~(KnownZero|KnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_209' href='#L_COMPARES_209'><pre>209</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_210' href='#L_COMPARES_210'><pre>210</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> // The minimum value is when the unknown bits are all zeros.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_211' href='#L_COMPARES_211'><pre>211</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> Min = KnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_212' href='#L_COMPARES_212'><pre>212</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> // The maximum value is when the unknown bits are all ones.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_213' href='#L_COMPARES_213'><pre>213</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre> Max = KnownOne|UnknownBits;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_214' href='#L_COMPARES_214'><pre>214</pre></a></td><td class='covered-line'><pre>2.18M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_215' href='#L_COMPARES_215'><pre>215</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_216' href='#L_COMPARES_216'><pre>216</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is called when we see this pattern:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_217' href='#L_COMPARES_217'><pre>217</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// cmp pred (load (gep GV, ...)), cmpcst</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_218' href='#L_COMPARES_218'><pre>218</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where GV is a global variable with a constant initializer. Try to simplify</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_219' href='#L_COMPARES_219'><pre>219</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// this into some simple computation that does not need the load. For example</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_220' href='#L_COMPARES_220'><pre>220</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// we can optimize "icmp eq (load (gep "foo", 0, i)), 0" into "icmp eq i, 3".</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_221' href='#L_COMPARES_221'><pre>221</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_222' href='#L_COMPARES_222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If AndCst is non-null, then the loaded value is masked with that constant</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_223' href='#L_COMPARES_223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// before doing the comparison. This handles cases like "A[i]&4 == 0".</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_224' href='#L_COMPARES_224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_225' href='#L_COMPARES_225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> GlobalVariable *GV,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_226' href='#L_COMPARES_226'><pre>226</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CmpInst &ICI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_227' href='#L_COMPARES_227'><pre>227</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> ConstantInt *AndCst) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_228' href='#L_COMPARES_228'><pre>228</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> Constant *Init = GV->getInitializer();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_229' href='#L_COMPARES_229'><pre>229</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<ConstantArray>(Init) && <span class='tooltip-content'>1.07k</span></div><div class='tooltip'>!isa<ConstantDataArray>(Init)<span class='tooltip-content'>768</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_230' href='#L_COMPARES_230'><pre>230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_231' href='#L_COMPARES_231'><pre>231</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_232' href='#L_COMPARES_232'><pre>232</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> uint64_t ArrayElementCount = Init->getType()->getArrayNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_233' href='#L_COMPARES_233'><pre>233</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // Don't blow up on huge arrays.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_234' href='#L_COMPARES_234'><pre>234</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> if (ArrayElementCount > MaxArraySizeForCombine)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_235' href='#L_COMPARES_235'><pre>235</pre></a></td><td class='covered-line'><pre>129</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_236' href='#L_COMPARES_236'><pre>236</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_237' href='#L_COMPARES_237'><pre>237</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // There are many forms of this optimization we can handle, for now, just do</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_238' href='#L_COMPARES_238'><pre>238</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // the simple index into a single-dimensional array.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_239' href='#L_COMPARES_239'><pre>239</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_240' href='#L_COMPARES_240'><pre>240</pre></a></td><td class='covered-line'><pre>1.07k</pre></td><td class='code'><pre> // Require: GEP GV, 0, i {{, constant indices}}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_241' href='#L_COMPARES_241'><pre>241</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>943</span></div><div class='tooltip'>GEP->getNumOperands() < 3 ||<span class='tooltip-content'>943</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_242' href='#L_COMPARES_242'><pre>242</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> !isa<ConstantInt>(GEP->getOperand(1)) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_243' href='#L_COMPARES_243'><pre>243</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> !cast<ConstantInt>(GEP->getOperand(1))->isZero() ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_244' href='#L_COMPARES_244'><pre>244</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> isa<Constant>(GEP->getOperand(2)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_245' href='#L_COMPARES_245'><pre>245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_246' href='#L_COMPARES_246'><pre>246</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_247' href='#L_COMPARES_247'><pre>247</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> // Check that indices after the variable are constants and in-range for the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_248' href='#L_COMPARES_248'><pre>248</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> // type they index. Collect the indices. This is typically for arrays of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_249' href='#L_COMPARES_249'><pre>249</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> // structs.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_250' href='#L_COMPARES_250'><pre>250</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> SmallVector<unsigned, 4> LaterIndices;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_251' href='#L_COMPARES_251'><pre>251</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_252' href='#L_COMPARES_252'><pre>252</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre> Type *EltTy = Init->getType()->getArrayElementType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_253' href='#L_COMPARES_253'><pre>253</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> for (unsigned i = 3, e = GEP->getNumOperands(); <div class='tooltip'>i != e<span class='tooltip-content'>1.02k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>77</span></div>) <div class='tooltip'>{<span class='tooltip-content'>269</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_254' href='#L_COMPARES_254'><pre>254</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre> ConstantInt *Idx = dyn_cast<ConstantInt>(GEP->getOperand(i));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_255' href='#L_COMPARES_255'><pre>255</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre> if (<div class='tooltip'>!Idx<span class='tooltip-content'>269</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>192</span></div>; // Variable index.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_256' href='#L_COMPARES_256'><pre>256</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_257' href='#L_COMPARES_257'><pre>257</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> uint64_t IdxVal = Idx->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_258' href='#L_COMPARES_258'><pre>258</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> if (<div class='tooltip'>(unsigned)IdxVal != IdxVal<span class='tooltip-content'>77</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>; // Too large array index.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_259' href='#L_COMPARES_259'><pre>259</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_260' href='#L_COMPARES_260'><pre>260</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> <div class='tooltip'>if (StructType *<span class='tooltip-content'>77</span></div><div class='tooltip'>STy<span class='tooltip-content'>77</span></div> = dyn_cast<StructType>(EltTy))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_261' href='#L_COMPARES_261'><pre>261</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> EltTy = STy->getElementType(IdxVal);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_262' href='#L_COMPARES_262'><pre>262</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> else <div class='tooltip'>if (ArrayType *<span class='tooltip-content'>20</span></div><div class='tooltip'>ATy<span class='tooltip-content'>20</span></div> = dyn_cast<ArrayType>(EltTy)) <div class='tooltip'>{<span class='tooltip-content'>20</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_263' href='#L_COMPARES_263'><pre>263</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> if (<div class='tooltip'>IdxVal >= ATy->getNumElements()<span class='tooltip-content'>20</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_264' href='#L_COMPARES_264'><pre>264</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> EltTy = ATy->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_265' href='#L_COMPARES_265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_266' href='#L_COMPARES_266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr; // Unknown type.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_267' href='#L_COMPARES_267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_268' href='#L_COMPARES_268'><pre>268</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_269' href='#L_COMPARES_269'><pre>269</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> LaterIndices.push_back(IdxVal);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_270' href='#L_COMPARES_270'><pre>270</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_271' href='#L_COMPARES_271'><pre>271</pre></a></td><td class='covered-line'><pre>943</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_272' href='#L_COMPARES_272'><pre>272</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> enum { Overdefined = -3, Undefined = -2 };</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_273' href='#L_COMPARES_273'><pre>273</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_274' href='#L_COMPARES_274'><pre>274</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // Variables for our state machines.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_275' href='#L_COMPARES_275'><pre>275</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_276' href='#L_COMPARES_276'><pre>276</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // FirstTrueElement/SecondTrueElement - Used to emit a comparison of the form</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_277' href='#L_COMPARES_277'><pre>277</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // "i == 47 | i == 87", where 47 is the first index the condition is true for,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_278' href='#L_COMPARES_278'><pre>278</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // and 87 is the second (and last) index. FirstTrueElement is -2 when</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_279' href='#L_COMPARES_279'><pre>279</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // undefined, otherwise set to the first true element. SecondTrueElement is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_280' href='#L_COMPARES_280'><pre>280</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // -2 when undefined, -3 when overdefined and >= 0 when that index is true.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_281' href='#L_COMPARES_281'><pre>281</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> int FirstTrueElement = Undefined, SecondTrueElement = Undefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_282' href='#L_COMPARES_282'><pre>282</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_283' href='#L_COMPARES_283'><pre>283</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // FirstFalseElement/SecondFalseElement - Used to emit a comparison of the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_284' href='#L_COMPARES_284'><pre>284</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // form "i != 47 & i != 87". Same state transitions as for true elements.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_285' href='#L_COMPARES_285'><pre>285</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> int FirstFalseElement = Undefined, SecondFalseElement = Undefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_286' href='#L_COMPARES_286'><pre>286</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_287' href='#L_COMPARES_287'><pre>287</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// TrueRangeEnd/FalseRangeEnd - In conjunction with First*Element, these</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_288' href='#L_COMPARES_288'><pre>288</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// define a state machine that triggers for ranges of values that the index</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_289' href='#L_COMPARES_289'><pre>289</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// is true or false for. This triggers on things like "abbbbc"[i] == 'b'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_290' href='#L_COMPARES_290'><pre>290</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// This is -2 when undefined, -3 when overdefined, and otherwise the last</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_291' href='#L_COMPARES_291'><pre>291</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// index in the range (inclusive). We use -2 for undefined here because we</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_292' href='#L_COMPARES_292'><pre>292</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> /// use relative comparisons and don't want 0-1 to match -1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_293' href='#L_COMPARES_293'><pre>293</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> int TrueRangeEnd = Undefined, FalseRangeEnd = Undefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_294' href='#L_COMPARES_294'><pre>294</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_295' href='#L_COMPARES_295'><pre>295</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // MagicBitvector - This is a magic bitvector where we set a bit if the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_296' href='#L_COMPARES_296'><pre>296</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // comparison is true for element 'i'. If there are 64 elements or less in</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_297' href='#L_COMPARES_297'><pre>297</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // the array, this will fully represent all the comparison results.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_298' href='#L_COMPARES_298'><pre>298</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> uint64_t MagicBitvector = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_299' href='#L_COMPARES_299'><pre>299</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_300' href='#L_COMPARES_300'><pre>300</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // Scan the array and see if one of our patterns matches.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_301' href='#L_COMPARES_301'><pre>301</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> Constant *CompareRHS = cast<Constant>(ICI.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_302' href='#L_COMPARES_302'><pre>302</pre></a></td><td class='covered-line'><pre>90.5k</pre></td><td class='code'><pre> for (unsigned i = 0, e = ArrayElementCount; <div class='tooltip'>i != e<span class='tooltip-content'>90.5k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>89.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>90.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_303' href='#L_COMPARES_303'><pre>303</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> Constant *Elt = Init->getAggregateElement(i);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_304' href='#L_COMPARES_304'><pre>304</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Elt<span class='tooltip-content'>90.4k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_305' href='#L_COMPARES_305'><pre>305</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_306' href='#L_COMPARES_306'><pre>306</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If this is indexing an array of structures, get the structure element.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_307' href='#L_COMPARES_307'><pre>307</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>90.4k</span></div><div class='tooltip'>!LaterIndices.empty()<span class='tooltip-content'>90.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_308' href='#L_COMPARES_308'><pre>308</pre></a></td><td class='covered-line'><pre>3.51k</pre></td><td class='code'><pre> Elt = ConstantExpr::getExtractValue(Elt, LaterIndices);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_309' href='#L_COMPARES_309'><pre>309</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_310' href='#L_COMPARES_310'><pre>310</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If the element is masked, handle it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_311' href='#L_COMPARES_311'><pre>311</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>AndCst<span class='tooltip-content'>90.4k</span></div>) <div class='tooltip'>Elt = ConstantExpr::getAnd(Elt, AndCst)<span class='tooltip-content'>2.01k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_312' href='#L_COMPARES_312'><pre>312</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_313' href='#L_COMPARES_313'><pre>313</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // Find out if the comparison would be true or false for the i'th element.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_314' href='#L_COMPARES_314'><pre>314</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> Constant *C = ConstantFoldCompareInstOperands(ICI.getPredicate(), Elt,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_315' href='#L_COMPARES_315'><pre>315</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> CompareRHS, DL, &TLI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_316' href='#L_COMPARES_316'><pre>316</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If the result is undef for this element, ignore it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_317' href='#L_COMPARES_317'><pre>317</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(C)<span class='tooltip-content'>90.4k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_318' href='#L_COMPARES_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Extend range state machines to cover this element in case there is an</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_319' href='#L_COMPARES_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // undef in the middle of the range.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_320' href='#L_COMPARES_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>TrueRangeEnd == (int)i-1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_321' href='#L_COMPARES_321'><pre>321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>TrueRangeEnd = i</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_322' href='#L_COMPARES_322'><pre>322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>FalseRangeEnd == (int)i-1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_323' href='#L_COMPARES_323'><pre>323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>FalseRangeEnd = i</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_324' href='#L_COMPARES_324'><pre>324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_325' href='#L_COMPARES_325'><pre>325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_326' href='#L_COMPARES_326'><pre>326</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_327' href='#L_COMPARES_327'><pre>327</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If we can't compute the result for any of the elements, we have to give</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_328' href='#L_COMPARES_328'><pre>328</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // up evaluating the entire conditional.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_329' href='#L_COMPARES_329'><pre>329</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>90.4k</span></div><div class='tooltip'>!isa<ConstantInt>(C)<span class='tooltip-content'>90.4k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_330' href='#L_COMPARES_330'><pre>330</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_331' href='#L_COMPARES_331'><pre>331</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // Otherwise, we know if the comparison is true or false for this element,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_332' href='#L_COMPARES_332'><pre>332</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // update our state machines.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_333' href='#L_COMPARES_333'><pre>333</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> bool IsTrueForElt = !cast<ConstantInt>(C)->isZero();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_334' href='#L_COMPARES_334'><pre>334</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_335' href='#L_COMPARES_335'><pre>335</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // State machine for single/double/range index comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_336' href='#L_COMPARES_336'><pre>336</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>IsTrueForElt<span class='tooltip-content'>90.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_337' href='#L_COMPARES_337'><pre>337</pre></a></td><td class='covered-line'><pre>22.9k</pre></td><td class='code'><pre> // Update the TrueElement state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_338' href='#L_COMPARES_338'><pre>338</pre></a></td><td class='covered-line'><pre>22.9k</pre></td><td class='code'><pre> if (FirstTrueElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_339' href='#L_COMPARES_339'><pre>339</pre></a></td><td class='covered-line'><pre>745</pre></td><td class='code'><pre> FirstTrueElement = TrueRangeEnd = i; // First true element.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_340' href='#L_COMPARES_340'><pre>340</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_341' href='#L_COMPARES_341'><pre>341</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> // Update double-compare state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_342' href='#L_COMPARES_342'><pre>342</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> if (SecondTrueElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_343' href='#L_COMPARES_343'><pre>343</pre></a></td><td class='covered-line'><pre>690</pre></td><td class='code'><pre> SecondTrueElement = i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_344' href='#L_COMPARES_344'><pre>344</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_345' href='#L_COMPARES_345'><pre>345</pre></a></td><td class='covered-line'><pre>21.5k</pre></td><td class='code'><pre> SecondTrueElement = Overdefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_346' href='#L_COMPARES_346'><pre>346</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_347' href='#L_COMPARES_347'><pre>347</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> // Update range state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_348' href='#L_COMPARES_348'><pre>348</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> if (TrueRangeEnd == (int)i-1)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_349' href='#L_COMPARES_349'><pre>349</pre></a></td><td class='covered-line'><pre>7.78k</pre></td><td class='code'><pre> TrueRangeEnd = i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_350' href='#L_COMPARES_350'><pre>350</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_351' href='#L_COMPARES_351'><pre>351</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> TrueRangeEnd = Overdefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_352' href='#L_COMPARES_352'><pre>352</pre></a></td><td class='covered-line'><pre>22.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_353' href='#L_COMPARES_353'><pre>353</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_354' href='#L_COMPARES_354'><pre>354</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> // Update the FalseElement state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_355' href='#L_COMPARES_355'><pre>355</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> if (FirstFalseElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_356' href='#L_COMPARES_356'><pre>356</pre></a></td><td class='covered-line'><pre>745</pre></td><td class='code'><pre> FirstFalseElement = FalseRangeEnd = i; // First false element.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_357' href='#L_COMPARES_357'><pre>357</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_358' href='#L_COMPARES_358'><pre>358</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> // Update double-compare state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_359' href='#L_COMPARES_359'><pre>359</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> if (SecondFalseElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_360' href='#L_COMPARES_360'><pre>360</pre></a></td><td class='covered-line'><pre>735</pre></td><td class='code'><pre> SecondFalseElement = i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_361' href='#L_COMPARES_361'><pre>361</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_362' href='#L_COMPARES_362'><pre>362</pre></a></td><td class='covered-line'><pre>65.9k</pre></td><td class='code'><pre> SecondFalseElement = Overdefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_363' href='#L_COMPARES_363'><pre>363</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_364' href='#L_COMPARES_364'><pre>364</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> // Update range state machine.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_365' href='#L_COMPARES_365'><pre>365</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> if (FalseRangeEnd == (int)i-1)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_366' href='#L_COMPARES_366'><pre>366</pre></a></td><td class='covered-line'><pre>47.1k</pre></td><td class='code'><pre> FalseRangeEnd = i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_367' href='#L_COMPARES_367'><pre>367</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_368' href='#L_COMPARES_368'><pre>368</pre></a></td><td class='covered-line'><pre>19.5k</pre></td><td class='code'><pre> FalseRangeEnd = Overdefined;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_369' href='#L_COMPARES_369'><pre>369</pre></a></td><td class='covered-line'><pre>66.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_370' href='#L_COMPARES_370'><pre>370</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_371' href='#L_COMPARES_371'><pre>371</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_372' href='#L_COMPARES_372'><pre>372</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If this element is in range, update our magic bitvector.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_373' href='#L_COMPARES_373'><pre>373</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>i < 64 && <span class='tooltip-content'>90.4k</span></div><div class='tooltip'>IsTrueForElt<span class='tooltip-content'>44.3k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_374' href='#L_COMPARES_374'><pre>374</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> MagicBitvector |= 1ULL << i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_375' href='#L_COMPARES_375'><pre>375</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_376' href='#L_COMPARES_376'><pre>376</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // If all of our states become overdefined, bail out early. Since the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_377' href='#L_COMPARES_377'><pre>377</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // predicate is expensive, only check it every 8 elements. This is only</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_378' href='#L_COMPARES_378'><pre>378</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> // really useful for really huge arrays.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_379' href='#L_COMPARES_379'><pre>379</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>(i & 8) == 0 && <span class='tooltip-content'>90.4k</span></div><div class='tooltip'>i >= 64<span class='tooltip-content'>45.9k</span></div> && <div class='tooltip'>SecondTrueElement == Overdefined<span class='tooltip-content'>23.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_380' href='#L_COMPARES_380'><pre>380</pre></a></td><td class='covered-line'><pre>2.66k</pre></td><td class='code'><pre> <div class='tooltip'>SecondFalseElement == Overdefined<span class='tooltip-content'>2.66k</span></div> && <div class='tooltip'>TrueRangeEnd == Overdefined<span class='tooltip-content'>933</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_381' href='#L_COMPARES_381'><pre>381</pre></a></td><td class='covered-line'><pre>651</pre></td><td class='code'><pre> FalseRangeEnd == Overdefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_382' href='#L_COMPARES_382'><pre>382</pre></a></td><td class='covered-line'><pre>650</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_383' href='#L_COMPARES_383'><pre>383</pre></a></td><td class='covered-line'><pre>90.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_384' href='#L_COMPARES_384'><pre>384</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_385' href='#L_COMPARES_385'><pre>385</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // Now that we've scanned the entire array, emit our new comparison(s). We</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_386' href='#L_COMPARES_386'><pre>386</pre></a></td><td class='covered-line'><pre>751</pre></td><td class='code'><pre> // order the state machines in complexity of the generated code.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_387' href='#L_COMPARES_387'><pre>387</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> Value *Idx = GEP->getOperand(2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_388' href='#L_COMPARES_388'><pre>388</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_389' href='#L_COMPARES_389'><pre>389</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // If the index is larger than the pointer size of the target, truncate the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_390' href='#L_COMPARES_390'><pre>390</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // index down like the GEP would do implicitly. We don't have to do this for</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_391' href='#L_COMPARES_391'><pre>391</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // an inbounds GEP because the index can't be out of range.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_392' href='#L_COMPARES_392'><pre>392</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> if (<div class='tooltip'>!GEP->isInBounds()<span class='tooltip-content'>101</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_393' href='#L_COMPARES_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *IntPtrTy = DL.getIntPtrType(GEP->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_394' href='#L_COMPARES_394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned PtrSize = IntPtrTy->getIntegerBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_395' href='#L_COMPARES_395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Idx->getType()->getPrimitiveSizeInBits() > PtrSize</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_396' href='#L_COMPARES_396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Idx = Builder->CreateTrunc(Idx, IntPtrTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_397' href='#L_COMPARES_397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_398' href='#L_COMPARES_398'><pre>398</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_399' href='#L_COMPARES_399'><pre>399</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // If the comparison is only true for one or two elements, emit direct</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_400' href='#L_COMPARES_400'><pre>400</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // comparisons.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_401' href='#L_COMPARES_401'><pre>401</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> if (<div class='tooltip'>SecondTrueElement != Overdefined<span class='tooltip-content'>101</span></div>) <div class='tooltip'>{<span class='tooltip-content'>68</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_402' href='#L_COMPARES_402'><pre>402</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> // None true -> false.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_403' href='#L_COMPARES_403'><pre>403</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> if (FirstTrueElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_404' href='#L_COMPARES_404'><pre>404</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return replaceInstUsesWith(ICI, Builder->getFalse());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_405' href='#L_COMPARES_405'><pre>405</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_406' href='#L_COMPARES_406'><pre>406</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> Value *FirstTrueIdx = ConstantInt::get(Idx->getType(), FirstTrueElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_407' href='#L_COMPARES_407'><pre>407</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_408' href='#L_COMPARES_408'><pre>408</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> // True for one element -> 'i == 47'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_409' href='#L_COMPARES_409'><pre>409</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> if (SecondTrueElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_410' href='#L_COMPARES_410'><pre>410</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Idx, FirstTrueIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_411' href='#L_COMPARES_411'><pre>411</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_412' href='#L_COMPARES_412'><pre>412</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> // True for two elements -> 'i == 47 | i == 72'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_413' href='#L_COMPARES_413'><pre>413</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *C1 = Builder->CreateICmpEQ(Idx, FirstTrueIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_414' href='#L_COMPARES_414'><pre>414</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *SecondTrueIdx = ConstantInt::get(Idx->getType(), SecondTrueElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_415' href='#L_COMPARES_415'><pre>415</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *C2 = Builder->CreateICmpEQ(Idx, SecondTrueIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_416' href='#L_COMPARES_416'><pre>416</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(C1, C2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_417' href='#L_COMPARES_417'><pre>417</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_418' href='#L_COMPARES_418'><pre>418</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_419' href='#L_COMPARES_419'><pre>419</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // If the comparison is only false for one or two elements, emit direct</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_420' href='#L_COMPARES_420'><pre>420</pre></a></td><td class='covered-line'><pre>101</pre></td><td class='code'><pre> // comparisons.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_421' href='#L_COMPARES_421'><pre>421</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>33</span></div><div class='tooltip'>SecondFalseElement != Overdefined<span class='tooltip-content'>33</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_422' href='#L_COMPARES_422'><pre>422</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> // None false -> true.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_423' href='#L_COMPARES_423'><pre>423</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> if (FirstFalseElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_424' href='#L_COMPARES_424'><pre>424</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return replaceInstUsesWith(ICI, Builder->getTrue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_425' href='#L_COMPARES_425'><pre>425</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_426' href='#L_COMPARES_426'><pre>426</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Value *FirstFalseIdx = ConstantInt::get(Idx->getType(), FirstFalseElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_427' href='#L_COMPARES_427'><pre>427</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_428' href='#L_COMPARES_428'><pre>428</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> // False for one element -> 'i != 47'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_429' href='#L_COMPARES_429'><pre>429</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> if (SecondFalseElement == Undefined)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_430' href='#L_COMPARES_430'><pre>430</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Idx, FirstFalseIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_431' href='#L_COMPARES_431'><pre>431</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_432' href='#L_COMPARES_432'><pre>432</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> // False for two elements -> 'i != 47 & i != 72'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_433' href='#L_COMPARES_433'><pre>433</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Value *C1 = Builder->CreateICmpNE(Idx, FirstFalseIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_434' href='#L_COMPARES_434'><pre>434</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Value *SecondFalseIdx = ConstantInt::get(Idx->getType(),SecondFalseElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_435' href='#L_COMPARES_435'><pre>435</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Value *C2 = Builder->CreateICmpNE(Idx, SecondFalseIdx);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_436' href='#L_COMPARES_436'><pre>436</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(C1, C2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_437' href='#L_COMPARES_437'><pre>437</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_438' href='#L_COMPARES_438'><pre>438</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_439' href='#L_COMPARES_439'><pre>439</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> // If the comparison can be replaced with a range comparison for the elements</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_440' href='#L_COMPARES_440'><pre>440</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> // where it is true, emit the range check.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_441' href='#L_COMPARES_441'><pre>441</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16</span></div><div class='tooltip'>TrueRangeEnd != Overdefined<span class='tooltip-content'>16</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_442' href='#L_COMPARES_442'><pre>442</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> assert(TrueRangeEnd != FirstTrueElement && "Should emit single compare");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_443' href='#L_COMPARES_443'><pre>443</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_444' href='#L_COMPARES_444'><pre>444</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // Generate (i-FirstTrue) <u (TrueRangeEnd-FirstTrue+1).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_445' href='#L_COMPARES_445'><pre>445</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (<div class='tooltip'>FirstTrueElement<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_446' href='#L_COMPARES_446'><pre>446</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *Offs = ConstantInt::get(Idx->getType(), -FirstTrueElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_447' href='#L_COMPARES_447'><pre>447</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Idx = Builder->CreateAdd(Idx, Offs);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_448' href='#L_COMPARES_448'><pre>448</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_449' href='#L_COMPARES_449'><pre>449</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_450' href='#L_COMPARES_450'><pre>450</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *End = ConstantInt::get(Idx->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_451' href='#L_COMPARES_451'><pre>451</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> TrueRangeEnd-FirstTrueElement+1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_452' href='#L_COMPARES_452'><pre>452</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_ULT, Idx, End);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_453' href='#L_COMPARES_453'><pre>453</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_454' href='#L_COMPARES_454'><pre>454</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_455' href='#L_COMPARES_455'><pre>455</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> // False range check.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_456' href='#L_COMPARES_456'><pre>456</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>10</span></div><div class='tooltip'>FalseRangeEnd != Overdefined<span class='tooltip-content'>10</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_457' href='#L_COMPARES_457'><pre>457</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> assert(FalseRangeEnd != FirstFalseElement && "Should emit single compare");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_458' href='#L_COMPARES_458'><pre>458</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Generate (i-FirstFalse) >u (FalseRangeEnd-FirstFalse).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_459' href='#L_COMPARES_459'><pre>459</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>FirstFalseElement<span class='tooltip-content'>2</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_460' href='#L_COMPARES_460'><pre>460</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *Offs = ConstantInt::get(Idx->getType(), -FirstFalseElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_461' href='#L_COMPARES_461'><pre>461</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Idx = Builder->CreateAdd(Idx, Offs);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_462' href='#L_COMPARES_462'><pre>462</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_463' href='#L_COMPARES_463'><pre>463</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_464' href='#L_COMPARES_464'><pre>464</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *End = ConstantInt::get(Idx->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_465' href='#L_COMPARES_465'><pre>465</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> FalseRangeEnd-FirstFalseElement);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_466' href='#L_COMPARES_466'><pre>466</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_UGT, Idx, End);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_467' href='#L_COMPARES_467'><pre>467</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_468' href='#L_COMPARES_468'><pre>468</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_469' href='#L_COMPARES_469'><pre>469</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // If a magic bitvector captures the entire comparison state</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_470' href='#L_COMPARES_470'><pre>470</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // of this load, replace it with computation that does:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_471' href='#L_COMPARES_471'><pre>471</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // ((magic_cst >> i) & 1) != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_472' href='#L_COMPARES_472'><pre>472</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_473' href='#L_COMPARES_473'><pre>473</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Type *Ty = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_474' href='#L_COMPARES_474'><pre>474</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_475' href='#L_COMPARES_475'><pre>475</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Look for an appropriate type:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_476' href='#L_COMPARES_476'><pre>476</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // - The type of Idx if the magic fits</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_477' href='#L_COMPARES_477'><pre>477</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // - The smallest fitting legal type if we have a DataLayout</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_478' href='#L_COMPARES_478'><pre>478</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // - Default to i32</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_479' href='#L_COMPARES_479'><pre>479</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (ArrayElementCount <= Idx->getType()->getIntegerBitWidth())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_480' href='#L_COMPARES_480'><pre>480</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Ty = Idx->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_481' href='#L_COMPARES_481'><pre>481</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_482' href='#L_COMPARES_482'><pre>482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Ty = DL.getSmallestLegalIntType(Init->getContext(), ArrayElementCount)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_483' href='#L_COMPARES_483'><pre>483</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_484' href='#L_COMPARES_484'><pre>484</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (<div class='tooltip'>Ty<span class='tooltip-content'>8</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_485' href='#L_COMPARES_485'><pre>485</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *V = Builder->CreateIntCast(Idx, Ty, false);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_486' href='#L_COMPARES_486'><pre>486</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> V = Builder->CreateLShr(ConstantInt::get(Ty, MagicBitvector), V);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_487' href='#L_COMPARES_487'><pre>487</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> V = Builder->CreateAnd(ConstantInt::get(Ty, 1), V);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_488' href='#L_COMPARES_488'><pre>488</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, V, ConstantInt::get(Ty, 0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_489' href='#L_COMPARES_489'><pre>489</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_490' href='#L_COMPARES_490'><pre>490</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_491' href='#L_COMPARES_491'><pre>491</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_492' href='#L_COMPARES_492'><pre>492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_493' href='#L_COMPARES_493'><pre>493</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_494' href='#L_COMPARES_494'><pre>494</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_495' href='#L_COMPARES_495'><pre>495</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return a value that can be used to compare the *offset* implied by a GEP to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_496' href='#L_COMPARES_496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// zero. For example, if we have &A[i], we want to return 'i' for</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_497' href='#L_COMPARES_497'><pre>497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// "icmp ne i, 0". Note that, in general, indices can be complex, and scales</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_498' href='#L_COMPARES_498'><pre>498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// are involved. The above expression would also be legal to codegen as</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_499' href='#L_COMPARES_499'><pre>499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// "icmp ne (i*4), 0" (assuming A is a pointer to i32).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_500' href='#L_COMPARES_500'><pre>500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This latter form is less amenable to optimization though, and we are allowed</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_501' href='#L_COMPARES_501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to generate the first by knowing that pointer arithmetic doesn't overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_502' href='#L_COMPARES_502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_503' href='#L_COMPARES_503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If we can't emit an optimized form for this expression, this returns null.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_504' href='#L_COMPARES_504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_505' href='#L_COMPARES_505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *evaluateGEPOffsetExpression(User *GEP, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_506' href='#L_COMPARES_506'><pre>506</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_507' href='#L_COMPARES_507'><pre>507</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> gep_type_iterator GTI = gep_type_begin(GEP);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_508' href='#L_COMPARES_508'><pre>508</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_509' href='#L_COMPARES_509'><pre>509</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Check to see if this gep only has a single variable index. If so, and if</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_510' href='#L_COMPARES_510'><pre>510</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // any constant indices are a multiple of its scale, then we can compute this</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_511' href='#L_COMPARES_511'><pre>511</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // in terms of the scale of the variable index. For example, if the GEP</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_512' href='#L_COMPARES_512'><pre>512</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // implies an offset of "12 + i*4", then we can codegen this as "3 + i",</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_513' href='#L_COMPARES_513'><pre>513</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // because the expression will cross zero at the same point.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_514' href='#L_COMPARES_514'><pre>514</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> unsigned i, e = GEP->getNumOperands();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_515' href='#L_COMPARES_515'><pre>515</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> int64_t Offset = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_516' href='#L_COMPARES_516'><pre>516</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (i = 1; <div class='tooltip'>i != e<span class='tooltip-content'>84</span></div>; <div class='tooltip'><span class='red'>++i, ++GTI</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'>{<span class='tooltip-content'>84</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_517' href='#L_COMPARES_517'><pre>517</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>CI<span class='tooltip-content'>84</span></div> = dyn_cast<ConstantInt>(GEP->getOperand(i))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_518' href='#L_COMPARES_518'><pre>518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Compute the aggregate offset of constant indices.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_519' href='#L_COMPARES_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CI->isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>continue</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_520' href='#L_COMPARES_520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_521' href='#L_COMPARES_521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle a struct index, which adds its field offset to the pointer.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_522' href='#L_COMPARES_522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (StructType *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>STy</span><span class='tooltip-content'>0</span></div><span class='red'> = GTI.getStructTypeOrNull()) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_523' href='#L_COMPARES_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += DL.getStructLayout(STy)->getElementOffset(CI->getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_524' href='#L_COMPARES_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_525' href='#L_COMPARES_525'><pre>525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint64_t Size = DL.getTypeAllocSize(GTI.getIndexedType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_526' href='#L_COMPARES_526'><pre>526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += Size*CI->getSExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_527' href='#L_COMPARES_527'><pre>527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_528' href='#L_COMPARES_528'><pre>528</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_529' href='#L_COMPARES_529'><pre>529</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Found our variable index.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_530' href='#L_COMPARES_530'><pre>530</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_531' href='#L_COMPARES_531'><pre>531</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_532' href='#L_COMPARES_532'><pre>532</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_533' href='#L_COMPARES_533'><pre>533</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_534' href='#L_COMPARES_534'><pre>534</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // If there are no variable indices, we must have a constant offset, just</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_535' href='#L_COMPARES_535'><pre>535</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // evaluate it the general way.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_536' href='#L_COMPARES_536'><pre>536</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (<div class='tooltip'>i == e<span class='tooltip-content'>84</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_537' href='#L_COMPARES_537'><pre>537</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_538' href='#L_COMPARES_538'><pre>538</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> Value *VariableIdx = GEP->getOperand(i);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_539' href='#L_COMPARES_539'><pre>539</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Determine the scale factor of the variable element. For example, this is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_540' href='#L_COMPARES_540'><pre>540</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // 4 if the variable index is into an array of i32.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_541' href='#L_COMPARES_541'><pre>541</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> uint64_t VariableScale = DL.getTypeAllocSize(GTI.getIndexedType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_542' href='#L_COMPARES_542'><pre>542</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_543' href='#L_COMPARES_543'><pre>543</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Verify that there are no other variable indices. If so, emit the hard way.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_544' href='#L_COMPARES_544'><pre>544</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (++i, ++GTI; <div class='tooltip'>i != e<span class='tooltip-content'>84</span></div>; <div class='tooltip'><span class='red'>++i, ++GTI</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_545' href='#L_COMPARES_545'><pre>545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(i));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_546' href='#L_COMPARES_546'><pre>546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_547' href='#L_COMPARES_547'><pre>547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_548' href='#L_COMPARES_548'><pre>548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Compute the aggregate offset of constant indices.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_549' href='#L_COMPARES_549'><pre>549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI->isZero()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>continue</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_550' href='#L_COMPARES_550'><pre>550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_551' href='#L_COMPARES_551'><pre>551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle a struct index, which adds its field offset to the pointer.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_552' href='#L_COMPARES_552'><pre>552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (StructType *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>STy</span><span class='tooltip-content'>0</span></div><span class='red'> = GTI.getStructTypeOrNull()) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_553' href='#L_COMPARES_553'><pre>553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += DL.getStructLayout(STy)->getElementOffset(CI->getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_554' href='#L_COMPARES_554'><pre>554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_555' href='#L_COMPARES_555'><pre>555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint64_t Size = DL.getTypeAllocSize(GTI.getIndexedType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_556' href='#L_COMPARES_556'><pre>556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += Size*CI->getSExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_557' href='#L_COMPARES_557'><pre>557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_558' href='#L_COMPARES_558'><pre>558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_559' href='#L_COMPARES_559'><pre>559</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_560' href='#L_COMPARES_560'><pre>560</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Okay, we know we have a single variable index, which must be a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_561' href='#L_COMPARES_561'><pre>561</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // pointer/array/vector index. If there is no offset, life is simple, return</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_562' href='#L_COMPARES_562'><pre>562</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // the index.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_563' href='#L_COMPARES_563'><pre>563</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> Type *IntPtrTy = DL.getIntPtrType(GEP->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_564' href='#L_COMPARES_564'><pre>564</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> unsigned IntPtrWidth = IntPtrTy->getIntegerBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_565' href='#L_COMPARES_565'><pre>565</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (<div class='tooltip'>Offset == 0<span class='tooltip-content'>84</span></div>) <div class='tooltip'>{<span class='tooltip-content'>84</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_566' href='#L_COMPARES_566'><pre>566</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Cast to intptrty in case a truncation occurs. If an extension is needed,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_567' href='#L_COMPARES_567'><pre>567</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // we don't need to bother extending: the extension won't affect where the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_568' href='#L_COMPARES_568'><pre>568</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // computation crosses zero.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_569' href='#L_COMPARES_569'><pre>569</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (<div class='tooltip'>VariableIdx->getType()->getPrimitiveSizeInBits() > IntPtrWidth<span class='tooltip-content'>84</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_570' href='#L_COMPARES_570'><pre>570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VariableIdx = IC.Builder->CreateTrunc(VariableIdx, IntPtrTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_571' href='#L_COMPARES_571'><pre>571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_572' href='#L_COMPARES_572'><pre>572</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> return VariableIdx;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_573' href='#L_COMPARES_573'><pre>573</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_574' href='#L_COMPARES_574'><pre>574</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_575' href='#L_COMPARES_575'><pre>575</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Otherwise, there is an index. The computation we will do will be modulo</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_576' href='#L_COMPARES_576'><pre>576</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // the pointer size, so get it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_577' href='#L_COMPARES_577'><pre>577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>uint64_t PtrSizeMask = ~0ULL >> (64-IntPtrWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_578' href='#L_COMPARES_578'><pre>578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_579' href='#L_COMPARES_579'><pre>579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset &= PtrSizeMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_580' href='#L_COMPARES_580'><pre>580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VariableScale &= PtrSizeMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_581' href='#L_COMPARES_581'><pre>581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_582' href='#L_COMPARES_582'><pre>582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // To do this transformation, any constant index must be a multiple of the</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_583' href='#L_COMPARES_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // variable scale factor. For example, we can evaluate "12 + 4*i" as "3 + i",</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_584' href='#L_COMPARES_584'><pre>584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // but we can't evaluate "10 + 3*i" in terms of i. Check that the offset is a</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_585' href='#L_COMPARES_585'><pre>585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // multiple of the variable scale.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_586' href='#L_COMPARES_586'><pre>586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int64_t NewOffs = Offset / (int64_t)VariableScale;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_587' href='#L_COMPARES_587'><pre>587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Offset != NewOffs*(int64_t)VariableScale</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_588' href='#L_COMPARES_588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_589' href='#L_COMPARES_589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_590' href='#L_COMPARES_590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Okay, we can do this evaluation. Start by converting the index to intptr.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_591' href='#L_COMPARES_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>VariableIdx->getType() != IntPtrTy</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_592' href='#L_COMPARES_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>VariableIdx = IC.Builder->CreateIntCast(VariableIdx, IntPtrTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_593' href='#L_COMPARES_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true /*Signed*/)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_594' href='#L_COMPARES_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *OffsetVal = ConstantInt::get(IntPtrTy, NewOffs);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_595' href='#L_COMPARES_595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.Builder->CreateAdd(VariableIdx, OffsetVal, "offset")</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_596' href='#L_COMPARES_596'><pre>596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_597' href='#L_COMPARES_597'><pre>597</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_598' href='#L_COMPARES_598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Returns true if we can rewrite Start as a GEP with pointer Base</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_599' href='#L_COMPARES_599'><pre>599</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and some integer offset. The nodes that need to be re-written</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_600' href='#L_COMPARES_600'><pre>600</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// for this transformation will be added to Explored.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_601' href='#L_COMPARES_601'><pre>601</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canRewriteGEPAsOffset(Value *Start, Value *Base,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_602' href='#L_COMPARES_602'><pre>602</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DataLayout &DL,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_603' href='#L_COMPARES_603'><pre>603</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> SetVector<Value *> &Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_604' href='#L_COMPARES_604'><pre>604</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> SmallVector<Value *, 16> WorkList(1, Start);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_605' href='#L_COMPARES_605'><pre>605</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> Explored.insert(Base);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_606' href='#L_COMPARES_606'><pre>606</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_607' href='#L_COMPARES_607'><pre>607</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // The following traversal gives us an order which can be used</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_608' href='#L_COMPARES_608'><pre>608</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // when doing the final transformation. Since in the final</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_609' href='#L_COMPARES_609'><pre>609</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // transformation we create the PHI replacement instructions first,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_610' href='#L_COMPARES_610'><pre>610</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // we don't have to get them in any particular order.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_611' href='#L_COMPARES_611'><pre>611</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_612' href='#L_COMPARES_612'><pre>612</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // However, for other instructions we will have to traverse the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_613' href='#L_COMPARES_613'><pre>613</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // operands of an instruction first, which means that we have to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_614' href='#L_COMPARES_614'><pre>614</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // do a post-order traversal.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_615' href='#L_COMPARES_615'><pre>615</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> while (<div class='tooltip'>!WorkList.empty()<span class='tooltip-content'>25.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>25.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_616' href='#L_COMPARES_616'><pre>616</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> SetVector<PHINode *> PHIs;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_617' href='#L_COMPARES_617'><pre>617</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_618' href='#L_COMPARES_618'><pre>618</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> while (<div class='tooltip'>!WorkList.empty()<span class='tooltip-content'>46.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>39.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_619' href='#L_COMPARES_619'><pre>619</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre> if (Explored.size() >= 100)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_620' href='#L_COMPARES_620'><pre>620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_621' href='#L_COMPARES_621'><pre>621</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_622' href='#L_COMPARES_622'><pre>622</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre> Value *V = WorkList.back();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_623' href='#L_COMPARES_623'><pre>623</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_624' href='#L_COMPARES_624'><pre>624</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>Explored.count(V) != 0<span class='tooltip-content'>39.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>124</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_625' href='#L_COMPARES_625'><pre>625</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> WorkList.pop_back();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_626' href='#L_COMPARES_626'><pre>626</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_627' href='#L_COMPARES_627'><pre>627</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_628' href='#L_COMPARES_628'><pre>628</pre></a></td><td class='covered-line'><pre>39.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_629' href='#L_COMPARES_629'><pre>629</pre></a></td><td class='covered-line'><pre>39.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>39.3k</span></div><div class='tooltip'>!isa<IntToPtrInst>(V) && <span class='tooltip-content'>39.3k</span></div><div class='tooltip'>!isa<PtrToIntInst>(V)<span class='tooltip-content'>39.2k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_630' href='#L_COMPARES_630'><pre>630</pre></a></td><td class='covered-line'><pre>39.2k</pre></td><td class='code'><pre> <div class='tooltip'>!isa<GetElementPtrInst>(V)<span class='tooltip-content'>39.2k</span></div> && <div class='tooltip'>!isa<PHINode>(V)<span class='tooltip-content'>22.1k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_631' href='#L_COMPARES_631'><pre>631</pre></a></td><td class='covered-line'><pre>39.3k</pre></td><td class='code'><pre> // We've found some value that we can't explore which is different from</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_632' href='#L_COMPARES_632'><pre>632</pre></a></td><td class='covered-line'><pre>39.3k</pre></td><td class='code'><pre> // the base. Therefore we can't do this transformation.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_633' href='#L_COMPARES_633'><pre>633</pre></a></td><td class='covered-line'><pre>13.1k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_634' href='#L_COMPARES_634'><pre>634</pre></a></td><td class='covered-line'><pre>39.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_635' href='#L_COMPARES_635'><pre>635</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>26.1k</span></div><div class='tooltip'>isa<IntToPtrInst>(V) || <span class='tooltip-content'>26.1k</span></div><div class='tooltip'>isa<PtrToIntInst>(V)<span class='tooltip-content'>26.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>87</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_636' href='#L_COMPARES_636'><pre>636</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> auto *CI = dyn_cast<CastInst>(V);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_637' href='#L_COMPARES_637'><pre>637</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> if (!CI->isNoopCast(DL))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_638' href='#L_COMPARES_638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_639' href='#L_COMPARES_639'><pre>639</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_640' href='#L_COMPARES_640'><pre>640</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>87</span></div><div class='tooltip'>Explored.count(CI->getOperand(0)) == 0<span class='tooltip-content'>87</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_641' href='#L_COMPARES_641'><pre>641</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> WorkList.push_back(CI->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_642' href='#L_COMPARES_642'><pre>642</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_643' href='#L_COMPARES_643'><pre>643</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_644' href='#L_COMPARES_644'><pre>644</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>26.1k</span></div><div class='tooltip'>GEP<span class='tooltip-content'>26.1k</span></div> = dyn_cast<GEPOperator>(V)) <div class='tooltip'>{<span class='tooltip-content'>17.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_645' href='#L_COMPARES_645'><pre>645</pre></a></td><td class='covered-line'><pre>17.1k</pre></td><td class='code'><pre> // We're limiting the GEP to having one index. This will preserve</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_646' href='#L_COMPARES_646'><pre>646</pre></a></td><td class='covered-line'><pre>17.1k</pre></td><td class='code'><pre> // the original pointer type. We could handle more cases in the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_647' href='#L_COMPARES_647'><pre>647</pre></a></td><td class='covered-line'><pre>17.1k</pre></td><td class='code'><pre> // future.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_648' href='#L_COMPARES_648'><pre>648</pre></a></td><td class='covered-line'><pre>17.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>GEP->getNumIndices() != 1 || <span class='tooltip-content'>17.1k</span></div><div class='tooltip'>!GEP->isInBounds()<span class='tooltip-content'>11.6k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_649' href='#L_COMPARES_649'><pre>649</pre></a></td><td class='covered-line'><pre>11.6k</pre></td><td class='code'><pre> GEP->getType() != Start->getType())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_650' href='#L_COMPARES_650'><pre>650</pre></a></td><td class='covered-line'><pre>5.49k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_651' href='#L_COMPARES_651'><pre>651</pre></a></td><td class='covered-line'><pre>17.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_652' href='#L_COMPARES_652'><pre>652</pre></a></td><td class='covered-line'><pre>11.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>11.6k</span></div><div class='tooltip'>Explored.count(GEP->getOperand(0)) == 0<span class='tooltip-content'>11.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_653' href='#L_COMPARES_653'><pre>653</pre></a></td><td class='covered-line'><pre>6.76k</pre></td><td class='code'><pre> WorkList.push_back(GEP->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_654' href='#L_COMPARES_654'><pre>654</pre></a></td><td class='covered-line'><pre>11.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_655' href='#L_COMPARES_655'><pre>655</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_656' href='#L_COMPARES_656'><pre>656</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>20.6k</span></div><div class='tooltip'>WorkList.back() == V<span class='tooltip-content'>20.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_657' href='#L_COMPARES_657'><pre>657</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> WorkList.pop_back();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_658' href='#L_COMPARES_658'><pre>658</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> // We've finished visiting this node, mark it as such.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_659' href='#L_COMPARES_659'><pre>659</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> Explored.insert(V);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_660' href='#L_COMPARES_660'><pre>660</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_661' href='#L_COMPARES_661'><pre>661</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_662' href='#L_COMPARES_662'><pre>662</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>PN<span class='tooltip-content'>20.6k</span></div> = dyn_cast<PHINode>(V)) <div class='tooltip'>{<span class='tooltip-content'>8.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_663' href='#L_COMPARES_663'><pre>663</pre></a></td><td class='covered-line'><pre>8.96k</pre></td><td class='code'><pre> // We cannot transform PHIs on unsplittable basic blocks.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_664' href='#L_COMPARES_664'><pre>664</pre></a></td><td class='covered-line'><pre>8.96k</pre></td><td class='code'><pre> if (isa<CatchSwitchInst>(PN->getParent()->getTerminator()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_665' href='#L_COMPARES_665'><pre>665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_666' href='#L_COMPARES_666'><pre>666</pre></a></td><td class='covered-line'><pre>8.96k</pre></td><td class='code'><pre> Explored.insert(PN);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_667' href='#L_COMPARES_667'><pre>667</pre></a></td><td class='covered-line'><pre>8.96k</pre></td><td class='code'><pre> PHIs.insert(PN);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_668' href='#L_COMPARES_668'><pre>668</pre></a></td><td class='covered-line'><pre>8.96k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_669' href='#L_COMPARES_669'><pre>669</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_670' href='#L_COMPARES_670'><pre>670</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_671' href='#L_COMPARES_671'><pre>671</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> // Explore the PHI nodes further.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_672' href='#L_COMPARES_672'><pre>672</pre></a></td><td class='covered-line'><pre>6.97k</pre></td><td class='code'><pre> for (auto *PN : PHIs)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_673' href='#L_COMPARES_673'><pre>673</pre></a></td><td class='covered-line'><pre>8.17k</pre></td><td class='code'><pre> for (Value *Op : PN->incoming_values())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_674' href='#L_COMPARES_674'><pre>674</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>17.0k</span></div><div class='tooltip'>Explored.count(Op) == 0<span class='tooltip-content'>17.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_675' href='#L_COMPARES_675'><pre>675</pre></a></td><td class='covered-line'><pre>12.9k</pre></td><td class='code'><pre> WorkList.push_back(Op);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_676' href='#L_COMPARES_676'><pre>676</pre></a></td><td class='covered-line'><pre>6.97k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_677' href='#L_COMPARES_677'><pre>677</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_678' href='#L_COMPARES_678'><pre>678</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // Make sure that we can do this. Since we can't insert GEPs in a basic</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_679' href='#L_COMPARES_679'><pre>679</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // block before a PHI node, we can't easily do this transformation if</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_680' href='#L_COMPARES_680'><pre>680</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // we have PHI node users of transformed instructions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_681' href='#L_COMPARES_681'><pre>681</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> <div class='tooltip'>for (Value *Val : Explored) <span class='tooltip-content'>20</span></div><div class='tooltip'>{<span class='tooltip-content'>84</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_682' href='#L_COMPARES_682'><pre>682</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre> for (Value *Use : Val->uses()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_683' href='#L_COMPARES_683'><pre>683</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_684' href='#L_COMPARES_684'><pre>684</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre> auto *PHI = dyn_cast<PHINode>(Use);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_685' href='#L_COMPARES_685'><pre>685</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre> auto *Inst = dyn_cast<Instruction>(Val);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_686' href='#L_COMPARES_686'><pre>686</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_687' href='#L_COMPARES_687'><pre>687</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre> if (<div class='tooltip'>Inst == Base || <span class='tooltip-content'>286</span></div><div class='tooltip'>Inst == PHI<span class='tooltip-content'>193</span></div> || <div class='tooltip'>!Inst<span class='tooltip-content'>105</span></div> || <div class='tooltip'>!PHI<span class='tooltip-content'>105</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_688' href='#L_COMPARES_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Explored.count(PHI) == 0</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_689' href='#L_COMPARES_689'><pre>689</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_690' href='#L_COMPARES_690'><pre>690</pre></a></td><td class='covered-line'><pre>286</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_691' href='#L_COMPARES_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PHI->getParent() == Inst->getParent()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_692' href='#L_COMPARES_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_693' href='#L_COMPARES_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_694' href='#L_COMPARES_694'><pre>694</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_695' href='#L_COMPARES_695'><pre>695</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_696' href='#L_COMPARES_696'><pre>696</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_697' href='#L_COMPARES_697'><pre>697</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_698' href='#L_COMPARES_698'><pre>698</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Sets the appropriate insert point on Builder where we can add</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_699' href='#L_COMPARES_699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// a replacement Instruction for V (if that is possible).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_700' href='#L_COMPARES_700'><pre>700</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static void setInsertionPoint(IRBuilder<> &Builder, Value *V,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_701' href='#L_COMPARES_701'><pre>701</pre></a></td><td class='covered-line'><pre>107</pre></td><td class='code'><pre> bool Before = true) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_702' href='#L_COMPARES_702'><pre>702</pre></a></td><td class='covered-line'><pre>107</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>PHI<span class='tooltip-content'>107</span></div> = dyn_cast<PHINode>(V)) <div class='tooltip'>{<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_703' href='#L_COMPARES_703'><pre>703</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Builder.SetInsertPoint(&*PHI->getParent()->getFirstInsertionPt());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_704' href='#L_COMPARES_704'><pre>704</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_705' href='#L_COMPARES_705'><pre>705</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_706' href='#L_COMPARES_706'><pre>706</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>86</span></div><div class='tooltip'>I<span class='tooltip-content'>86</span></div> = dyn_cast<Instruction>(V)) <div class='tooltip'>{<span class='tooltip-content'>86</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_707' href='#L_COMPARES_707'><pre>707</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> if (!Before)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_708' href='#L_COMPARES_708'><pre>708</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> I = &*std::next(I->getIterator());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_709' href='#L_COMPARES_709'><pre>709</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Builder.SetInsertPoint(I);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_710' href='#L_COMPARES_710'><pre>710</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> return;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_711' href='#L_COMPARES_711'><pre>711</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_712' href='#L_COMPARES_712'><pre>712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>A</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Argument>(V)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_713' href='#L_COMPARES_713'><pre>713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Set the insertion point in the entry block.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_714' href='#L_COMPARES_714'><pre>714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock &Entry = A->getParent()->getEntryBlock();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_715' href='#L_COMPARES_715'><pre>715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder.SetInsertPoint(&*Entry.getFirstInsertionPt());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_716' href='#L_COMPARES_716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_717' href='#L_COMPARES_717'><pre>717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_718' href='#L_COMPARES_718'><pre>718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, this is a constant and we don't need to set a new</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_719' href='#L_COMPARES_719'><pre>719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // insertion point.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_720' href='#L_COMPARES_720'><pre>720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>(isa<Constant>(V) && "Setting insertion point for unknown value!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_721' href='#L_COMPARES_721'><pre>721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_722' href='#L_COMPARES_722'><pre>722</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_723' href='#L_COMPARES_723'><pre>723</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Returns a re-written value of Start as an indexed GEP using Base as a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_724' href='#L_COMPARES_724'><pre>724</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// pointer.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_725' href='#L_COMPARES_725'><pre>725</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *rewriteGEPAsOffset(Value *Start, Value *Base,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_726' href='#L_COMPARES_726'><pre>726</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const DataLayout &DL,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_727' href='#L_COMPARES_727'><pre>727</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> SetVector<Value *> &Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_728' href='#L_COMPARES_728'><pre>728</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // Perform all the substitutions. This is a bit tricky because we can</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_729' href='#L_COMPARES_729'><pre>729</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // have cycles in our use-def chains.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_730' href='#L_COMPARES_730'><pre>730</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // 1. Create the PHI nodes without any incoming values.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_731' href='#L_COMPARES_731'><pre>731</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // 2. Create all the other values.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_732' href='#L_COMPARES_732'><pre>732</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // 3. Add the edges for the PHI nodes.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_733' href='#L_COMPARES_733'><pre>733</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // 4. Emit GEPs to get the original pointers.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_734' href='#L_COMPARES_734'><pre>734</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // 5. Remove the original instructions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_735' href='#L_COMPARES_735'><pre>735</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Type *IndexType = IntegerType::get(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_736' href='#L_COMPARES_736'><pre>736</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Base->getContext(), DL.getPointerTypeSizeInBits(Start->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_737' href='#L_COMPARES_737'><pre>737</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_738' href='#L_COMPARES_738'><pre>738</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> DenseMap<Value *, Value *> NewInsts;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_739' href='#L_COMPARES_739'><pre>739</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> NewInsts[Base] = ConstantInt::getNullValue(IndexType);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_740' href='#L_COMPARES_740'><pre>740</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_741' href='#L_COMPARES_741'><pre>741</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // Create the new PHI nodes, without adding any incoming values.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_742' href='#L_COMPARES_742'><pre>742</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (Value *Val : Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_743' href='#L_COMPARES_743'><pre>743</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (Val == Base)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_744' href='#L_COMPARES_744'><pre>744</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_745' href='#L_COMPARES_745'><pre>745</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Create empty phi nodes. This avoids cyclic dependencies when creating</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_746' href='#L_COMPARES_746'><pre>746</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // the remaining instructions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_747' href='#L_COMPARES_747'><pre>747</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>64</span></div><div class='tooltip'>PHI<span class='tooltip-content'>64</span></div> = dyn_cast<PHINode>(Val))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_748' href='#L_COMPARES_748'><pre>748</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> NewInsts[PHI] = PHINode::Create(IndexType, PHI->getNumIncomingValues(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_749' href='#L_COMPARES_749'><pre>749</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> PHI->getName() + ".idx", PHI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_750' href='#L_COMPARES_750'><pre>750</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_751' href='#L_COMPARES_751'><pre>751</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> IRBuilder<> Builder(Base->getContext());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_752' href='#L_COMPARES_752'><pre>752</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_753' href='#L_COMPARES_753'><pre>753</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // Create all the other instructions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_754' href='#L_COMPARES_754'><pre>754</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (Value *Val : Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_755' href='#L_COMPARES_755'><pre>755</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_756' href='#L_COMPARES_756'><pre>756</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (NewInsts.find(Val) != NewInsts.end())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_757' href='#L_COMPARES_757'><pre>757</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_758' href='#L_COMPARES_758'><pre>758</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_759' href='#L_COMPARES_759'><pre>759</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>43</span></div><div class='tooltip'>CI<span class='tooltip-content'>43</span></div> = dyn_cast<CastInst>(Val)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_760' href='#L_COMPARES_760'><pre>760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewInsts[CI] = NewInsts[CI->getOperand(0)];</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_761' href='#L_COMPARES_761'><pre>761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_762' href='#L_COMPARES_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_763' href='#L_COMPARES_763'><pre>763</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>43</span></div><div class='tooltip'>GEP<span class='tooltip-content'>43</span></div> = dyn_cast<GEPOperator>(Val)) <div class='tooltip'>{<span class='tooltip-content'>43</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_764' href='#L_COMPARES_764'><pre>764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *Index = NewInsts[GEP->getOperand(1)] ? <span class='red'>NewInsts[GEP->getOperand(1)]</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_765' href='#L_COMPARES_765'><pre>765</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> : GEP->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_766' href='#L_COMPARES_766'><pre>766</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> setInsertionPoint(Builder, GEP);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_767' href='#L_COMPARES_767'><pre>767</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> // Indices might need to be sign extended. GEPs will magically do</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_768' href='#L_COMPARES_768'><pre>768</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> // this, but we need to do it ourselves here.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_769' href='#L_COMPARES_769'><pre>769</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> if (Index->getType()->getScalarSizeInBits() !=</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_770' href='#L_COMPARES_770'><pre>770</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> NewInsts[GEP->getOperand(0)]->getType()->getScalarSizeInBits()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_771' href='#L_COMPARES_771'><pre>771</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Index = Builder.CreateSExtOrTrunc(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_772' href='#L_COMPARES_772'><pre>772</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Index, NewInsts[GEP->getOperand(0)]->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_773' href='#L_COMPARES_773'><pre>773</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> GEP->getOperand(0)->getName() + ".sext");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_774' href='#L_COMPARES_774'><pre>774</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_775' href='#L_COMPARES_775'><pre>775</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_776' href='#L_COMPARES_776'><pre>776</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> auto *Op = NewInsts[GEP->getOperand(0)];</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_777' href='#L_COMPARES_777'><pre>777</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<ConstantInt>(Op) && <span class='tooltip-content'>43</span></div><div class='tooltip'>dyn_cast<ConstantInt>(Op)->isZero()<span class='tooltip-content'>27</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_778' href='#L_COMPARES_778'><pre>778</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> NewInsts[GEP] = Index;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_779' href='#L_COMPARES_779'><pre>779</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_780' href='#L_COMPARES_780'><pre>780</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> NewInsts[GEP] = Builder.CreateNSWAdd(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_781' href='#L_COMPARES_781'><pre>781</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> Op, Index, GEP->getOperand(0)->getName() + ".add");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_782' href='#L_COMPARES_782'><pre>782</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_783' href='#L_COMPARES_783'><pre>783</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_784' href='#L_COMPARES_784'><pre>784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<PHINode>(Val)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_785' href='#L_COMPARES_785'><pre>785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_786' href='#L_COMPARES_786'><pre>786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_787' href='#L_COMPARES_787'><pre>787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>("Unexpected instruction type");</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_788' href='#L_COMPARES_788'><pre>788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_789' href='#L_COMPARES_789'><pre>789</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_790' href='#L_COMPARES_790'><pre>790</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // Add the incoming values to the PHI nodes.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_791' href='#L_COMPARES_791'><pre>791</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (Value *Val : Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_792' href='#L_COMPARES_792'><pre>792</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (Val == Base)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_793' href='#L_COMPARES_793'><pre>793</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_794' href='#L_COMPARES_794'><pre>794</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // All the instructions have been created, we can now add edges to the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_795' href='#L_COMPARES_795'><pre>795</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // phi nodes.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_796' href='#L_COMPARES_796'><pre>796</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>64</span></div><div class='tooltip'>PHI<span class='tooltip-content'>64</span></div> = dyn_cast<PHINode>(Val)) <div class='tooltip'>{<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_797' href='#L_COMPARES_797'><pre>797</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> PHINode *NewPhi = static_cast<PHINode *>(NewInsts[PHI]);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_798' href='#L_COMPARES_798'><pre>798</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> for (unsigned I = 0, E = PHI->getNumIncomingValues(); <div class='tooltip'>I < E<span class='tooltip-content'>78</span></div>; <div class='tooltip'>++I<span class='tooltip-content'>57</span></div>) <div class='tooltip'>{<span class='tooltip-content'>57</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_799' href='#L_COMPARES_799'><pre>799</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> Value *NewIncoming = PHI->getIncomingValue(I);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_800' href='#L_COMPARES_800'><pre>800</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_801' href='#L_COMPARES_801'><pre>801</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> if (NewInsts.find(NewIncoming) != NewInsts.end())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_802' href='#L_COMPARES_802'><pre>802</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> NewIncoming = NewInsts[NewIncoming];</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_803' href='#L_COMPARES_803'><pre>803</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_804' href='#L_COMPARES_804'><pre>804</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> NewPhi->addIncoming(NewIncoming, PHI->getIncomingBlock(I));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_805' href='#L_COMPARES_805'><pre>805</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_806' href='#L_COMPARES_806'><pre>806</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_807' href='#L_COMPARES_807'><pre>807</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_808' href='#L_COMPARES_808'><pre>808</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_809' href='#L_COMPARES_809'><pre>809</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> for (Value *Val : Explored) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_810' href='#L_COMPARES_810'><pre>810</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (Val == Base)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_811' href='#L_COMPARES_811'><pre>811</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_812' href='#L_COMPARES_812'><pre>812</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_813' href='#L_COMPARES_813'><pre>813</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // Depending on the type, for external users we have to emit</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_814' href='#L_COMPARES_814'><pre>814</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // a GEP or a GEP + ptrtoint.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_815' href='#L_COMPARES_815'><pre>815</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> setInsertionPoint(Builder, Val, false);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_816' href='#L_COMPARES_816'><pre>816</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_817' href='#L_COMPARES_817'><pre>817</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // If required, create an inttoptr instruction for Base.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_818' href='#L_COMPARES_818'><pre>818</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Value *NewBase = Base;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_819' href='#L_COMPARES_819'><pre>819</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> if (!Base->getType()->isPointerTy())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_820' href='#L_COMPARES_820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NewBase = Builder.CreateBitOrPointerCast(Base, Start->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_821' href='#L_COMPARES_821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Start->getName() + "to.ptr")</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_822' href='#L_COMPARES_822'><pre>822</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_823' href='#L_COMPARES_823'><pre>823</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Value *GEP = Builder.CreateInBoundsGEP(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_824' href='#L_COMPARES_824'><pre>824</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Start->getType()->getPointerElementType(), NewBase,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_825' href='#L_COMPARES_825'><pre>825</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> makeArrayRef(NewInsts[Val]), Val->getName() + ".ptr");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_826' href='#L_COMPARES_826'><pre>826</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_827' href='#L_COMPARES_827'><pre>827</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> if (<div class='tooltip'>!Val->getType()->isPointerTy()<span class='tooltip-content'>64</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_828' href='#L_COMPARES_828'><pre>828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cast = Builder.CreatePointerCast(GEP, Val->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_829' href='#L_COMPARES_829'><pre>829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Val->getName() + ".conv");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_830' href='#L_COMPARES_830'><pre>830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> GEP = Cast;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_831' href='#L_COMPARES_831'><pre>831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_832' href='#L_COMPARES_832'><pre>832</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Val->replaceAllUsesWith(GEP);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_833' href='#L_COMPARES_833'><pre>833</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_834' href='#L_COMPARES_834'><pre>834</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_835' href='#L_COMPARES_835'><pre>835</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return NewInsts[Start];</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_836' href='#L_COMPARES_836'><pre>836</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_837' href='#L_COMPARES_837'><pre>837</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_838' href='#L_COMPARES_838'><pre>838</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Looks through GEPs, IntToPtrInsts and PtrToIntInsts in order to express</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_839' href='#L_COMPARES_839'><pre>839</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the input Value as a constant indexed GEP. Returns a pair containing</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_840' href='#L_COMPARES_840'><pre>840</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the GEPs Pointer and Index.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_841' href='#L_COMPARES_841'><pre>841</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static std::pair<Value *, Value *></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_842' href='#L_COMPARES_842'><pre>842</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre>getAsConstantIndexedAddress(Value *V, const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_843' href='#L_COMPARES_843'><pre>843</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> Type *IndexType = IntegerType::get(V->getContext(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_844' href='#L_COMPARES_844'><pre>844</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> DL.getPointerTypeSizeInBits(V->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_845' href='#L_COMPARES_845'><pre>845</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_846' href='#L_COMPARES_846'><pre>846</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> Constant *Index = ConstantInt::getNullValue(IndexType);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_847' href='#L_COMPARES_847'><pre>847</pre></a></td><td class='covered-line'><pre>34.7k</pre></td><td class='code'><pre> while (<div class='tooltip'>true<span class='tooltip-content'>34.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_848' href='#L_COMPARES_848'><pre>848</pre></a></td><td class='covered-line'><pre>34.7k</pre></td><td class='code'><pre> if (GEPOperator *<div class='tooltip'>GEP<span class='tooltip-content'>34.7k</span></div> = dyn_cast<GEPOperator>(V)) <div class='tooltip'>{<span class='tooltip-content'>23.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_849' href='#L_COMPARES_849'><pre>849</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> // We accept only inbouds GEPs here to exclude the possibility of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_850' href='#L_COMPARES_850'><pre>850</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> // overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_851' href='#L_COMPARES_851'><pre>851</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> if (!GEP->isInBounds())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_852' href='#L_COMPARES_852'><pre>852</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_853' href='#L_COMPARES_853'><pre>853</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>23.3k</span></div><div class='tooltip'>GEP->hasAllConstantIndices() && <span class='tooltip-content'>23.3k</span></div><div class='tooltip'>GEP->getNumIndices() == 1<span class='tooltip-content'>20.1k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_854' href='#L_COMPARES_854'><pre>854</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> <div class='tooltip'>GEP->getType() == V->getType()<span class='tooltip-content'>16.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_855' href='#L_COMPARES_855'><pre>855</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> V = GEP->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_856' href='#L_COMPARES_856'><pre>856</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> Constant *GEPIndex = static_cast<Constant *>(GEP->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_857' href='#L_COMPARES_857'><pre>857</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> Index = ConstantExpr::getAdd(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_858' href='#L_COMPARES_858'><pre>858</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> Index, ConstantExpr::getSExtOrBitCast(GEPIndex, IndexType));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_859' href='#L_COMPARES_859'><pre>859</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_860' href='#L_COMPARES_860'><pre>860</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_861' href='#L_COMPARES_861'><pre>861</pre></a></td><td class='covered-line'><pre>7.19k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_862' href='#L_COMPARES_862'><pre>862</pre></a></td><td class='covered-line'><pre>23.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_863' href='#L_COMPARES_863'><pre>863</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>11.3k</span></div><div class='tooltip'>CI<span class='tooltip-content'>11.3k</span></div> = dyn_cast<IntToPtrInst>(V)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_864' href='#L_COMPARES_864'><pre>864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CI->isNoopCast(DL)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_865' href='#L_COMPARES_865'><pre>865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_866' href='#L_COMPARES_866'><pre>866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>V = CI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_867' href='#L_COMPARES_867'><pre>867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_868' href='#L_COMPARES_868'><pre>868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_869' href='#L_COMPARES_869'><pre>869</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>11.3k</span></div><div class='tooltip'>CI<span class='tooltip-content'>11.3k</span></div> = dyn_cast<PtrToIntInst>(V)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_870' href='#L_COMPARES_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!CI->isNoopCast(DL)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_871' href='#L_COMPARES_871'><pre>871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_872' href='#L_COMPARES_872'><pre>872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>V = CI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_873' href='#L_COMPARES_873'><pre>873</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_874' href='#L_COMPARES_874'><pre>874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_875' href='#L_COMPARES_875'><pre>875</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_876' href='#L_COMPARES_876'><pre>876</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_877' href='#L_COMPARES_877'><pre>877</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> return {V, Index};</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_878' href='#L_COMPARES_878'><pre>878</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_879' href='#L_COMPARES_879'><pre>879</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_880' href='#L_COMPARES_880'><pre>880</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Converts (CMP GEPLHS, RHS) if this change would make RHS a constant.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_881' href='#L_COMPARES_881'><pre>881</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We can look through PHIs, GEPs and casts in order to determine a common base</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_882' href='#L_COMPARES_882'><pre>882</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// between GEPLHS and RHS.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_883' href='#L_COMPARES_883'><pre>883</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_884' href='#L_COMPARES_884'><pre>884</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ICmpInst::Predicate Cond,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_885' href='#L_COMPARES_885'><pre>885</pre></a></td><td class='covered-line'><pre>27.9k</pre></td><td class='code'><pre> const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_886' href='#L_COMPARES_886'><pre>886</pre></a></td><td class='covered-line'><pre>27.9k</pre></td><td class='code'><pre> if (!GEPLHS->hasAllConstantIndices())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_887' href='#L_COMPARES_887'><pre>887</pre></a></td><td class='covered-line'><pre>9.01k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_888' href='#L_COMPARES_888'><pre>888</pre></a></td><td class='covered-line'><pre>27.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_889' href='#L_COMPARES_889'><pre>889</pre></a></td><td class='covered-line'><pre>27.9k</pre></td><td class='code'><pre> // Make sure the pointers have the same type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_890' href='#L_COMPARES_890'><pre>890</pre></a></td><td class='covered-line'><pre>18.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>18.9k</span></div><div class='tooltip'>GEPLHS->getType() != RHS->getType()<span class='tooltip-content'>18.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_891' href='#L_COMPARES_891'><pre>891</pre></a></td><td class='covered-line'><pre>319</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_892' href='#L_COMPARES_892'><pre>892</pre></a></td><td class='covered-line'><pre>18.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_893' href='#L_COMPARES_893'><pre>893</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> Value *PtrBase, *Index;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_894' href='#L_COMPARES_894'><pre>894</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> std::tie(PtrBase, Index) = getAsConstantIndexedAddress(GEPLHS, DL);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_895' href='#L_COMPARES_895'><pre>895</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_896' href='#L_COMPARES_896'><pre>896</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // The set of nodes that will take part in this transformation.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_897' href='#L_COMPARES_897'><pre>897</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> SetVector<Value *> Nodes;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_898' href='#L_COMPARES_898'><pre>898</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_899' href='#L_COMPARES_899'><pre>899</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> if (!canRewriteGEPAsOffset(RHS, PtrBase, DL, Nodes))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_900' href='#L_COMPARES_900'><pre>900</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_901' href='#L_COMPARES_901'><pre>901</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_902' href='#L_COMPARES_902'><pre>902</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // We know we can re-write this as</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_903' href='#L_COMPARES_903'><pre>903</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_904' href='#L_COMPARES_904'><pre>904</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // Since we've only looked through inbouds GEPs we know that we</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_905' href='#L_COMPARES_905'><pre>905</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // can't have overflow on either side. We can therefore re-write</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_906' href='#L_COMPARES_906'><pre>906</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // this as:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_907' href='#L_COMPARES_907'><pre>907</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> // OFFSET1 cmp OFFSET2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_908' href='#L_COMPARES_908'><pre>908</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Value *NewRHS = rewriteGEPAsOffset(RHS, PtrBase, DL, Nodes);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_909' href='#L_COMPARES_909'><pre>909</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_910' href='#L_COMPARES_910'><pre>910</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // RewriteGEPAsOffset has replaced RHS and all of its uses with a re-written</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_911' href='#L_COMPARES_911'><pre>911</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // GEP having PtrBase as the pointer base, and has returned in NewRHS the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_912' href='#L_COMPARES_912'><pre>912</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // offset. Since Index is the offset of LHS to the base pointer, we will now</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_913' href='#L_COMPARES_913'><pre>913</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // compare the offsets instead of comparing the pointers.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_914' href='#L_COMPARES_914'><pre>914</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Index, NewRHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_915' href='#L_COMPARES_915'><pre>915</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_916' href='#L_COMPARES_916'><pre>916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_917' href='#L_COMPARES_917'><pre>917</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold comparisons between a GEP instruction and something else. At this point</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_918' href='#L_COMPARES_918'><pre>918</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// we know that the GEP is on the LHS of the comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_919' href='#L_COMPARES_919'><pre>919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_920' href='#L_COMPARES_920'><pre>920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ICmpInst::Predicate Cond,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_921' href='#L_COMPARES_921'><pre>921</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> Instruction &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_922' href='#L_COMPARES_922'><pre>922</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // Don't transform signed compares of GEPs into index compares. Even if the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_923' href='#L_COMPARES_923'><pre>923</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // GEP is inbounds, the final add of the base pointer can have signed overflow</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_924' href='#L_COMPARES_924'><pre>924</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // and would change the result of the icmp.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_925' href='#L_COMPARES_925'><pre>925</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // e.g. "&foo[0] <s &foo[1]" can't be folded to "true" because "foo" could be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_926' href='#L_COMPARES_926'><pre>926</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // the maximum signed value for the pointer type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_927' href='#L_COMPARES_927'><pre>927</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> if (ICmpInst::isSigned(Cond))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_928' href='#L_COMPARES_928'><pre>928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_929' href='#L_COMPARES_929'><pre>929</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_930' href='#L_COMPARES_930'><pre>930</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // Look through bitcasts and addrspacecasts. We do not however want to remove</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_931' href='#L_COMPARES_931'><pre>931</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // 0 GEPs.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_932' href='#L_COMPARES_932'><pre>932</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.1k</span></div><div class='tooltip'>!isa<GetElementPtrInst>(RHS)<span class='tooltip-content'>28.1k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_933' href='#L_COMPARES_933'><pre>933</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> RHS = RHS->stripPointerCasts();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_934' href='#L_COMPARES_934'><pre>934</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_935' href='#L_COMPARES_935'><pre>935</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> Value *PtrBase = GEPLHS->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_936' href='#L_COMPARES_936'><pre>936</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>PtrBase == RHS && <span class='tooltip-content'>28.1k</span></div><div class='tooltip'>GEPLHS->isInBounds()<span class='tooltip-content'>84</span></div>) <div class='tooltip'>{<span class='tooltip-content'>84</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_937' href='#L_COMPARES_937'><pre>937</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_938' href='#L_COMPARES_938'><pre>938</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // This transformation (ignoring the base and scales) is valid because we</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_939' href='#L_COMPARES_939'><pre>939</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // know pointers can't overflow since the gep is inbounds. See if we can</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_940' href='#L_COMPARES_940'><pre>940</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // output an optimized form.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_941' href='#L_COMPARES_941'><pre>941</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> Value *Offset = evaluateGEPOffsetExpression(GEPLHS, *this, DL);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_942' href='#L_COMPARES_942'><pre>942</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_943' href='#L_COMPARES_943'><pre>943</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> // If not, synthesize the offset the hard way.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_944' href='#L_COMPARES_944'><pre>944</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> if (!Offset)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_945' href='#L_COMPARES_945'><pre>945</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Offset = EmitGEPOffset(GEPLHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_946' href='#L_COMPARES_946'><pre>946</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_947' href='#L_COMPARES_947'><pre>947</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> Constant::getNullValue(Offset->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_948' href='#L_COMPARES_948'><pre>948</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (GEPOperator *<span class='tooltip-content'>28.0k</span></div><div class='tooltip'>GEPRHS<span class='tooltip-content'>28.0k</span></div> = dyn_cast<GEPOperator>(RHS)) <div class='tooltip'>{<span class='tooltip-content'>12.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_949' href='#L_COMPARES_949'><pre>949</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // If the base pointers are different, but the indices are the same, just</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_950' href='#L_COMPARES_950'><pre>950</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // compare the base pointer.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_951' href='#L_COMPARES_951'><pre>951</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>PtrBase != GEPRHS->getOperand(0)<span class='tooltip-content'>12.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_952' href='#L_COMPARES_952'><pre>952</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> bool IndicesTheSame = GEPLHS->getNumOperands()==GEPRHS->getNumOperands();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_953' href='#L_COMPARES_953'><pre>953</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> IndicesTheSame &= GEPLHS->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_954' href='#L_COMPARES_954'><pre>954</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> GEPRHS->getOperand(0)->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_955' href='#L_COMPARES_955'><pre>955</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> if (IndicesTheSame)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_956' href='#L_COMPARES_956'><pre>956</pre></a></td><td class='covered-line'><pre>7.16k</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 1, e = GEPLHS->getNumOperands(); <span class='tooltip-content'>7.12k</span></div><div class='tooltip'>i != e<span class='tooltip-content'>7.16k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>42</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_957' href='#L_COMPARES_957'><pre>957</pre></a></td><td class='covered-line'><pre>7.14k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.14k</span></div><div class='tooltip'>GEPLHS->getOperand(i) != GEPRHS->getOperand(i)<span class='tooltip-content'>7.14k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7.10k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_958' href='#L_COMPARES_958'><pre>958</pre></a></td><td class='covered-line'><pre>7.10k</pre></td><td class='code'><pre> IndicesTheSame = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_959' href='#L_COMPARES_959'><pre>959</pre></a></td><td class='covered-line'><pre>7.10k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_960' href='#L_COMPARES_960'><pre>960</pre></a></td><td class='covered-line'><pre>7.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_961' href='#L_COMPARES_961'><pre>961</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_962' href='#L_COMPARES_962'><pre>962</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // If all indices are the same, just compare the base pointers.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_963' href='#L_COMPARES_963'><pre>963</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> if (IndicesTheSame)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_964' href='#L_COMPARES_964'><pre>964</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> return new ICmpInst(Cond, GEPLHS->getOperand(0), GEPRHS->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_965' href='#L_COMPARES_965'><pre>965</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_966' href='#L_COMPARES_966'><pre>966</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // If we're comparing GEPs with two base pointers that only differ in type</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_967' href='#L_COMPARES_967'><pre>967</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // and both GEPs have only constant indices or just one use, then fold</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_968' href='#L_COMPARES_968'><pre>968</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // the compare with the adjusted indices.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_969' href='#L_COMPARES_969'><pre>969</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.8k</span></div><div class='tooltip'>GEPLHS->isInBounds() && <span class='tooltip-content'>12.8k</span></div><div class='tooltip'>GEPRHS->isInBounds()<span class='tooltip-content'>12.8k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_970' href='#L_COMPARES_970'><pre>970</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> <div class='tooltip'>(GEPLHS->hasAllConstantIndices() || <span class='tooltip-content'>12.8k</span></div><div class='tooltip'>GEPLHS->hasOneUse()<span class='tooltip-content'>4.50k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_971' href='#L_COMPARES_971'><pre>971</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> <div class='tooltip'>(GEPRHS->hasAllConstantIndices() || <span class='tooltip-content'>8.94k</span></div><div class='tooltip'>GEPRHS->hasOneUse()<span class='tooltip-content'>2.78k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_972' href='#L_COMPARES_972'><pre>972</pre></a></td><td class='covered-line'><pre>6.71k</pre></td><td class='code'><pre> PtrBase->stripPointerCasts() ==</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_973' href='#L_COMPARES_973'><pre>973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> GEPRHS->getOperand(0)->stripPointerCasts()) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_974' href='#L_COMPARES_974'><pre>974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *LOffset = EmitGEPOffset(GEPLHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_975' href='#L_COMPARES_975'><pre>975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ROffset = EmitGEPOffset(GEPRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_976' href='#L_COMPARES_976'><pre>976</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_977' href='#L_COMPARES_977'><pre>977</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we looked through an addrspacecast between different sized address</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_978' href='#L_COMPARES_978'><pre>978</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // spaces, the LHS and RHS pointers are different sized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_979' href='#L_COMPARES_979'><pre>979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // integers. Truncate to the smaller one.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_980' href='#L_COMPARES_980'><pre>980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *LHSIndexTy = LOffset->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_981' href='#L_COMPARES_981'><pre>981</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *RHSIndexTy = ROffset->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_982' href='#L_COMPARES_982'><pre>982</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>LHSIndexTy != RHSIndexTy</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_983' href='#L_COMPARES_983'><pre>983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>LHSIndexTy->getPrimitiveSizeInBits() <</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_984' href='#L_COMPARES_984'><pre>984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHSIndexTy->getPrimitiveSizeInBits()</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_985' href='#L_COMPARES_985'><pre>985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ROffset = Builder->CreateTrunc(ROffset, LHSIndexTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_986' href='#L_COMPARES_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_987' href='#L_COMPARES_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LOffset = Builder->CreateTrunc(LOffset, RHSIndexTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_988' href='#L_COMPARES_988'><pre>988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_989' href='#L_COMPARES_989'><pre>989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_990' href='#L_COMPARES_990'><pre>990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cmp = Builder->CreateICmp(ICmpInst::getSignedPredicate(Cond),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_991' href='#L_COMPARES_991'><pre>991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LOffset, ROffset);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_992' href='#L_COMPARES_992'><pre>992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Cmp);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_993' href='#L_COMPARES_993'><pre>993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_994' href='#L_COMPARES_994'><pre>994</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_995' href='#L_COMPARES_995'><pre>995</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // Otherwise, the base pointers are different and the indices are</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_996' href='#L_COMPARES_996'><pre>996</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // different. Try convert this to an indexed compare by looking through</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_997' href='#L_COMPARES_997'><pre>997</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // PHIs/casts.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_998' href='#L_COMPARES_998'><pre>998</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> return transformToIndexedCompare(GEPLHS, RHS, Cond, DL);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_999' href='#L_COMPARES_999'><pre>999</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1000' href='#L_COMPARES_1000'><pre>1000</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1001' href='#L_COMPARES_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> // If one of the GEPs has all zero indices, recurse.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1002' href='#L_COMPARES_1002'><pre>1002</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15</span></div><div class='tooltip'>GEPLHS->hasAllZeroIndices()<span class='tooltip-content'>15</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1003' href='#L_COMPARES_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return foldGEPICmp(GEPRHS, GEPLHS->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1004' href='#L_COMPARES_1004'><pre>1004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ICmpInst::getSwappedPredicate(Cond), I)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1005' href='#L_COMPARES_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1006' href='#L_COMPARES_1006'><pre>1006</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // If the other GEP has all zero indices, recurse.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1007' href='#L_COMPARES_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15</span></div><div class='tooltip'>GEPRHS->hasAllZeroIndices()<span class='tooltip-content'>15</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1008' href='#L_COMPARES_1008'><pre>1008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return foldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1009' href='#L_COMPARES_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1010' href='#L_COMPARES_1010'><pre>1010</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>bool GEPsInBounds = GEPLHS->isInBounds() && <span class='tooltip-content'>15</span></div><div class='tooltip'>GEPRHS->isInBounds()<span class='tooltip-content'>15</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1011' href='#L_COMPARES_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (<div class='tooltip'>GEPLHS->getNumOperands() == GEPRHS->getNumOperands()<span class='tooltip-content'>15</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1012' href='#L_COMPARES_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // If the GEPs only differ by one index, compare it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1013' href='#L_COMPARES_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> unsigned NumDifferences = 0; // Keep track of # differences.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1014' href='#L_COMPARES_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> unsigned DiffOperand = 0; // The operand that differs.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1015' href='#L_COMPARES_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> for (unsigned i = 1, e = GEPRHS->getNumOperands(); <div class='tooltip'>i != e<span class='tooltip-content'>42</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>27</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1016' href='#L_COMPARES_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>27</span></div><div class='tooltip'>GEPLHS->getOperand(i) != GEPRHS->getOperand(i)<span class='tooltip-content'>27</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1017' href='#L_COMPARES_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() !=</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1018' href='#L_COMPARES_1018'><pre>1018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1019' href='#L_COMPARES_1019'><pre>1019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Irreconcilable differences.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1020' href='#L_COMPARES_1020'><pre>1020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NumDifferences = 2;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1021' href='#L_COMPARES_1021'><pre>1021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1022' href='#L_COMPARES_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1023' href='#L_COMPARES_1023'><pre>1023</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (<div class='tooltip'>NumDifferences++<span class='tooltip-content'>15</span></div>) <div class='tooltip'><span class='red'>break</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1024' href='#L_COMPARES_1024'><pre>1024</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> DiffOperand = i;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1025' href='#L_COMPARES_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1026' href='#L_COMPARES_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1027' href='#L_COMPARES_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1028' href='#L_COMPARES_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (NumDifferences == 0) // SAME GEP?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1029' href='#L_COMPARES_1029'><pre>1029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, // No comparison is needed here.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1030' href='#L_COMPARES_1030'><pre>1030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt1(ICmpInst::isTrueWhenEqual(Cond)))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1031' href='#L_COMPARES_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1032' href='#L_COMPARES_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>15</span></div><div class='tooltip'>NumDifferences == 1 && <span class='tooltip-content'>15</span></div><div class='tooltip'>GEPsInBounds<span class='tooltip-content'>15</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1033' href='#L_COMPARES_1033'><pre>1033</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *LHSV = GEPLHS->getOperand(DiffOperand);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1034' href='#L_COMPARES_1034'><pre>1034</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *RHSV = GEPRHS->getOperand(DiffOperand);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1035' href='#L_COMPARES_1035'><pre>1035</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // Make sure we do a signed comparison here.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1036' href='#L_COMPARES_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1037' href='#L_COMPARES_1037'><pre>1037</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1038' href='#L_COMPARES_1038'><pre>1038</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1039' href='#L_COMPARES_1039'><pre>1039</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1040' href='#L_COMPARES_1040'><pre>1040</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // Only lower this if the icmp is the only user of the GEP or if we expect</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1041' href='#L_COMPARES_1041'><pre>1041</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // the result to fold to a constant!</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1042' href='#L_COMPARES_1042'><pre>1042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>GEPsInBounds && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(isa<ConstantExpr>(GEPLHS) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>GEPLHS->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1043' href='#L_COMPARES_1043'><pre>1043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(isa<ConstantExpr>(GEPRHS) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>GEPRHS->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1044' href='#L_COMPARES_1044'><pre>1044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2) ---> (OFFSET1 cmp OFFSET2)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1045' href='#L_COMPARES_1045'><pre>1045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *L = EmitGEPOffset(GEPLHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1046' href='#L_COMPARES_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *R = EmitGEPOffset(GEPRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1047' href='#L_COMPARES_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1048' href='#L_COMPARES_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1049' href='#L_COMPARES_1049'><pre>1049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1050' href='#L_COMPARES_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1051' href='#L_COMPARES_1051'><pre>1051</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // Try convert this to an indexed compare by looking through PHIs/casts as a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1052' href='#L_COMPARES_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> // last resort.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1053' href='#L_COMPARES_1053'><pre>1053</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> return transformToIndexedCompare(GEPLHS, RHS, Cond, DL);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1054' href='#L_COMPARES_1054'><pre>1054</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1055' href='#L_COMPARES_1055'><pre>1055</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1056' href='#L_COMPARES_1056'><pre>1056</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldAllocaCmp(ICmpInst &ICI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1057' href='#L_COMPARES_1057'><pre>1057</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const AllocaInst *Alloca,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1058' href='#L_COMPARES_1058'><pre>1058</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> const Value *Other) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1059' href='#L_COMPARES_1059'><pre>1059</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> assert(ICI.isEquality() && "Cannot fold non-equality comparison.");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1060' href='#L_COMPARES_1060'><pre>1060</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1061' href='#L_COMPARES_1061'><pre>1061</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // It would be tempting to fold away comparisons between allocas and any</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1062' href='#L_COMPARES_1062'><pre>1062</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // pointer not based on that alloca (e.g. an argument). However, even</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1063' href='#L_COMPARES_1063'><pre>1063</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // though such pointers cannot alias, they can still compare equal.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1064' href='#L_COMPARES_1064'><pre>1064</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1065' href='#L_COMPARES_1065'><pre>1065</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // But LLVM doesn't specify where allocas get their memory, so if the alloca</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1066' href='#L_COMPARES_1066'><pre>1066</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // doesn't escape we can argue that it's impossible to guess its value, and we</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1067' href='#L_COMPARES_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // can therefore act as if any such guesses are wrong.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1068' href='#L_COMPARES_1068'><pre>1068</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1069' href='#L_COMPARES_1069'><pre>1069</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // The code below checks that the alloca doesn't escape, and that it's only</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1070' href='#L_COMPARES_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // used in a comparison once (the current instruction). The</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1071' href='#L_COMPARES_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // single-comparison-use condition ensures that we're trivially folding all</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1072' href='#L_COMPARES_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // comparisons against the alloca consistently, and avoids the risk of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1073' href='#L_COMPARES_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // erroneously folding a comparison of the pointer with itself.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1074' href='#L_COMPARES_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1075' href='#L_COMPARES_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> unsigned MaxIter = 32; // Break cycles and bound to constant-time.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1076' href='#L_COMPARES_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1077' href='#L_COMPARES_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> SmallVector<const Use *, 32> Worklist;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1078' href='#L_COMPARES_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> for (const Use &U : Alloca->uses()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1079' href='#L_COMPARES_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> if (Worklist.size() >= MaxIter)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1080' href='#L_COMPARES_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1081' href='#L_COMPARES_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>24.3k</pre></td><td class='code'><pre> Worklist.push_back(&U);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1082' href='#L_COMPARES_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>24.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1083' href='#L_COMPARES_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1084' href='#L_COMPARES_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> unsigned NumCmps = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1085' href='#L_COMPARES_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> while (<div class='tooltip'>!Worklist.empty()<span class='tooltip-content'>13.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1086' href='#L_COMPARES_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> assert(Worklist.size() <= MaxIter);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1087' href='#L_COMPARES_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> const Use *U = Worklist.pop_back_val();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1088' href='#L_COMPARES_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> const Value *V = U->getUser();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1089' href='#L_COMPARES_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> --MaxIter;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1090' href='#L_COMPARES_1090'><pre>1090</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1091' href='#L_COMPARES_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>13.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<BitCastInst>(V) || <span class='tooltip-content'>13.7k</span></div><div class='tooltip'>isa<GetElementPtrInst>(V)<span class='tooltip-content'>12.1k</span></div> || <div class='tooltip'>isa<PHINode>(V)<span class='tooltip-content'>8.32k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1092' href='#L_COMPARES_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>7.00k</pre></td><td class='code'><pre> <div class='tooltip'>isa<SelectInst>(V)<span class='tooltip-content'>7.00k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.72k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1093' href='#L_COMPARES_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>6.72k</pre></td><td class='code'><pre> // Track the uses.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1094' href='#L_COMPARES_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>7.00k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>7.00k</span></div><div class='tooltip'>isa<LoadInst>(V)<span class='tooltip-content'>7.00k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>142</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1095' href='#L_COMPARES_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> // Loading from the pointer doesn't escape it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1096' href='#L_COMPARES_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1097' href='#L_COMPARES_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>6.85k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (const auto *<span class='tooltip-content'>6.85k</span></div><div class='tooltip'>SI<span class='tooltip-content'>6.85k</span></div> = dyn_cast<StoreInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>890</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1098' href='#L_COMPARES_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>890</pre></td><td class='code'><pre> // Storing *to* the pointer is fine, but storing the pointer escapes it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1099' href='#L_COMPARES_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>890</pre></td><td class='code'><pre> if (SI->getValueOperand() == U->get())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1100' href='#L_COMPARES_1100'><pre>1100</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1101' href='#L_COMPARES_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>880</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1102' href='#L_COMPARES_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>5.96k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>5.96k</span></div><div class='tooltip'>isa<ICmpInst>(V)<span class='tooltip-content'>5.96k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.14k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1103' href='#L_COMPARES_1103'><pre>1103</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> if (NumCmps++)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1104' href='#L_COMPARES_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>543</pre></td><td class='code'><pre> return nullptr; // Found more than one cmp.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1105' href='#L_COMPARES_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>605</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1106' href='#L_COMPARES_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>4.82k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (const auto *<span class='tooltip-content'>4.82k</span></div><div class='tooltip'>Intrin<span class='tooltip-content'>4.82k</span></div> = dyn_cast<IntrinsicInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>3.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1107' href='#L_COMPARES_1107'><pre>1107</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> switch (Intrin->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1108' href='#L_COMPARES_1108'><pre>1108</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> // These intrinsics don't escape or compare the pointer. Memset is safe</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1109' href='#L_COMPARES_1109'><pre>1109</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> // because we don't allow ptrtoint. Memcpy and memmove are safe because</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1110' href='#L_COMPARES_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> // we don't allow stores, so src cannot point to V.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1111' href='#L_COMPARES_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> <div class='tooltip'>case Intrinsic::lifetime_start: <span class='tooltip-content'>3.96k</span></div><div class='tooltip'>case Intrinsic::lifetime_end:<span class='tooltip-content'>3.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1112' href='#L_COMPARES_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> <div class='tooltip'>case Intrinsic::dbg_declare: <span class='tooltip-content'>3.96k</span></div><div class='tooltip'>case Intrinsic::dbg_value:<span class='tooltip-content'>3.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1113' href='#L_COMPARES_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> <div class='tooltip'>case Intrinsic::memcpy: <span class='tooltip-content'>3.96k</span></div><div class='tooltip'>case Intrinsic::memmove: <span class='tooltip-content'>3.96k</span></div><div class='tooltip'>case Intrinsic::memset:<span class='tooltip-content'>3.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1114' href='#L_COMPARES_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1115' href='#L_COMPARES_1115'><pre>1115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1116' href='#L_COMPARES_1116'><pre>1116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1117' href='#L_COMPARES_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1118' href='#L_COMPARES_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>859</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1119' href='#L_COMPARES_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>859</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1120' href='#L_COMPARES_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>859</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1121' href='#L_COMPARES_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>15.7k</pre></td><td class='code'><pre> <div class='tooltip'>for (const Use &U : V->uses()) <span class='tooltip-content'>6.72k</span></div><div class='tooltip'>{<span class='tooltip-content'>15.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1122' href='#L_COMPARES_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>15.7k</pre></td><td class='code'><pre> if (Worklist.size() >= MaxIter)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1123' href='#L_COMPARES_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>338</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1124' href='#L_COMPARES_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> Worklist.push_back(&U);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1125' href='#L_COMPARES_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1126' href='#L_COMPARES_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>6.72k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1127' href='#L_COMPARES_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1128' href='#L_COMPARES_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Type *CmpTy = CmpInst::makeCmpResultType(Other->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1129' href='#L_COMPARES_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1130' href='#L_COMPARES_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> ICI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1131' href='#L_COMPARES_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> ConstantInt::get(CmpTy, !CmpInst::isTrueWhenEqual(ICI.getPredicate())));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1132' href='#L_COMPARES_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1133' href='#L_COMPARES_1133'><pre>1133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1134' href='#L_COMPARES_1134'><pre>1134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold "icmp pred (X+CI), X".</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1135' href='#L_COMPARES_1135'><pre>1135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpAddOpConst(Instruction &ICI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1136' href='#L_COMPARES_1136'><pre>1136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *X, ConstantInt *CI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1137' href='#L_COMPARES_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ICmpInst::Predicate Pred) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1138' href='#L_COMPARES_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // From this point on, we know that (X+C <= X) --> (X+C < X) because C != 0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1139' href='#L_COMPARES_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // so the values can never be equal. Similarly for all other "or equals"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1140' href='#L_COMPARES_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // operators.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1141' href='#L_COMPARES_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1142' href='#L_COMPARES_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+1) <u X --> X >u (MAXUINT-1) --> X == 255</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1143' href='#L_COMPARES_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+2) <u X --> X >u (MAXUINT-2) --> X > 253</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1144' href='#L_COMPARES_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MAXUINT) <u X --> X >u (MAXUINT-MAXUINT) --> X != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1145' href='#L_COMPARES_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_ULT || <span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULE<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1146' href='#L_COMPARES_1146'><pre>1146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *R =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1147' href='#L_COMPARES_1147'><pre>1147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantExpr::getSub(ConstantInt::getAllOnesValue(CI->getType()), CI);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1148' href='#L_COMPARES_1148'><pre>1148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_UGT, X, R);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1149' href='#L_COMPARES_1149'><pre>1149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1150' href='#L_COMPARES_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1151' href='#L_COMPARES_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+1) >u X --> X <u (0-1) --> X != 255</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1152' href='#L_COMPARES_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+2) >u X --> X <u (0-2) --> X <u 254</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1153' href='#L_COMPARES_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MAXUINT) >u X --> X <u (0-MAXUINT) --> X <u 1 --> X == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1154' href='#L_COMPARES_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGT || <span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGE<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1155' href='#L_COMPARES_1155'><pre>1155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantExpr::getNeg(CI))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1156' href='#L_COMPARES_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1157' href='#L_COMPARES_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned BitWidth = CI->getType()->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1158' href='#L_COMPARES_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt *SMax = ConstantInt::get(X->getContext(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1159' href='#L_COMPARES_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt::getSignedMaxValue(BitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1160' href='#L_COMPARES_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1161' href='#L_COMPARES_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ 1) <s X --> X >s (MAXSINT-1) --> X == 127</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1162' href='#L_COMPARES_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ 2) <s X --> X >s (MAXSINT-2) --> X >s 125</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1163' href='#L_COMPARES_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MAXSINT) <s X --> X >s (MAXSINT-MAXSINT) --> X >s 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1164' href='#L_COMPARES_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MINSINT) <s X --> X >s (MAXSINT-MINSINT) --> X >s -1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1165' href='#L_COMPARES_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ -2) <s X --> X >s (MAXSINT- -2) --> X >s 126</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1166' href='#L_COMPARES_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ -1) <s X --> X >s (MAXSINT- -1) --> X != 127</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1167' href='#L_COMPARES_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SLT || <span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLE<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1168' href='#L_COMPARES_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGT, X, ConstantExpr::getSub(SMax, CI));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1169' href='#L_COMPARES_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1170' href='#L_COMPARES_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ 1) >s X --> X <s (MAXSINT-(1-1)) --> X != 127</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1171' href='#L_COMPARES_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ 2) >s X --> X <s (MAXSINT-(2-1)) --> X <s 126</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1172' href='#L_COMPARES_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MAXSINT) >s X --> X <s (MAXSINT-(MAXSINT-1)) --> X <s 1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1173' href='#L_COMPARES_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+MINSINT) >s X --> X <s (MAXSINT-(MINSINT-1)) --> X <s -2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1174' href='#L_COMPARES_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ -2) >s X --> X <s (MAXSINT-(-2-1)) --> X <s -126</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1175' href='#L_COMPARES_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X+ -1) >s X --> X <s (MAXSINT-(-1-1)) --> X == -128</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1176' href='#L_COMPARES_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1177' href='#L_COMPARES_1177'><pre>1177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> assert<span class='red'>(Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1178' href='#L_COMPARES_1178'><pre>1178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C = Builder->getInt(CI->getValue()-1);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1179' href='#L_COMPARES_1179'><pre>1179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantExpr::getSub(SMax, C))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1180' href='#L_COMPARES_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1181' href='#L_COMPARES_1181'><pre>1181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1182' href='#L_COMPARES_1182'><pre>1182</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Handle "(icmp eq/ne (ashr/lshr AP2, A), AP1)" -></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1183' href='#L_COMPARES_1183'><pre>1183</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp eq/ne A, Log2(AP2/AP1)) -></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1184' href='#L_COMPARES_1184'><pre>1184</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp eq/ne A, Log2(AP2) - Log2(AP1)).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1185' href='#L_COMPARES_1185'><pre>1185</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpShrConstConst(ICmpInst &I, Value *A,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1186' href='#L_COMPARES_1186'><pre>1186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APInt &AP1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1187' href='#L_COMPARES_1187'><pre>1187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const APInt &AP2) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1188' href='#L_COMPARES_1188'><pre>1188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(I.isEquality() && "Cannot fold icmp gt/lt");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1189' href='#L_COMPARES_1189'><pre>1189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1190' href='#L_COMPARES_1190'><pre>1190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1191' href='#L_COMPARES_1191'><pre>1191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I.getPredicate() == I.ICMP_NE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1192' href='#L_COMPARES_1192'><pre>1192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = CmpInst::getInversePredicate(Pred)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1193' href='#L_COMPARES_1193'><pre>1193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1194' href='#L_COMPARES_1194'><pre>1194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1195' href='#L_COMPARES_1195'><pre>1195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1196' href='#L_COMPARES_1196'><pre>1196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't bother doing any work for cases which InstSimplify handles.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1197' href='#L_COMPARES_1197'><pre>1197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>AP2 == 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1198' href='#L_COMPARES_1198'><pre>1198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1199' href='#L_COMPARES_1199'><pre>1199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1200' href='#L_COMPARES_1200'><pre>1200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>bool IsAShr = isa<AShrOperator>(I.getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1201' href='#L_COMPARES_1201'><pre>1201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsAShr</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1202' href='#L_COMPARES_1202'><pre>1202</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>AP2.isAllOnesValue()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1203' href='#L_COMPARES_1203'><pre>1203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1204' href='#L_COMPARES_1204'><pre>1204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP2.isNegative() != AP1.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1205' href='#L_COMPARES_1205'><pre>1205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1206' href='#L_COMPARES_1206'><pre>1206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP2.sgt(AP1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1207' href='#L_COMPARES_1207'><pre>1207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1208' href='#L_COMPARES_1208'><pre>1208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1209' href='#L_COMPARES_1209'><pre>1209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1210' href='#L_COMPARES_1210'><pre>1210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!AP1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1211' href='#L_COMPARES_1211'><pre>1211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // 'A' must be large enough to shift out the highest set bit.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1212' href='#L_COMPARES_1212'><pre>1212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return getICmp(I.ICMP_UGT, A,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1213' href='#L_COMPARES_1213'><pre>1213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(A->getType(), AP2.logBase2()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1214' href='#L_COMPARES_1214'><pre>1214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1215' href='#L_COMPARES_1215'><pre>1215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP1 == AP2</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1216' href='#L_COMPARES_1216'><pre>1216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return getICmp(I.ICMP_EQ, A, ConstantInt::getNullValue(A->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1217' href='#L_COMPARES_1217'><pre>1217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1218' href='#L_COMPARES_1218'><pre>1218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>int Shift;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1219' href='#L_COMPARES_1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsAShr && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP1.isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1220' href='#L_COMPARES_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Shift = AP1.countLeadingOnes() - AP2.countLeadingOnes()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1221' href='#L_COMPARES_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1222' href='#L_COMPARES_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Shift = AP1.countLeadingZeros() - AP2.countLeadingZeros()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1223' href='#L_COMPARES_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1224' href='#L_COMPARES_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Shift > 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1225' href='#L_COMPARES_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsAShr && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP1 == AP2.ashr(Shift)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1226' href='#L_COMPARES_1226'><pre>1226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // There are multiple solutions if we are comparing against -1 and the LHS</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1227' href='#L_COMPARES_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // of the ashr is not a power of two.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1228' href='#L_COMPARES_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>AP1.isAllOnesValue() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!AP2.isPowerOf2()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1229' href='#L_COMPARES_1229'><pre>1229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return getICmp(I.ICMP_UGE, A, ConstantInt::get(A->getType(), Shift))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1230' href='#L_COMPARES_1230'><pre>1230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1231' href='#L_COMPARES_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AP1 == AP2.lshr(Shift)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1232' href='#L_COMPARES_1232'><pre>1232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1233' href='#L_COMPARES_1233'><pre>1233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1234' href='#L_COMPARES_1234'><pre>1234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1235' href='#L_COMPARES_1235'><pre>1235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1236' href='#L_COMPARES_1236'><pre>1236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Shifting const2 will never be equal to const1.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1237' href='#L_COMPARES_1237'><pre>1237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME: This should always be handled by InstSimplify?</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1238' href='#L_COMPARES_1238'><pre>1238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *TorF = ConstantInt::get(I.getType(), I.getPredicate() == I.ICMP_NE);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1239' href='#L_COMPARES_1239'><pre>1239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, TorF)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1240' href='#L_COMPARES_1240'><pre>1240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1241' href='#L_COMPARES_1241'><pre>1241</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1242' href='#L_COMPARES_1242'><pre>1242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Handle "(icmp eq/ne (shl AP2, A), AP1)" -></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1243' href='#L_COMPARES_1243'><pre>1243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (icmp eq/ne A, TrailingZeros(AP1) - TrailingZeros(AP2)).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1244' href='#L_COMPARES_1244'><pre>1244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpShlConstConst(ICmpInst &I, Value *A,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1245' href='#L_COMPARES_1245'><pre>1245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APInt &AP1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1246' href='#L_COMPARES_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> const APInt &AP2) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1247' href='#L_COMPARES_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> assert(I.isEquality() && "Cannot fold icmp gt/lt");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1248' href='#L_COMPARES_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1249' href='#L_COMPARES_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> auto getICmp = [&I](CmpInst::Predicate Pred, Value *LHS, Value *RHS) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1250' href='#L_COMPARES_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (I.getPredicate() == I.ICMP_NE)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1251' href='#L_COMPARES_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Pred = CmpInst::getInversePredicate(Pred);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1252' href='#L_COMPARES_1252'><pre>1252</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(Pred, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1253' href='#L_COMPARES_1253'><pre>1253</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1254' href='#L_COMPARES_1254'><pre>1254</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1255' href='#L_COMPARES_1255'><pre>1255</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Don't bother doing any work for cases which InstSimplify handles.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1256' href='#L_COMPARES_1256'><pre>1256</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (AP2 == 0)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1257' href='#L_COMPARES_1257'><pre>1257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1258' href='#L_COMPARES_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1259' href='#L_COMPARES_1259'><pre>1259</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> unsigned AP2TrailingZeros = AP2.countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1260' href='#L_COMPARES_1260'><pre>1260</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1261' href='#L_COMPARES_1261'><pre>1261</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>!AP1 && <span class='tooltip-content'>2</span></div><div class='tooltip'>AP2TrailingZeros != 0<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1262' href='#L_COMPARES_1262'><pre>1262</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return getICmp(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1263' href='#L_COMPARES_1263'><pre>1263</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> I.ICMP_UGE, A,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1264' href='#L_COMPARES_1264'><pre>1264</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt::get(A->getType(), AP2.getBitWidth() - AP2TrailingZeros));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1265' href='#L_COMPARES_1265'><pre>1265</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1266' href='#L_COMPARES_1266'><pre>1266</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>AP1 == AP2<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1267' href='#L_COMPARES_1267'><pre>1267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return getICmp(I.ICMP_EQ, A, ConstantInt::getNullValue(A->getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1268' href='#L_COMPARES_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1269' href='#L_COMPARES_1269'><pre>1269</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Get the distance between the lowest bits that are set.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1270' href='#L_COMPARES_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> int Shift = AP1.countTrailingZeros() - AP2TrailingZeros;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1271' href='#L_COMPARES_1271'><pre>1271</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1272' href='#L_COMPARES_1272'><pre>1272</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Shift > 0 && <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>AP2.shl(Shift) == AP1</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1273' href='#L_COMPARES_1273'><pre>1273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1274' href='#L_COMPARES_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1275' href='#L_COMPARES_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Shifting const2 will never be equal to const1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1276' href='#L_COMPARES_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // FIXME: This should always be handled by InstSimplify?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1277' href='#L_COMPARES_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> auto *TorF = ConstantInt::get(I.getType(), I.getPredicate() == I.ICMP_NE);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1278' href='#L_COMPARES_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, TorF);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1279' href='#L_COMPARES_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1280' href='#L_COMPARES_1280'><pre>1280</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1281' href='#L_COMPARES_1281'><pre>1281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The caller has matched a pattern of the form:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1282' href='#L_COMPARES_1282'><pre>1282</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// I = icmp ugt (add (add A, B), CI2), CI1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1283' href='#L_COMPARES_1283'><pre>1283</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If this is of the form:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1284' href='#L_COMPARES_1284'><pre>1284</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// sum = a + b</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1285' href='#L_COMPARES_1285'><pre>1285</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if (sum+128 >u 255)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1286' href='#L_COMPARES_1286'><pre>1286</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Then replace it with llvm.sadd.with.overflow.i8.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1287' href='#L_COMPARES_1287'><pre>1287</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1288' href='#L_COMPARES_1288'><pre>1288</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *processUGT_ADDCST_ADD(ICmpInst &I, Value *A, Value *B,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1289' href='#L_COMPARES_1289'><pre>1289</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *CI2, ConstantInt *CI1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1290' href='#L_COMPARES_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1291' href='#L_COMPARES_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // The transformation we're trying to do here is to transform this into an</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1292' href='#L_COMPARES_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // llvm.sadd.with.overflow. To do this, we have to replace the original add</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1293' href='#L_COMPARES_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // with a narrower add, and discard the add-with-constant that is part of the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1294' href='#L_COMPARES_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // range check (if we can't eliminate it, this isn't profitable).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1295' href='#L_COMPARES_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1296' href='#L_COMPARES_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // In order to eliminate the add-with-constant, the compare can be its only</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1297' href='#L_COMPARES_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // use.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1298' href='#L_COMPARES_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Instruction *AddWithCst = cast<Instruction>(I.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1299' href='#L_COMPARES_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> if (!AddWithCst->hasOneUse())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1300' href='#L_COMPARES_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1301' href='#L_COMPARES_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1302' href='#L_COMPARES_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> // If CI2 is 2^7, 2^15, 2^31, then it might be an sadd.with.overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1303' href='#L_COMPARES_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>42</span></div><div class='tooltip'>!CI2->getValue().isPowerOf2()<span class='tooltip-content'>42</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1304' href='#L_COMPARES_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1305' href='#L_COMPARES_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> unsigned NewWidth = CI2->getValue().countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1306' href='#L_COMPARES_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> if (<div class='tooltip'>NewWidth != 7 && <span class='tooltip-content'>37</span></div><div class='tooltip'>NewWidth != 15<span class='tooltip-content'>8</span></div> && <div class='tooltip'>NewWidth != 31<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1307' href='#L_COMPARES_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1308' href='#L_COMPARES_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1309' href='#L_COMPARES_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> // The width of the new add formed is 1 more than the bias.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1310' href='#L_COMPARES_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> ++NewWidth;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1311' href='#L_COMPARES_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1312' href='#L_COMPARES_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // Check to see that CI1 is an all-ones value with NewWidth bits.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1313' href='#L_COMPARES_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> if (CI1->getBitWidth() == NewWidth ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1314' href='#L_COMPARES_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> CI1->getValue() != APInt::getLowBitsSet(CI1->getBitWidth(), NewWidth))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1315' href='#L_COMPARES_1315'><pre>1315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1316' href='#L_COMPARES_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1317' href='#L_COMPARES_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // This is only really a signed overflow check if the inputs have been</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1318' href='#L_COMPARES_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // sign-extended; check for that condition. For example, if CI2 is 2^31 and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1319' href='#L_COMPARES_1319'><pre>1319</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // the operands of the add are 64 bits wide, we need at least 33 sign bits.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1320' href='#L_COMPARES_1320'><pre>1320</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> unsigned NeededSignBits = CI1->getBitWidth() - NewWidth + 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1321' href='#L_COMPARES_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> if (IC.ComputeNumSignBits(A, 0, &I) < NeededSignBits ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1322' href='#L_COMPARES_1322'><pre>1322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>IC.ComputeNumSignBits(B, 0, &I) < NeededSignBits</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1323' href='#L_COMPARES_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1324' href='#L_COMPARES_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1325' href='#L_COMPARES_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // In order to replace the original add with a narrower</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1326' href='#L_COMPARES_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // llvm.sadd.with.overflow, the only uses allowed are the add-with-constant</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1327' href='#L_COMPARES_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // and truncates that discard the high bits of the add. Verify that this is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1328' href='#L_COMPARES_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // the case.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1329' href='#L_COMPARES_1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Instruction *OrigAdd = cast<Instruction>(AddWithCst->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1330' href='#L_COMPARES_1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (User *U : OrigAdd->users()) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1331' href='#L_COMPARES_1331'><pre>1331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>U == AddWithCst</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1332' href='#L_COMPARES_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1333' href='#L_COMPARES_1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1334' href='#L_COMPARES_1334'><pre>1334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only accept truncates for now. We would really like a nice recursive</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1335' href='#L_COMPARES_1335'><pre>1335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // predicate like SimplifyDemandedBits, but which goes downwards the use-def</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1336' href='#L_COMPARES_1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // chain to see which bits of a value are actually demanded. If the</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1337' href='#L_COMPARES_1337'><pre>1337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // original add had another add which was then immediately truncated, we</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1338' href='#L_COMPARES_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // could still do the transformation.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1339' href='#L_COMPARES_1339'><pre>1339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>TruncInst *TI = dyn_cast<TruncInst>(U);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1340' href='#L_COMPARES_1340'><pre>1340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!TI || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>TI->getType()->getPrimitiveSizeInBits() > NewWidth</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1341' href='#L_COMPARES_1341'><pre>1341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1342' href='#L_COMPARES_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1343' href='#L_COMPARES_1343'><pre>1343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1344' href='#L_COMPARES_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the pattern matches, truncate the inputs to the narrower type and</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1345' href='#L_COMPARES_1345'><pre>1345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // use the sadd_with_overflow intrinsic to efficiently compute both the</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1346' href='#L_COMPARES_1346'><pre>1346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // result and the overflow bit.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1347' href='#L_COMPARES_1347'><pre>1347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Type *NewType = IntegerType::get(OrigAdd->getContext(), NewWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1348' href='#L_COMPARES_1348'><pre>1348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *F = Intrinsic::getDeclaration(I.getModule(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1349' href='#L_COMPARES_1349'><pre>1349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Intrinsic::sadd_with_overflow, NewType);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1350' href='#L_COMPARES_1350'><pre>1350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1351' href='#L_COMPARES_1351'><pre>1351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InstCombiner::BuilderTy *Builder = IC.Builder;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1352' href='#L_COMPARES_1352'><pre>1352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1353' href='#L_COMPARES_1353'><pre>1353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Put the new code above the original add, in case there are any uses of the</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1354' href='#L_COMPARES_1354'><pre>1354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // add between the add and the compare.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1355' href='#L_COMPARES_1355'><pre>1355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->SetInsertPoint(OrigAdd);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1356' href='#L_COMPARES_1356'><pre>1356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1357' href='#L_COMPARES_1357'><pre>1357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *TruncA = Builder->CreateTrunc(A, NewType, A->getName() + ".trunc");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1358' href='#L_COMPARES_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *TruncB = Builder->CreateTrunc(B, NewType, B->getName() + ".trunc");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1359' href='#L_COMPARES_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *Call = Builder->CreateCall(F, {TruncA, TruncB}, "sadd");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1360' href='#L_COMPARES_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Add = Builder->CreateExtractValue(Call, 0, "sadd.result");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1361' href='#L_COMPARES_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ZExt = Builder->CreateZExt(Add, OrigAdd->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1362' href='#L_COMPARES_1362'><pre>1362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1363' href='#L_COMPARES_1363'><pre>1363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The inner add was the result of the narrow add, zero extended to the</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1364' href='#L_COMPARES_1364'><pre>1364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // wider type. Replace it with the result computed by the intrinsic.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1365' href='#L_COMPARES_1365'><pre>1365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.replaceInstUsesWith(*OrigAdd, ZExt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1366' href='#L_COMPARES_1366'><pre>1366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1367' href='#L_COMPARES_1367'><pre>1367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The original icmp gets replaced with the overflow value.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1368' href='#L_COMPARES_1368'><pre>1368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ExtractValueInst::Create(Call, 1, "sadd.overflow")</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1369' href='#L_COMPARES_1369'><pre>1369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1370' href='#L_COMPARES_1370'><pre>1370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1371' href='#L_COMPARES_1371'><pre>1371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Fold icmp Pred X, C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1372' href='#L_COMPARES_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpWithConstant(ICmpInst &Cmp) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1373' href='#L_COMPARES_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> CmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1374' href='#L_COMPARES_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Value *X = Cmp.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1375' href='#L_COMPARES_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1376' href='#L_COMPARES_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1377' href='#L_COMPARES_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (!match(Cmp.getOperand(1), m_APInt(C)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1378' href='#L_COMPARES_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>631k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1379' href='#L_COMPARES_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1380' href='#L_COMPARES_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1381' href='#L_COMPARES_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1382' href='#L_COMPARES_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // Match the following pattern, which is a common idiom when writing</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1383' href='#L_COMPARES_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // overflow-safe integer arithmetic functions. The source performs an addition</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1384' href='#L_COMPARES_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // in wider type and explicitly checks for overflow using comparisons against</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1385' href='#L_COMPARES_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // INT_MIN and INT_MAX. Simplify by using the sadd_with_overflow intrinsic.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1386' href='#L_COMPARES_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1387' href='#L_COMPARES_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // TODO: This could probably be generalized to handle other overflow-safe</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1388' href='#L_COMPARES_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // operations if we worked out the formulas to compute the appropriate magic</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1389' href='#L_COMPARES_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // constants.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1390' href='#L_COMPARES_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1391' href='#L_COMPARES_1391'><pre>1391</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // sum = a + b</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1392' href='#L_COMPARES_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // if (sum+128 >u 255) ... -> llvm.sadd.with.overflow.i8</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1393' href='#L_COMPARES_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1394' href='#L_COMPARES_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> ConstantInt *CI2; // I = icmp ugt (add (add A, B), CI2), CI</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1395' href='#L_COMPARES_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> if (Pred == ICmpInst::ICMP_UGT &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1396' href='#L_COMPARES_1396'><pre>1396</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> match(X, m_Add(m_Add(m_Value(A), m_Value(B)), m_ConstantInt(CI2))))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1397' href='#L_COMPARES_1397'><pre>1397</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>64</span></div><div class='tooltip'>Res<span class='tooltip-content'>64</span></div> = processUGT_ADDCST_ADD(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1398' href='#L_COMPARES_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>64</pre></td><td class='code'><pre> Cmp, A, B, CI2, cast<ConstantInt>(Cmp.getOperand(1)), *this))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1399' href='#L_COMPARES_1399'><pre>1399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Res</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1400' href='#L_COMPARES_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1401' href='#L_COMPARES_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1402' href='#L_COMPARES_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // (icmp sgt smin(PosA, B) 0) -> (icmp sgt B 0)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1403' href='#L_COMPARES_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>723k</span></div><div class='tooltip'>*C == 0 && <span class='tooltip-content'>723k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SGT<span class='tooltip-content'>449k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>60.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1404' href='#L_COMPARES_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>60.0k</pre></td><td class='code'><pre> SelectPatternResult SPR = matchSelectPattern(X, A, B);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1405' href='#L_COMPARES_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>60.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>SPR.Flavor == SPF_SMIN<span class='tooltip-content'>60.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>244</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1406' href='#L_COMPARES_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>244</pre></td><td class='code'><pre> if (isKnownPositive(A, DL))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1407' href='#L_COMPARES_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, B, Cmp.getOperand(1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1408' href='#L_COMPARES_1408'><pre>1408</pre></a></td><td class='covered-line'><pre>244</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>244</span></div><div class='tooltip'>isKnownPositive(B, DL)<span class='tooltip-content'>244</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1409' href='#L_COMPARES_1409'><pre>1409</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return new ICmpInst(Pred, A, Cmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1410' href='#L_COMPARES_1410'><pre>1410</pre></a></td><td class='covered-line'><pre>244</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1411' href='#L_COMPARES_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>60.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1412' href='#L_COMPARES_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1413' href='#L_COMPARES_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // FIXME: Use m_APInt to allow folds for splat constants.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1414' href='#L_COMPARES_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> ConstantInt *CI = dyn_cast<ConstantInt>(Cmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1415' href='#L_COMPARES_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> if (!CI)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1416' href='#L_COMPARES_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1417' href='#L_COMPARES_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1418' href='#L_COMPARES_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> // Canonicalize icmp instructions based on dominating conditions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1419' href='#L_COMPARES_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> BasicBlock *Parent = Cmp.getParent();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1420' href='#L_COMPARES_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> BasicBlock *Dom = Parent->getSinglePredecessor();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1421' href='#L_COMPARES_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>363k</pre></td><td class='code'><pre> auto *BI = Dom ? <div class='tooltip'>dyn_cast<BranchInst>(Dom->getTerminator())<span class='tooltip-content'>363k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>360k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1422' href='#L_COMPARES_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1423' href='#L_COMPARES_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> BasicBlock *TrueBB, *FalseBB;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1424' href='#L_COMPARES_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> ConstantInt *CI2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1425' href='#L_COMPARES_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre> if (<div class='tooltip'>BI && <span class='tooltip-content'>723k</span></div><div class='tooltip'>match(BI, m_Br(m_ICmp(Pred2, m_Specific(X), m_ConstantInt(CI2)),<span class='tooltip-content'>317k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1426' href='#L_COMPARES_1426'><pre>1426</pre></a></td><td class='covered-line'><pre>317k</pre></td><td class='code'><pre> TrueBB, FalseBB)) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1427' href='#L_COMPARES_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> <div class='tooltip'>TrueBB != FalseBB<span class='tooltip-content'>16.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1428' href='#L_COMPARES_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantRange CR =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1429' href='#L_COMPARES_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantRange::makeAllowedICmpRegion(Pred, CI->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1430' href='#L_COMPARES_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantRange DominatingCR =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1431' href='#L_COMPARES_1431'><pre>1431</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> (Parent == TrueBB)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1432' href='#L_COMPARES_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>2.11k</pre></td><td class='code'><pre> ? ConstantRange::makeExactICmpRegion(Pred2, CI2->getValue())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1433' href='#L_COMPARES_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>14.1k</pre></td><td class='code'><pre> : ConstantRange::makeExactICmpRegion(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1434' href='#L_COMPARES_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>14.1k</pre></td><td class='code'><pre> CmpInst::getInversePredicate(Pred2), CI2->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1435' href='#L_COMPARES_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantRange Intersection = DominatingCR.intersectWith(CR);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1436' href='#L_COMPARES_1436'><pre>1436</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> ConstantRange Difference = DominatingCR.difference(CR);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1437' href='#L_COMPARES_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> if (Intersection.isEmptySet())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1438' href='#L_COMPARES_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return replaceInstUsesWith(Cmp, Builder->getFalse());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1439' href='#L_COMPARES_1439'><pre>1439</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.2k</span></div><div class='tooltip'>Difference.isEmptySet()<span class='tooltip-content'>16.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1440' href='#L_COMPARES_1440'><pre>1440</pre></a></td><td class='covered-line'><pre>99</pre></td><td class='code'><pre> return replaceInstUsesWith(Cmp, Builder->getTrue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1441' href='#L_COMPARES_1441'><pre>1441</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1442' href='#L_COMPARES_1442'><pre>1442</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> // If this is a normal comparison, it demands all bits. If it is a sign</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1443' href='#L_COMPARES_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> // bit comparison, it only demands the sign bit.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1444' href='#L_COMPARES_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> bool UnusedBit;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1445' href='#L_COMPARES_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> bool IsSignBit = isSignBitCheck(Pred, CI->getValue(), UnusedBit);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1446' href='#L_COMPARES_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1447' href='#L_COMPARES_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> // Canonicalizing a sign bit comparison that gets used in a branch,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1448' href='#L_COMPARES_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> // pessimizes codegen by generating branch on zero instruction instead</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1449' href='#L_COMPARES_1449'><pre>1449</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> // of a test and branch. So we avoid canonicalizing in such situations</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1450' href='#L_COMPARES_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> // because test and branch instruction has better branch displacement</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1451' href='#L_COMPARES_1451'><pre>1451</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> // than compare and branch instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1452' href='#L_COMPARES_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!isBranchOnSignBitCheck(Cmp, IsSignBit) && <span class='tooltip-content'>16.1k</span></div><div class='tooltip'>!Cmp.isEquality()<span class='tooltip-content'>15.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.11k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1453' href='#L_COMPARES_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>5.11k</pre></td><td class='code'><pre> if (auto *AI = Intersection.getSingleElement())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1454' href='#L_COMPARES_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, X, Builder->getInt(*AI));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1455' href='#L_COMPARES_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>5.10k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>5.10k</span></div><div class='tooltip'>AD<span class='tooltip-content'>5.10k</span></div> = Difference.getSingleElement())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1456' href='#L_COMPARES_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, X, Builder->getInt(*AD));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1457' href='#L_COMPARES_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>5.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1458' href='#L_COMPARES_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1459' href='#L_COMPARES_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1460' href='#L_COMPARES_1460'><pre>1460</pre></a></td><td class='covered-line'><pre>722k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1461' href='#L_COMPARES_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>723k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1462' href='#L_COMPARES_1462'><pre>1462</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1463' href='#L_COMPARES_1463'><pre>1463</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (trunc X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1464' href='#L_COMPARES_1464'><pre>1464</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpTruncConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1465' href='#L_COMPARES_1465'><pre>1465</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *Trunc,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1466' href='#L_COMPARES_1466'><pre>1466</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1467' href='#L_COMPARES_1467'><pre>1467</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1468' href='#L_COMPARES_1468'><pre>1468</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> Value *X = Trunc->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1469' href='#L_COMPARES_1469'><pre>1469</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 1 && <span class='tooltip-content'>12.6k</span></div><div class='tooltip'>C->getBitWidth() > 1<span class='tooltip-content'>1.99k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.99k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1470' href='#L_COMPARES_1470'><pre>1470</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> // icmp slt trunc(signum(V)) 1 --> icmp slt V, 1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1471' href='#L_COMPARES_1471'><pre>1471</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> Value *V = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1472' href='#L_COMPARES_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>1.99k</span></div><div class='tooltip'>match(X, m_Signum(m_Value(V)))<span class='tooltip-content'>1.11k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1473' href='#L_COMPARES_1473'><pre>1473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_SLT, V,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1474' href='#L_COMPARES_1474'><pre>1474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(V->getType(), 1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1475' href='#L_COMPARES_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1476' href='#L_COMPARES_1476'><pre>1476</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1477' href='#L_COMPARES_1477'><pre>1477</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.6k</span></div><div class='tooltip'>Cmp.isEquality() && <span class='tooltip-content'>12.6k</span></div><div class='tooltip'>Trunc->hasOneUse()<span class='tooltip-content'>3.47k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.69k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1478' href='#L_COMPARES_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> // Simplify icmp eq (trunc x to i8), 42 -> icmp eq x, 42|highbits if all</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1479' href='#L_COMPARES_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> // of the high bits truncated out of x are known.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1480' href='#L_COMPARES_1480'><pre>1480</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> unsigned DstBits = Trunc->getType()->getScalarSizeInBits(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1481' href='#L_COMPARES_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> SrcBits = X->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1482' href='#L_COMPARES_1482'><pre>1482</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> APInt KnownZero(SrcBits, 0), KnownOne(SrcBits, 0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1483' href='#L_COMPARES_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> computeKnownBits(X, KnownZero, KnownOne, 0, &Cmp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1484' href='#L_COMPARES_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1485' href='#L_COMPARES_1485'><pre>1485</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> // If all the high bits are known, we can do this xform.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1486' href='#L_COMPARES_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> if (<div class='tooltip'>(KnownZero | KnownOne).countLeadingOnes() >= SrcBits - DstBits<span class='tooltip-content'>1.69k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1487' href='#L_COMPARES_1487'><pre>1487</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Pull in the high bits from known-ones set.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1488' href='#L_COMPARES_1488'><pre>1488</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> APInt NewRHS = C->zext(SrcBits);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1489' href='#L_COMPARES_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> NewRHS |= KnownOne & APInt::getHighBitsSet(SrcBits, SrcBits - DstBits);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1490' href='#L_COMPARES_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), NewRHS));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1491' href='#L_COMPARES_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1492' href='#L_COMPARES_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>1.69k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1493' href='#L_COMPARES_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1494' href='#L_COMPARES_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1495' href='#L_COMPARES_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1496' href='#L_COMPARES_1496'><pre>1496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1497' href='#L_COMPARES_1497'><pre>1497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (xor X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1498' href='#L_COMPARES_1498'><pre>1498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpXorConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1499' href='#L_COMPARES_1499'><pre>1499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Xor,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1500' href='#L_COMPARES_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1501' href='#L_COMPARES_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> Value *X = Xor->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1502' href='#L_COMPARES_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> Value *Y = Xor->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1503' href='#L_COMPARES_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> const APInt *XorC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1504' href='#L_COMPARES_1504'><pre>1504</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> if (!match(Y, m_APInt(XorC)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1505' href='#L_COMPARES_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>238</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1506' href='#L_COMPARES_1506'><pre>1506</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1507' href='#L_COMPARES_1507'><pre>1507</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> // If this is a comparison that tests the signbit (X < 0) or (x > -1),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1508' href='#L_COMPARES_1508'><pre>1508</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> // fold the xor.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1509' href='#L_COMPARES_1509'><pre>1509</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1510' href='#L_COMPARES_1510'><pre>1510</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre> if (<div class='tooltip'>(Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>264</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>4</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1511' href='#L_COMPARES_1511'><pre>1511</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> <div class='tooltip'>(Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>260</span></div><div class='tooltip'><span class='red'>C->isAllOnesValue()</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1512' href='#L_COMPARES_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1513' href='#L_COMPARES_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // If the sign bit of the XorCst is not set, there is no change to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1514' href='#L_COMPARES_1514'><pre>1514</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // the operation, just stop using the Xor.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1515' href='#L_COMPARES_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (<div class='tooltip'>!XorC->isNegative()<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1516' href='#L_COMPARES_1516'><pre>1516</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Cmp.setOperand(0, X);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1517' href='#L_COMPARES_1517'><pre>1517</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Worklist.Add(Xor);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1518' href='#L_COMPARES_1518'><pre>1518</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return &Cmp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1519' href='#L_COMPARES_1519'><pre>1519</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1520' href='#L_COMPARES_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1521' href='#L_COMPARES_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // Was the old condition true if the operand is positive?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1522' href='#L_COMPARES_1522'><pre>1522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>bool isTrueIfPositive = Pred == ICmpInst::ICMP_SGT;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1523' href='#L_COMPARES_1523'><pre>1523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1524' href='#L_COMPARES_1524'><pre>1524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If so, the new one isn't.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1525' href='#L_COMPARES_1525'><pre>1525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> isTrueIfPositive ^= true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1526' href='#L_COMPARES_1526'><pre>1526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1527' href='#L_COMPARES_1527'><pre>1527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *CmpConstant = cast<Constant>(Cmp.getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1528' href='#L_COMPARES_1528'><pre>1528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isTrueIfPositive</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1529' href='#L_COMPARES_1529'><pre>1529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_SGT, X, SubOne(CmpConstant))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1530' href='#L_COMPARES_1530'><pre>1530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1531' href='#L_COMPARES_1531'><pre>1531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_SLT, X, AddOne(CmpConstant))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1532' href='#L_COMPARES_1532'><pre>1532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1533' href='#L_COMPARES_1533'><pre>1533</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1534' href='#L_COMPARES_1534'><pre>1534</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>260</span></div><div class='tooltip'>Xor->hasOneUse()<span class='tooltip-content'>260</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1535' href='#L_COMPARES_1535'><pre>1535</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // (icmp u/s (xor X SignBit), C) -> (icmp s/u X, (xor C SignBit))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1536' href='#L_COMPARES_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.isEquality() && <span class='tooltip-content'>10</span></div><div class='tooltip'><span class='red'>XorC->isSignBit()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1537' href='#L_COMPARES_1537'><pre>1537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = Cmp.isSigned() ? </span><span class='red'>Cmp.getUnsignedPredicate()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1538' href='#L_COMPARES_1538'><pre>1538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Cmp.getSignedPredicate()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1539' href='#L_COMPARES_1539'><pre>1539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), *C ^ *XorC));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1540' href='#L_COMPARES_1540'><pre>1540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1541' href='#L_COMPARES_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1542' href='#L_COMPARES_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // (icmp u/s (xor X ~SignBit), C) -> (icmp s/u X, (xor C ~SignBit))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1543' href='#L_COMPARES_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>10</span></div><div class='tooltip'>!Cmp.isEquality() && <span class='tooltip-content'>10</span></div><div class='tooltip'><span class='red'>XorC->isMaxSignedValue()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1544' href='#L_COMPARES_1544'><pre>1544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = Cmp.isSigned() ? </span><span class='red'>Cmp.getUnsignedPredicate()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1545' href='#L_COMPARES_1545'><pre>1545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Cmp.getSignedPredicate()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1546' href='#L_COMPARES_1546'><pre>1546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = Cmp.getSwappedPredicate(Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1547' href='#L_COMPARES_1547'><pre>1547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), *C ^ *XorC));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1548' href='#L_COMPARES_1548'><pre>1548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1549' href='#L_COMPARES_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1550' href='#L_COMPARES_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1551' href='#L_COMPARES_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> // (icmp ugt (xor X, C), ~C) -> (icmp ult X, C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1552' href='#L_COMPARES_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> // iff -C is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1553' href='#L_COMPARES_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>260</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGT && <span class='tooltip-content'>260</span></div><div class='tooltip'><span class='red'>*XorC == ~(*C)</span><span class='tooltip-content'>0</span></div> && <div class='tooltip'><span class='red'>(*C + 1).isPowerOf2()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1554' href='#L_COMPARES_1554'><pre>1554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_ULT, X, Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1555' href='#L_COMPARES_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1556' href='#L_COMPARES_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> // (icmp ult (xor X, C), -C) -> (icmp uge X, C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1557' href='#L_COMPARES_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> // iff -C is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1558' href='#L_COMPARES_1558'><pre>1558</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>260</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT && <span class='tooltip-content'>260</span></div><div class='tooltip'>*XorC == -(*C)<span class='tooltip-content'>102</span></div> && <div class='tooltip'><span class='red'>C->isPowerOf2()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1559' href='#L_COMPARES_1559'><pre>1559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_UGE, X, Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1560' href='#L_COMPARES_1560'><pre>1560</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1561' href='#L_COMPARES_1561'><pre>1561</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1562' href='#L_COMPARES_1562'><pre>1562</pre></a></td><td class='covered-line'><pre>260</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1563' href='#L_COMPARES_1563'><pre>1563</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1564' href='#L_COMPARES_1564'><pre>1564</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (and (sh X, Y), C2), C1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1565' href='#L_COMPARES_1565'><pre>1565</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1566' href='#L_COMPARES_1566'><pre>1566</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> const APInt *C1, const APInt *C2) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1567' href='#L_COMPARES_1567'><pre>1567</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> BinaryOperator *Shift = dyn_cast<BinaryOperator>(And->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1568' href='#L_COMPARES_1568'><pre>1568</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Shift || <span class='tooltip-content'>23.9k</span></div><div class='tooltip'>!Shift->isShift()<span class='tooltip-content'>1.53k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1569' href='#L_COMPARES_1569'><pre>1569</pre></a></td><td class='covered-line'><pre>22.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1570' href='#L_COMPARES_1570'><pre>1570</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1571' href='#L_COMPARES_1571'><pre>1571</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // If this is: (X >> C3) & C2 != C1 (where any shift and any compare could</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1572' href='#L_COMPARES_1572'><pre>1572</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // exist), turn it into (X & (C2 << C3)) != (C1 << C3). This happens a LOT in</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1573' href='#L_COMPARES_1573'><pre>1573</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // code produced by the clang front-end, for bitfield access.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1574' href='#L_COMPARES_1574'><pre>1574</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // This seemingly simple opportunity to fold away a shift turns out to be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1575' href='#L_COMPARES_1575'><pre>1575</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // rather complicated. See PR17827 for details.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1576' href='#L_COMPARES_1576'><pre>1576</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> unsigned ShiftOpcode = Shift->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1577' href='#L_COMPARES_1577'><pre>1577</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> bool IsShl = ShiftOpcode == Instruction::Shl;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1578' href='#L_COMPARES_1578'><pre>1578</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> const APInt *C3;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1579' href='#L_COMPARES_1579'><pre>1579</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Shift->getOperand(1), m_APInt(C3))<span class='tooltip-content'>1.08k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>467</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1580' href='#L_COMPARES_1580'><pre>1580</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> bool CanFold = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1581' href='#L_COMPARES_1581'><pre>1581</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> if (<div class='tooltip'>ShiftOpcode == Instruction::AShr<span class='tooltip-content'>467</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1582' href='#L_COMPARES_1582'><pre>1582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // There may be some constraints that make this possible, but nothing</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1583' href='#L_COMPARES_1583'><pre>1583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // simple has been discovered yet.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1584' href='#L_COMPARES_1584'><pre>1584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CanFold = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1585' href='#L_COMPARES_1585'><pre>1585</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>467</span></div><div class='tooltip'>ShiftOpcode == Instruction::Shl<span class='tooltip-content'>467</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1586' href='#L_COMPARES_1586'><pre>1586</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // For a left shift, we can fold if the comparison is not signed. We can</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1587' href='#L_COMPARES_1587'><pre>1587</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // also fold a signed comparison if the mask value and comparison value</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1588' href='#L_COMPARES_1588'><pre>1588</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // are not negative. These constraints may not be obvious, but we can</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1589' href='#L_COMPARES_1589'><pre>1589</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // prove that they are correct using an SMT solver.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1590' href='#L_COMPARES_1590'><pre>1590</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.isSigned() || <span class='tooltip-content'>4</span></div><div class='tooltip'><span class='red'>(!C2->isNegative() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!C1->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1591' href='#L_COMPARES_1591'><pre>1591</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> CanFold = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1592' href='#L_COMPARES_1592'><pre>1592</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>463</span></div><div class='tooltip'>ShiftOpcode == Instruction::LShr<span class='tooltip-content'>463</span></div>) <div class='tooltip'>{<span class='tooltip-content'>463</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1593' href='#L_COMPARES_1593'><pre>1593</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> // For a logical right shift, we can fold if the comparison is not signed.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1594' href='#L_COMPARES_1594'><pre>1594</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> // We can also fold a signed comparison if the shifted mask value and the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1595' href='#L_COMPARES_1595'><pre>1595</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> // shifted comparison value are not negative. These constraints may not be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1596' href='#L_COMPARES_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> // obvious, but we can prove that they are correct using an SMT solver.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1597' href='#L_COMPARES_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> if (!Cmp.isSigned() ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1598' href='#L_COMPARES_1598'><pre>1598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>(!C2->shl(*C3).isNegative() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!C1->shl(*C3).isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1599' href='#L_COMPARES_1599'><pre>1599</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> CanFold = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1600' href='#L_COMPARES_1600'><pre>1600</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1601' href='#L_COMPARES_1601'><pre>1601</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1602' href='#L_COMPARES_1602'><pre>1602</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> if (<div class='tooltip'>CanFold<span class='tooltip-content'>467</span></div>) <div class='tooltip'>{<span class='tooltip-content'>467</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1603' href='#L_COMPARES_1603'><pre>1603</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> APInt NewCst = IsShl ? <div class='tooltip'>C1->lshr(*C3)<span class='tooltip-content'>4</span></div> : <div class='tooltip'>C1->shl(*C3)<span class='tooltip-content'>463</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1604' href='#L_COMPARES_1604'><pre>1604</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> APInt SameAsC1 = IsShl ? <div class='tooltip'>NewCst.shl(*C3)<span class='tooltip-content'>4</span></div> : <div class='tooltip'>NewCst.lshr(*C3)<span class='tooltip-content'>463</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1605' href='#L_COMPARES_1605'><pre>1605</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> // Check to see if we are shifting out any of the bits being compared.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1606' href='#L_COMPARES_1606'><pre>1606</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> if (<div class='tooltip'>SameAsC1 != *C1<span class='tooltip-content'>467</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1607' href='#L_COMPARES_1607'><pre>1607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we shifted bits out, the fold is not going to work out. As a</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1608' href='#L_COMPARES_1608'><pre>1608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // special case, check to see if this means that the result is always</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1609' href='#L_COMPARES_1609'><pre>1609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // true or false now.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1610' href='#L_COMPARES_1610'><pre>1610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Cmp.getPredicate() == ICmpInst::ICMP_EQ</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1611' href='#L_COMPARES_1611'><pre>1611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(Cmp, ConstantInt::getFalse(Cmp.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1612' href='#L_COMPARES_1612'><pre>1612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Cmp.getPredicate() == ICmpInst::ICMP_NE</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1613' href='#L_COMPARES_1613'><pre>1613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(Cmp, ConstantInt::getTrue(Cmp.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1614' href='#L_COMPARES_1614'><pre>1614</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1615' href='#L_COMPARES_1615'><pre>1615</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> Cmp.setOperand(1, ConstantInt::get(And->getType(), NewCst));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1616' href='#L_COMPARES_1616'><pre>1616</pre></a></td><td class='covered-line'><pre>463</pre></td><td class='code'><pre> APInt NewAndCst = IsShl ? <div class='tooltip'>C2->lshr(*C3)<span class='tooltip-content'>4</span></div> : <div class='tooltip'>C2->shl(*C3)<span class='tooltip-content'>463</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1617' href='#L_COMPARES_1617'><pre>1617</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> And->setOperand(1, ConstantInt::get(And->getType(), NewAndCst));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1618' href='#L_COMPARES_1618'><pre>1618</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> And->setOperand(0, Shift->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1619' href='#L_COMPARES_1619'><pre>1619</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> Worklist.Add(Shift); // Shift is dead.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1620' href='#L_COMPARES_1620'><pre>1620</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> return &Cmp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1621' href='#L_COMPARES_1621'><pre>1621</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1622' href='#L_COMPARES_1622'><pre>1622</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1623' href='#L_COMPARES_1623'><pre>1623</pre></a></td><td class='covered-line'><pre>467</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1624' href='#L_COMPARES_1624'><pre>1624</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1625' href='#L_COMPARES_1625'><pre>1625</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> // Turn ((X >> Y) & C2) == 0 into (X & (C2 << Y)) == 0. The latter is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1626' href='#L_COMPARES_1626'><pre>1626</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> // preferable because it allows the C2 << Y expression to be hoisted out of a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1627' href='#L_COMPARES_1627'><pre>1627</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> // loop if Y is invariant and X is not.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1628' href='#L_COMPARES_1628'><pre>1628</pre></a></td><td class='covered-line'><pre>613</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>613</span></div><div class='tooltip'>Shift->hasOneUse() && <span class='tooltip-content'>613</span></div><div class='tooltip'>*C1 == 0<span class='tooltip-content'>613</span></div> && <div class='tooltip'>Cmp.isEquality()<span class='tooltip-content'>611</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1629' href='#L_COMPARES_1629'><pre>1629</pre></a></td><td class='covered-line'><pre>611</pre></td><td class='code'><pre> <div class='tooltip'>!Shift->isArithmeticShift()<span class='tooltip-content'>611</span></div> && <div class='tooltip'>!isa<Constant>(Shift->getOperand(0))<span class='tooltip-content'>611</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1630' href='#L_COMPARES_1630'><pre>1630</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // Compute C2 << Y.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1631' href='#L_COMPARES_1631'><pre>1631</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *NewShift =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1632' href='#L_COMPARES_1632'><pre>1632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> IsShl ? <span class='red'>Builder->CreateLShr(And->getOperand(1), Shift->getOperand(1))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1633' href='#L_COMPARES_1633'><pre>1633</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> : Builder->CreateShl(And->getOperand(1), Shift->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1634' href='#L_COMPARES_1634'><pre>1634</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1635' href='#L_COMPARES_1635'><pre>1635</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // Compute X & (C2 << Y).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1636' href='#L_COMPARES_1636'><pre>1636</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(Shift->getOperand(0), NewShift);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1637' href='#L_COMPARES_1637'><pre>1637</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Cmp.setOperand(0, NewAnd);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1638' href='#L_COMPARES_1638'><pre>1638</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return &Cmp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1639' href='#L_COMPARES_1639'><pre>1639</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1640' href='#L_COMPARES_1640'><pre>1640</pre></a></td><td class='covered-line'><pre>613</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1641' href='#L_COMPARES_1641'><pre>1641</pre></a></td><td class='covered-line'><pre>598</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1642' href='#L_COMPARES_1642'><pre>1642</pre></a></td><td class='covered-line'><pre>613</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1643' href='#L_COMPARES_1643'><pre>1643</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1644' href='#L_COMPARES_1644'><pre>1644</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (and X, C2), C1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1645' href='#L_COMPARES_1645'><pre>1645</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpAndConstConst(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1646' href='#L_COMPARES_1646'><pre>1646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *And,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1647' href='#L_COMPARES_1647'><pre>1647</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> const APInt *C1) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1648' href='#L_COMPARES_1648'><pre>1648</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1649' href='#L_COMPARES_1649'><pre>1649</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> if (!match(And->getOperand(1), m_APInt(C2)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1650' href='#L_COMPARES_1650'><pre>1650</pre></a></td><td class='covered-line'><pre>5.54k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1651' href='#L_COMPARES_1651'><pre>1651</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1652' href='#L_COMPARES_1652'><pre>1652</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>40.9k</span></div><div class='tooltip'>!And->hasOneUse() || <span class='tooltip-content'>40.9k</span></div><div class='tooltip'>!And->getOperand(0)->hasOneUse()<span class='tooltip-content'>38.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1653' href='#L_COMPARES_1653'><pre>1653</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1654' href='#L_COMPARES_1654'><pre>1654</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1655' href='#L_COMPARES_1655'><pre>1655</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // If the LHS is an 'and' of a truncate and we can widen the and/compare to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1656' href='#L_COMPARES_1656'><pre>1656</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // the input width without changing the value produced, eliminate the cast:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1657' href='#L_COMPARES_1657'><pre>1657</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1658' href='#L_COMPARES_1658'><pre>1658</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // icmp (and (trunc W), C2), C1 -> icmp (and W, C2'), C1'</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1659' href='#L_COMPARES_1659'><pre>1659</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1660' href='#L_COMPARES_1660'><pre>1660</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // We can do this transformation if the constants do not have their sign bits</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1661' href='#L_COMPARES_1661'><pre>1661</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // set or if it is an equality comparison. Extending a relational comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1662' href='#L_COMPARES_1662'><pre>1662</pre></a></td><td class='covered-line'><pre>40.9k</pre></td><td class='code'><pre> // when we're checking the sign bit would not work.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1663' href='#L_COMPARES_1663'><pre>1663</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> Value *W;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1664' href='#L_COMPARES_1664'><pre>1664</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> if (match(And->getOperand(0), m_Trunc(m_Value(W))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1665' href='#L_COMPARES_1665'><pre>1665</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>(Cmp.isEquality() || <span class='tooltip-content'>15</span></div><div class='tooltip'><span class='red'>(!C1->isNegative() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!C2->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>)) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1666' href='#L_COMPARES_1666'><pre>1666</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // TODO: Is this a good transform for vectors? Wider types may reduce</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1667' href='#L_COMPARES_1667'><pre>1667</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // throughput. Should this transform be limited (even for scalars) by using</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1668' href='#L_COMPARES_1668'><pre>1668</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // shouldChangeType()?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1669' href='#L_COMPARES_1669'><pre>1669</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.getType()->isVectorTy()<span class='tooltip-content'>15</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1670' href='#L_COMPARES_1670'><pre>1670</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Type *WideType = W->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1671' href='#L_COMPARES_1671'><pre>1671</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> unsigned WideScalarBits = WideType->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1672' href='#L_COMPARES_1672'><pre>1672</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Constant *ZextC1 = ConstantInt::get(WideType, C1->zext(WideScalarBits));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1673' href='#L_COMPARES_1673'><pre>1673</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Constant *ZextC2 = ConstantInt::get(WideType, C2->zext(WideScalarBits));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1674' href='#L_COMPARES_1674'><pre>1674</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *NewAnd = Builder->CreateAnd(W, ZextC2, And->getName());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1675' href='#L_COMPARES_1675'><pre>1675</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return new ICmpInst(Cmp.getPredicate(), NewAnd, ZextC1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1676' href='#L_COMPARES_1676'><pre>1676</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1677' href='#L_COMPARES_1677'><pre>1677</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1678' href='#L_COMPARES_1678'><pre>1678</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1679' href='#L_COMPARES_1679'><pre>1679</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>23.9k</span></div><div class='tooltip'>I<span class='tooltip-content'>23.9k</span></div> = foldICmpAndShift(Cmp, And, C1, C2))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1680' href='#L_COMPARES_1680'><pre>1680</pre></a></td><td class='covered-line'><pre>482</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1681' href='#L_COMPARES_1681'><pre>1681</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1682' href='#L_COMPARES_1682'><pre>1682</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // (icmp pred (and (or (lshr A, B), A), 1), 0) --></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1683' href='#L_COMPARES_1683'><pre>1683</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // (icmp pred (and A, (or (shl 1, B), 1), 0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1684' href='#L_COMPARES_1684'><pre>1684</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1685' href='#L_COMPARES_1685'><pre>1685</pre></a></td><td class='covered-line'><pre>23.9k</pre></td><td class='code'><pre> // iff pred isn't signed</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1686' href='#L_COMPARES_1686'><pre>1686</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>23.4k</span></div><div class='tooltip'>!Cmp.isSigned() && <span class='tooltip-content'>23.4k</span></div><div class='tooltip'>*C1 == 0<span class='tooltip-content'>23.4k</span></div> && <div class='tooltip'>match(And->getOperand(1), m_One())<span class='tooltip-content'>21.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8.94k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1687' href='#L_COMPARES_1687'><pre>1687</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> Constant *One = cast<Constant>(And->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1688' href='#L_COMPARES_1688'><pre>1688</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> Value *Or = And->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1689' href='#L_COMPARES_1689'><pre>1689</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> Value *A, *B, *LShr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1690' href='#L_COMPARES_1690'><pre>1690</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> if (match(Or, m_Or(m_Value(LShr), m_Value(A))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1691' href='#L_COMPARES_1691'><pre>1691</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> <div class='tooltip'>match(LShr, m_LShr(m_Specific(A), m_Value(B)))<span class='tooltip-content'>70</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1692' href='#L_COMPARES_1692'><pre>1692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned UsesRemoved = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1693' href='#L_COMPARES_1693'><pre>1693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>And->hasOneUse()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1694' href='#L_COMPARES_1694'><pre>1694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>++UsesRemoved</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1695' href='#L_COMPARES_1695'><pre>1695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Or->hasOneUse()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1696' href='#L_COMPARES_1696'><pre>1696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>++UsesRemoved</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1697' href='#L_COMPARES_1697'><pre>1697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>LShr->hasOneUse()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1698' href='#L_COMPARES_1698'><pre>1698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>++UsesRemoved</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1699' href='#L_COMPARES_1699'><pre>1699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1700' href='#L_COMPARES_1700'><pre>1700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Compute A & ((1 << B) | 1)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1701' href='#L_COMPARES_1701'><pre>1701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOr = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1702' href='#L_COMPARES_1702'><pre>1702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (auto *</span><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(B)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1703' href='#L_COMPARES_1703'><pre>1703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>UsesRemoved >= 1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1704' href='#L_COMPARES_1704'><pre>1704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewOr = ConstantExpr::getOr(ConstantExpr::getNUWShl(One, C), One)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1705' href='#L_COMPARES_1705'><pre>1705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1706' href='#L_COMPARES_1706'><pre>1706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>UsesRemoved >= 3</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1707' href='#L_COMPARES_1707'><pre>1707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewOr = Builder->CreateOr(Builder->CreateShl(One, B, LShr->getName(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1708' href='#L_COMPARES_1708'><pre>1708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> /*HasNUW=*/true),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1709' href='#L_COMPARES_1709'><pre>1709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> One, Or->getName())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1710' href='#L_COMPARES_1710'><pre>1710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1711' href='#L_COMPARES_1711'><pre>1711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewOr</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1712' href='#L_COMPARES_1712'><pre>1712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewAnd = Builder->CreateAnd(A, NewOr, And->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1713' href='#L_COMPARES_1713'><pre>1713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp.setOperand(0, NewAnd);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1714' href='#L_COMPARES_1714'><pre>1714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &Cmp;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1715' href='#L_COMPARES_1715'><pre>1715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1716' href='#L_COMPARES_1716'><pre>1716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1717' href='#L_COMPARES_1717'><pre>1717</pre></a></td><td class='covered-line'><pre>8.94k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1718' href='#L_COMPARES_1718'><pre>1718</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1719' href='#L_COMPARES_1719'><pre>1719</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> // (X & C2) > C1 --> (X & C2) != 0, if any bit set in (X & C2) will produce a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1720' href='#L_COMPARES_1720'><pre>1720</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> // result greater than C1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1721' href='#L_COMPARES_1721'><pre>1721</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> unsigned NumTZ = C2->countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1722' href='#L_COMPARES_1722'><pre>1722</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.getPredicate() == ICmpInst::ICMP_UGT && <span class='tooltip-content'>23.4k</span></div><div class='tooltip'>NumTZ < C2->getBitWidth()<span class='tooltip-content'>2</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1723' href='#L_COMPARES_1723'><pre>1723</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>APInt::getOneBitSet(C2->getBitWidth(), NumTZ).ugt(*C1)<span class='tooltip-content'>2</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1724' href='#L_COMPARES_1724'><pre>1724</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Constant *Zero = Constant::getNullValue(And->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1725' href='#L_COMPARES_1725'><pre>1725</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, And, Zero);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1726' href='#L_COMPARES_1726'><pre>1726</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1727' href='#L_COMPARES_1727'><pre>1727</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1728' href='#L_COMPARES_1728'><pre>1728</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1729' href='#L_COMPARES_1729'><pre>1729</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1730' href='#L_COMPARES_1730'><pre>1730</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1731' href='#L_COMPARES_1731'><pre>1731</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (and X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1732' href='#L_COMPARES_1732'><pre>1732</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpAndConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1733' href='#L_COMPARES_1733'><pre>1733</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *And,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1734' href='#L_COMPARES_1734'><pre>1734</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1735' href='#L_COMPARES_1735'><pre>1735</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpAndConstConst(Cmp, And, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1736' href='#L_COMPARES_1736'><pre>1736</pre></a></td><td class='covered-line'><pre>499</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1737' href='#L_COMPARES_1737'><pre>1737</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1738' href='#L_COMPARES_1738'><pre>1738</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> // TODO: These all require that Y is constant too, so refactor with the above.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1739' href='#L_COMPARES_1739'><pre>1739</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1740' href='#L_COMPARES_1740'><pre>1740</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> // Try to optimize things like "A[i] & 42 == 0" to index computations.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1741' href='#L_COMPARES_1741'><pre>1741</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> Value *X = And->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1742' href='#L_COMPARES_1742'><pre>1742</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> Value *Y = And->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1743' href='#L_COMPARES_1743'><pre>1743</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> if (auto *LI = dyn_cast<LoadInst>(X))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1744' href='#L_COMPARES_1744'><pre>1744</pre></a></td><td class='covered-line'><pre>31.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>31.9k</span></div><div class='tooltip'>GEP<span class='tooltip-content'>31.9k</span></div> = dyn_cast<GetElementPtrInst>(LI->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1745' href='#L_COMPARES_1745'><pre>1745</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>19.0k</span></div><div class='tooltip'>GV<span class='tooltip-content'>19.0k</span></div> = dyn_cast<GlobalVariable>(GEP->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1746' href='#L_COMPARES_1746'><pre>1746</pre></a></td><td class='covered-line'><pre>227</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>227</span></div><div class='tooltip'>GV->isConstant() && <span class='tooltip-content'>227</span></div><div class='tooltip'>GV->hasDefinitiveInitializer()<span class='tooltip-content'>69</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1747' href='#L_COMPARES_1747'><pre>1747</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> <div class='tooltip'>!LI->isVolatile()<span class='tooltip-content'>69</span></div> && <div class='tooltip'>isa<ConstantInt>(Y)<span class='tooltip-content'>69</span></div>) <div class='tooltip'>{<span class='tooltip-content'>33</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1748' href='#L_COMPARES_1748'><pre>1748</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> ConstantInt *C2 = cast<ConstantInt>(Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1749' href='#L_COMPARES_1749'><pre>1749</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> if (Instruction *Res = foldCmpLoadFromIndexedGlobal(GEP, GV, Cmp, C2))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1750' href='#L_COMPARES_1750'><pre>1750</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1751' href='#L_COMPARES_1751'><pre>1751</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1752' href='#L_COMPARES_1752'><pre>1752</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1753' href='#L_COMPARES_1753'><pre>1753</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>45.9k</span></div><div class='tooltip'>!Cmp.isEquality()<span class='tooltip-content'>45.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1754' href='#L_COMPARES_1754'><pre>1754</pre></a></td><td class='covered-line'><pre>898</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1755' href='#L_COMPARES_1755'><pre>1755</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1756' href='#L_COMPARES_1756'><pre>1756</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> // X & -C == -C -> X > u ~C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1757' href='#L_COMPARES_1757'><pre>1757</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> // X & -C != -C -> X <= u ~C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1758' href='#L_COMPARES_1758'><pre>1758</pre></a></td><td class='covered-line'><pre>45.9k</pre></td><td class='code'><pre> // iff C is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1759' href='#L_COMPARES_1759'><pre>1759</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>45.0k</span></div><div class='tooltip'>Cmp.getOperand(1) == Y && <span class='tooltip-content'>45.0k</span></div><div class='tooltip'>(-(*C)).isPowerOf2()<span class='tooltip-content'>538</span></div>) <div class='tooltip'>{<span class='tooltip-content'>20</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1760' href='#L_COMPARES_1760'><pre>1760</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> auto NewPred = Cmp.getPredicate() == CmpInst::ICMP_EQ ? CmpInst::ICMP_UGT</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1761' href='#L_COMPARES_1761'><pre>1761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>CmpInst::ICMP_ULE</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1762' href='#L_COMPARES_1762'><pre>1762</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return new ICmpInst(NewPred, X, SubOne(cast<Constant>(Cmp.getOperand(1))));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1763' href='#L_COMPARES_1763'><pre>1763</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1764' href='#L_COMPARES_1764'><pre>1764</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1765' href='#L_COMPARES_1765'><pre>1765</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> // (X & C2) == 0 -> (trunc X) >= 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1766' href='#L_COMPARES_1766'><pre>1766</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> // (X & C2) != 0 -> (trunc X) < 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1767' href='#L_COMPARES_1767'><pre>1767</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> // iff C2 is a power of 2 and it masks the sign bit of a legal integer type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1768' href='#L_COMPARES_1768'><pre>1768</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1769' href='#L_COMPARES_1769'><pre>1769</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>And->hasOneUse() && <span class='tooltip-content'>45.0k</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>42.1k</span></div> && <div class='tooltip'>match(Y, m_APInt(C2))<span class='tooltip-content'>36.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>33.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1770' href='#L_COMPARES_1770'><pre>1770</pre></a></td><td class='covered-line'><pre>33.8k</pre></td><td class='code'><pre> int32_t ExactLogBase2 = C2->exactLogBase2();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1771' href='#L_COMPARES_1771'><pre>1771</pre></a></td><td class='covered-line'><pre>33.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>ExactLogBase2 != -1 && <span class='tooltip-content'>33.8k</span></div><div class='tooltip'>DL.isLegalInteger(ExactLogBase2 + 1)<span class='tooltip-content'>30.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>176</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1772' href='#L_COMPARES_1772'><pre>1772</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> Type *NTy = IntegerType::get(Cmp.getContext(), ExactLogBase2 + 1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1773' href='#L_COMPARES_1773'><pre>1773</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> if (And->getType()->isVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1774' href='#L_COMPARES_1774'><pre>1774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NTy = VectorType::get(NTy, And->getType()->getVectorNumElements())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1775' href='#L_COMPARES_1775'><pre>1775</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> Value *Trunc = Builder->CreateTrunc(X, NTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1776' href='#L_COMPARES_1776'><pre>1776</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> auto NewPred = Cmp.getPredicate() == CmpInst::ICMP_EQ ? CmpInst::ICMP_SGE</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1777' href='#L_COMPARES_1777'><pre>1777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>CmpInst::ICMP_SLT</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1778' href='#L_COMPARES_1778'><pre>1778</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> return new ICmpInst(NewPred, Trunc, Constant::getNullValue(NTy));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1779' href='#L_COMPARES_1779'><pre>1779</pre></a></td><td class='covered-line'><pre>176</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1780' href='#L_COMPARES_1780'><pre>1780</pre></a></td><td class='covered-line'><pre>33.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1781' href='#L_COMPARES_1781'><pre>1781</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1782' href='#L_COMPARES_1782'><pre>1782</pre></a></td><td class='covered-line'><pre>44.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1783' href='#L_COMPARES_1783'><pre>1783</pre></a></td><td class='covered-line'><pre>45.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1784' href='#L_COMPARES_1784'><pre>1784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1785' href='#L_COMPARES_1785'><pre>1785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (or X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1786' href='#L_COMPARES_1786'><pre>1786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1787' href='#L_COMPARES_1787'><pre>1787</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1788' href='#L_COMPARES_1788'><pre>1788</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1789' href='#L_COMPARES_1789'><pre>1789</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 1<span class='tooltip-content'>4.83k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>209</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1790' href='#L_COMPARES_1790'><pre>1790</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> // icmp slt signum(V) 1 --> icmp slt V, 1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1791' href='#L_COMPARES_1791'><pre>1791</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> Value *V = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1792' href='#L_COMPARES_1792'><pre>1792</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>209</span></div><div class='tooltip'><span class='red'>match(Or, m_Signum(m_Value(V)))</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1793' href='#L_COMPARES_1793'><pre>1793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_SLT, V,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1794' href='#L_COMPARES_1794'><pre>1794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(V->getType(), 1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1795' href='#L_COMPARES_1795'><pre>1795</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1796' href='#L_COMPARES_1796'><pre>1796</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1797' href='#L_COMPARES_1797'><pre>1797</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.83k</span></div><div class='tooltip'>!Cmp.isEquality() || <span class='tooltip-content'>4.83k</span></div><div class='tooltip'>*C != 0<span class='tooltip-content'>4.00k</span></div> || <div class='tooltip'>!Or->hasOneUse()<span class='tooltip-content'>2.94k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1798' href='#L_COMPARES_1798'><pre>1798</pre></a></td><td class='covered-line'><pre>2.59k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1799' href='#L_COMPARES_1799'><pre>1799</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1800' href='#L_COMPARES_1800'><pre>1800</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> Value *P, *Q;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1801' href='#L_COMPARES_1801'><pre>1801</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Or, m_Or(m_PtrToInt(m_Value(P)), m_PtrToInt(m_Value(Q))))<span class='tooltip-content'>2.24k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1802' href='#L_COMPARES_1802'><pre>1802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1803' href='#L_COMPARES_1803'><pre>1803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // -> and (icmp eq P, null), (icmp eq Q, null).</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1804' href='#L_COMPARES_1804'><pre>1804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CmpP =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1805' href='#L_COMPARES_1805'><pre>1805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateICmp(Pred, P, ConstantInt::getNullValue(P->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1806' href='#L_COMPARES_1806'><pre>1806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *CmpQ =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1807' href='#L_COMPARES_1807'><pre>1807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateICmp(Pred, Q, ConstantInt::getNullValue(Q->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1808' href='#L_COMPARES_1808'><pre>1808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto LogicOpc = Pred == ICmpInst::Predicate::ICMP_EQ ? </span><span class='red'>Instruction::And</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1809' href='#L_COMPARES_1809'><pre>1809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Instruction::Or</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1810' href='#L_COMPARES_1810'><pre>1810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(LogicOpc, CmpP, CmpQ);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1811' href='#L_COMPARES_1811'><pre>1811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1812' href='#L_COMPARES_1812'><pre>1812</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1813' href='#L_COMPARES_1813'><pre>1813</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1814' href='#L_COMPARES_1814'><pre>1814</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1815' href='#L_COMPARES_1815'><pre>1815</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1816' href='#L_COMPARES_1816'><pre>1816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (mul X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1817' href='#L_COMPARES_1817'><pre>1817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpMulConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1818' href='#L_COMPARES_1818'><pre>1818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Mul,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1819' href='#L_COMPARES_1819'><pre>1819</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1820' href='#L_COMPARES_1820'><pre>1820</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> const APInt *MulC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1821' href='#L_COMPARES_1821'><pre>1821</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> if (!match(Mul->getOperand(1), m_APInt(MulC)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1822' href='#L_COMPARES_1822'><pre>1822</pre></a></td><td class='covered-line'><pre>226</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1823' href='#L_COMPARES_1823'><pre>1823</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1824' href='#L_COMPARES_1824'><pre>1824</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> // If this is a test of the sign bit and the multiply is sign-preserving with</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1825' href='#L_COMPARES_1825'><pre>1825</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> // a constant operand, use the multiply LHS operand instead.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1826' href='#L_COMPARES_1826'><pre>1826</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1827' href='#L_COMPARES_1827'><pre>1827</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> if (<div class='tooltip'>isSignTest(Pred, *C) && <span class='tooltip-content'>216</span></div><div class='tooltip'>Mul->hasNoSignedWrap()<span class='tooltip-content'>205</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1828' href='#L_COMPARES_1828'><pre>1828</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (MulC->isNegative())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1829' href='#L_COMPARES_1829'><pre>1829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Pred = ICmpInst::getSwappedPredicate(Pred)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1830' href='#L_COMPARES_1830'><pre>1830</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new ICmpInst(Pred, Mul->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1831' href='#L_COMPARES_1831'><pre>1831</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Constant::getNullValue(Mul->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1832' href='#L_COMPARES_1832'><pre>1832</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1833' href='#L_COMPARES_1833'><pre>1833</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1834' href='#L_COMPARES_1834'><pre>1834</pre></a></td><td class='covered-line'><pre>212</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1835' href='#L_COMPARES_1835'><pre>1835</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1836' href='#L_COMPARES_1836'><pre>1836</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1837' href='#L_COMPARES_1837'><pre>1837</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (shl 1, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1838' href='#L_COMPARES_1838'><pre>1838</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1839' href='#L_COMPARES_1839'><pre>1839</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1840' href='#L_COMPARES_1840'><pre>1840</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> Value *Y;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1841' href='#L_COMPARES_1841'><pre>1841</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> if (!match(Shl, m_Shl(m_One(), m_Value(Y))))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1842' href='#L_COMPARES_1842'><pre>1842</pre></a></td><td class='covered-line'><pre>96</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1843' href='#L_COMPARES_1843'><pre>1843</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1844' href='#L_COMPARES_1844'><pre>1844</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Type *ShiftType = Shl->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1845' href='#L_COMPARES_1845'><pre>1845</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> uint32_t TypeBits = C->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1846' href='#L_COMPARES_1846'><pre>1846</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> bool CIsPowerOf2 = C->isPowerOf2();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1847' href='#L_COMPARES_1847'><pre>1847</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1848' href='#L_COMPARES_1848'><pre>1848</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isUnsigned()<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1849' href='#L_COMPARES_1849'><pre>1849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) pred C -> Y pred Log2(C)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1850' href='#L_COMPARES_1850'><pre>1850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CIsPowerOf2</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1851' href='#L_COMPARES_1851'><pre>1851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) < 30 -> Y <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1852' href='#L_COMPARES_1852'><pre>1852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) <= 30 -> Y <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1853' href='#L_COMPARES_1853'><pre>1853</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) >= 30 -> Y > 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1854' href='#L_COMPARES_1854'><pre>1854</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) > 30 -> Y > 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1855' href='#L_COMPARES_1855'><pre>1855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Pred == ICmpInst::ICMP_ULT</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1856' href='#L_COMPARES_1856'><pre>1856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_ULE</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1857' href='#L_COMPARES_1857'><pre>1857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_UGE</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1858' href='#L_COMPARES_1858'><pre>1858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_UGT</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1859' href='#L_COMPARES_1859'><pre>1859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1860' href='#L_COMPARES_1860'><pre>1860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1861' href='#L_COMPARES_1861'><pre>1861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) >= 2147483648 -> Y >= 31 -> Y == 31</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1862' href='#L_COMPARES_1862'><pre>1862</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) < 2147483648 -> Y < 31 -> Y != 31</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1863' href='#L_COMPARES_1863'><pre>1863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned CLog2 = C->logBase2();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1864' href='#L_COMPARES_1864'><pre>1864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CLog2 == TypeBits - 1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1865' href='#L_COMPARES_1865'><pre>1865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Pred == ICmpInst::ICMP_UGE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1866' href='#L_COMPARES_1866'><pre>1866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_EQ</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1867' href='#L_COMPARES_1867'><pre>1867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1868' href='#L_COMPARES_1868'><pre>1868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_NE</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1869' href='#L_COMPARES_1869'><pre>1869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1870' href='#L_COMPARES_1870'><pre>1870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, CLog2));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1871' href='#L_COMPARES_1871'><pre>1871</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>Cmp.isSigned()<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1872' href='#L_COMPARES_1872'><pre>1872</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *BitWidthMinusOne = ConstantInt::get(ShiftType, TypeBits - 1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1873' href='#L_COMPARES_1873'><pre>1873</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>C->isAllOnesValue()<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1874' href='#L_COMPARES_1874'><pre>1874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) <= -1 -> Y == 31</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1875' href='#L_COMPARES_1875'><pre>1875</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Pred == ICmpInst::ICMP_SLE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1876' href='#L_COMPARES_1876'><pre>1876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1877' href='#L_COMPARES_1877'><pre>1877</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1878' href='#L_COMPARES_1878'><pre>1878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (1 << Y) > -1 -> Y != 31</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1879' href='#L_COMPARES_1879'><pre>1879</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1880' href='#L_COMPARES_1880'><pre>1880</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1881' href='#L_COMPARES_1881'><pre>1881</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>!(*C)<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1882' href='#L_COMPARES_1882'><pre>1882</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (1 << Y) < 0 -> Y == 31</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1883' href='#L_COMPARES_1883'><pre>1883</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (1 << Y) <= 0 -> Y == 31</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1884' href='#L_COMPARES_1884'><pre>1884</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SLT || <span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLE<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1885' href='#L_COMPARES_1885'><pre>1885</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1886' href='#L_COMPARES_1886'><pre>1886</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1887' href='#L_COMPARES_1887'><pre>1887</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (1 << Y) >= 0 -> Y != 31</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1888' href='#L_COMPARES_1888'><pre>1888</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (1 << Y) > 0 -> Y != 31</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1889' href='#L_COMPARES_1889'><pre>1889</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SGT || <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1890' href='#L_COMPARES_1890'><pre>1890</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Y, BitWidthMinusOne);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1891' href='#L_COMPARES_1891'><pre>1891</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1892' href='#L_COMPARES_1892'><pre>1892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Cmp.isEquality() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CIsPowerOf2</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1893' href='#L_COMPARES_1893'><pre>1893</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, C->logBase2()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1894' href='#L_COMPARES_1894'><pre>1894</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1895' href='#L_COMPARES_1895'><pre>1895</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1896' href='#L_COMPARES_1896'><pre>1896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1897' href='#L_COMPARES_1897'><pre>1897</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1898' href='#L_COMPARES_1898'><pre>1898</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1899' href='#L_COMPARES_1899'><pre>1899</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (shl X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1900' href='#L_COMPARES_1900'><pre>1900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpShlConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1901' href='#L_COMPARES_1901'><pre>1901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Shl,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1902' href='#L_COMPARES_1902'><pre>1902</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1903' href='#L_COMPARES_1903'><pre>1903</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> const APInt *ShiftVal;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1904' href='#L_COMPARES_1904'><pre>1904</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isEquality() && <span class='tooltip-content'>1.33k</span></div><div class='tooltip'>match(Shl->getOperand(0), m_APInt(ShiftVal))<span class='tooltip-content'>83</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1905' href='#L_COMPARES_1905'><pre>1905</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return foldICmpShlConstConst(Cmp, Shl->getOperand(1), *C, *ShiftVal);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1906' href='#L_COMPARES_1906'><pre>1906</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1907' href='#L_COMPARES_1907'><pre>1907</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> const APInt *ShiftAmt;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1908' href='#L_COMPARES_1908'><pre>1908</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> if (!match(Shl->getOperand(1), m_APInt(ShiftAmt)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1909' href='#L_COMPARES_1909'><pre>1909</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> return foldICmpShlOne(Cmp, Shl, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1910' href='#L_COMPARES_1910'><pre>1910</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1911' href='#L_COMPARES_1911'><pre>1911</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // Check that the shift amount is in range. If not, don't perform undefined</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1912' href='#L_COMPARES_1912'><pre>1912</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> // shifts. When the shift is visited, it will be simplified.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1913' href='#L_COMPARES_1913'><pre>1913</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> unsigned TypeBits = C->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1914' href='#L_COMPARES_1914'><pre>1914</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> if (ShiftAmt->uge(TypeBits))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1915' href='#L_COMPARES_1915'><pre>1915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1916' href='#L_COMPARES_1916'><pre>1916</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1917' href='#L_COMPARES_1917'><pre>1917</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1918' href='#L_COMPARES_1918'><pre>1918</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> Value *X = Shl->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1919' href='#L_COMPARES_1919'><pre>1919</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> Type *ShType = Shl->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1920' href='#L_COMPARES_1920'><pre>1920</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1921' href='#L_COMPARES_1921'><pre>1921</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // NSW guarantees that we are only shifting out sign bits from the high bits,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1922' href='#L_COMPARES_1922'><pre>1922</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // so we can ASHR the compare constant without needing a mask and eliminate</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1923' href='#L_COMPARES_1923'><pre>1923</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // the shift.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1924' href='#L_COMPARES_1924'><pre>1924</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> if (<div class='tooltip'>Shl->hasNoSignedWrap()<span class='tooltip-content'>1.24k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>57</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1925' href='#L_COMPARES_1925'><pre>1925</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SGT<span class='tooltip-content'>57</span></div>) <div class='tooltip'>{<span class='tooltip-content'>11</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1926' href='#L_COMPARES_1926'><pre>1926</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> // icmp Pred (shl nsw X, ShiftAmt), C --> icmp Pred X, (C >>s ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1927' href='#L_COMPARES_1927'><pre>1927</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> APInt ShiftedC = C->ashr(*ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1928' href='#L_COMPARES_1928'><pre>1928</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1929' href='#L_COMPARES_1929'><pre>1929</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1930' href='#L_COMPARES_1930'><pre>1930</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>46</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_EQ || <span class='tooltip-content'>46</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_NE<span class='tooltip-content'>29</span></div>) <div class='tooltip'>{<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1931' href='#L_COMPARES_1931'><pre>1931</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // This is the same code as the SGT case, but assert the pre-condition</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1932' href='#L_COMPARES_1932'><pre>1932</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> // that is needed for this to work with equality predicates.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1933' href='#L_COMPARES_1933'><pre>1933</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> assert(C->ashr(*ShiftAmt).shl(*ShiftAmt) == *C &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1934' href='#L_COMPARES_1934'><pre>1934</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> "Compare known true or false was not folded");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1935' href='#L_COMPARES_1935'><pre>1935</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> APInt ShiftedC = C->ashr(*ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1936' href='#L_COMPARES_1936'><pre>1936</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1937' href='#L_COMPARES_1937'><pre>1937</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1938' href='#L_COMPARES_1938'><pre>1938</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>25</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT<span class='tooltip-content'>25</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1939' href='#L_COMPARES_1939'><pre>1939</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // SLE is the same as above, but SLE is canonicalized to SLT, so convert:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1940' href='#L_COMPARES_1940'><pre>1940</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // (X << S) <=s C is equiv to X <=s (C >> S) for all C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1941' href='#L_COMPARES_1941'><pre>1941</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // (X << S) <s (C + 1) is equiv to X <s (C >> S) + 1 if C <s SMAX</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1942' href='#L_COMPARES_1942'><pre>1942</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // (X << S) <s C is equiv to X <s ((C - 1) >> S) + 1 if C >s SMIN</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1943' href='#L_COMPARES_1943'><pre>1943</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> assert(!C->isMinSignedValue() && "Unexpected icmp slt");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1944' href='#L_COMPARES_1944'><pre>1944</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> APInt ShiftedC = (*C - 1).ashr(*ShiftAmt) + 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1945' href='#L_COMPARES_1945'><pre>1945</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1946' href='#L_COMPARES_1946'><pre>1946</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1947' href='#L_COMPARES_1947'><pre>1947</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> // If this is a signed comparison to 0 and the shift is sign preserving,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1948' href='#L_COMPARES_1948'><pre>1948</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> // use the shift LHS operand instead; isSignTest may change 'Pred', so only</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1949' href='#L_COMPARES_1949'><pre>1949</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> // do that if we're sure to not continue on in this function.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1950' href='#L_COMPARES_1950'><pre>1950</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16</span></div><div class='tooltip'>isSignTest(Pred, *C)<span class='tooltip-content'>16</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1951' href='#L_COMPARES_1951'><pre>1951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, X, Constant::getNullValue(ShType))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1952' href='#L_COMPARES_1952'><pre>1952</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1953' href='#L_COMPARES_1953'><pre>1953</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1954' href='#L_COMPARES_1954'><pre>1954</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // NUW guarantees that we are only shifting out zero bits from the high bits,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1955' href='#L_COMPARES_1955'><pre>1955</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // so we can LSHR the compare constant without needing a mask and eliminate</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1956' href='#L_COMPARES_1956'><pre>1956</pre></a></td><td class='covered-line'><pre>1.24k</pre></td><td class='code'><pre> // the shift.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1957' href='#L_COMPARES_1957'><pre>1957</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.19k</span></div><div class='tooltip'>Shl->hasNoUnsignedWrap()<span class='tooltip-content'>1.19k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1958' href='#L_COMPARES_1958'><pre>1958</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_UGT<span class='tooltip-content'>3</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1959' href='#L_COMPARES_1959'><pre>1959</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // icmp Pred (shl nuw X, ShiftAmt), C --> icmp Pred X, (C >>u ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1960' href='#L_COMPARES_1960'><pre>1960</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt ShiftedC = C->lshr(*ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1961' href='#L_COMPARES_1961'><pre>1961</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1962' href='#L_COMPARES_1962'><pre>1962</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1963' href='#L_COMPARES_1963'><pre>1963</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_EQ || <span class='tooltip-content'>2</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_NE<span class='tooltip-content'>2</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1964' href='#L_COMPARES_1964'><pre>1964</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is the same code as the UGT case, but assert the pre-condition</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1965' href='#L_COMPARES_1965'><pre>1965</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that is needed for this to work with equality predicates.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1966' href='#L_COMPARES_1966'><pre>1966</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(C->lshr(*ShiftAmt).shl(*ShiftAmt) == *C &&</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1967' href='#L_COMPARES_1967'><pre>1967</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Compare known true or false was not folded");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1968' href='#L_COMPARES_1968'><pre>1968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt ShiftedC = C->lshr(*ShiftAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1969' href='#L_COMPARES_1969'><pre>1969</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1970' href='#L_COMPARES_1970'><pre>1970</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1971' href='#L_COMPARES_1971'><pre>1971</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT<span class='tooltip-content'>2</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1972' href='#L_COMPARES_1972'><pre>1972</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // ULE is the same as above, but ULE is canonicalized to ULT, so convert:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1973' href='#L_COMPARES_1973'><pre>1973</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // (X << S) <=u C is equiv to X <=u (C >> S) for all C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1974' href='#L_COMPARES_1974'><pre>1974</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // (X << S) <u (C + 1) is equiv to X <u (C >> S) + 1 if C <u ~0u</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1975' href='#L_COMPARES_1975'><pre>1975</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // (X << S) <u C is equiv to X <u ((C - 1) >> S) + 1 if C >u 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1976' href='#L_COMPARES_1976'><pre>1976</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> assert(C->ugt(0) && "ult 0 should have been eliminated");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1977' href='#L_COMPARES_1977'><pre>1977</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> APInt ShiftedC = (*C - 1).lshr(*ShiftAmt) + 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1978' href='#L_COMPARES_1978'><pre>1978</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1979' href='#L_COMPARES_1979'><pre>1979</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1980' href='#L_COMPARES_1980'><pre>1980</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1981' href='#L_COMPARES_1981'><pre>1981</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1982' href='#L_COMPARES_1982'><pre>1982</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.19k</span></div><div class='tooltip'>Cmp.isEquality() && <span class='tooltip-content'>1.19k</span></div><div class='tooltip'>Shl->hasOneUse()<span class='tooltip-content'>60</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1983' href='#L_COMPARES_1983'><pre>1983</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // Strength-reduce the shift into an 'and'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1984' href='#L_COMPARES_1984'><pre>1984</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Constant *Mask = ConstantInt::get(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1985' href='#L_COMPARES_1985'><pre>1985</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> ShType,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1986' href='#L_COMPARES_1986'><pre>1986</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> APInt::getLowBitsSet(TypeBits, TypeBits - ShiftAmt->getZExtValue()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1987' href='#L_COMPARES_1987'><pre>1987</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(X, Mask, Shl->getName() + ".mask");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1988' href='#L_COMPARES_1988'><pre>1988</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Constant *LShrC = ConstantInt::get(ShType, C->lshr(*ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1989' href='#L_COMPARES_1989'><pre>1989</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return new ICmpInst(Pred, And, LShrC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1990' href='#L_COMPARES_1990'><pre>1990</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1991' href='#L_COMPARES_1991'><pre>1991</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1992' href='#L_COMPARES_1992'><pre>1992</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> // Otherwise, if this is a comparison of the sign bit, simplify to and/test.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1993' href='#L_COMPARES_1993'><pre>1993</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> bool TrueIfSigned = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1994' href='#L_COMPARES_1994'><pre>1994</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> if (<div class='tooltip'>Shl->hasOneUse() && <span class='tooltip-content'>1.18k</span></div><div class='tooltip'>isSignBitCheck(Pred, *C, TrueIfSigned)<span class='tooltip-content'>25</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1995' href='#L_COMPARES_1995'><pre>1995</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // (X << 31) <s 0 --> (X & 1) != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1996' href='#L_COMPARES_1996'><pre>1996</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Constant *Mask = ConstantInt::get(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1997' href='#L_COMPARES_1997'><pre>1997</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ShType,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1998' href='#L_COMPARES_1998'><pre>1998</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> APInt::getOneBitSet(TypeBits, TypeBits - ShiftAmt->getZExtValue() - 1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_1999' href='#L_COMPARES_1999'><pre>1999</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(X, Mask, Shl->getName() + ".mask");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2000' href='#L_COMPARES_2000'><pre>2000</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return new ICmpInst(TrueIfSigned ? <div class='tooltip'>ICmpInst::ICMP_NE<span class='tooltip-content'>3</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_EQ</span><span class='tooltip-content'>0</span></div>,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2001' href='#L_COMPARES_2001'><pre>2001</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> And, Constant::getNullValue(ShType));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2002' href='#L_COMPARES_2002'><pre>2002</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2003' href='#L_COMPARES_2003'><pre>2003</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2004' href='#L_COMPARES_2004'><pre>2004</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // Transform (icmp pred iM (shl iM %v, N), C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2005' href='#L_COMPARES_2005'><pre>2005</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // -> (icmp pred i(M-N) (trunc %v iM to i(M-N)), (trunc (C>>N))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2006' href='#L_COMPARES_2006'><pre>2006</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // Transform the shl to a trunc if (trunc (C>>N)) has no loss and M-N.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2007' href='#L_COMPARES_2007'><pre>2007</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // This enables us to get rid of the shift in favor of a trunc that may be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2008' href='#L_COMPARES_2008'><pre>2008</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // free on the target. It has the additional benefit of comparing to a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2009' href='#L_COMPARES_2009'><pre>2009</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> // smaller constant that may be more target-friendly.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2010' href='#L_COMPARES_2010'><pre>2010</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> unsigned Amt = ShiftAmt->getLimitedValue(TypeBits - 1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2011' href='#L_COMPARES_2011'><pre>2011</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> if (<div class='tooltip'>Shl->hasOneUse() && <span class='tooltip-content'>1.18k</span></div><div class='tooltip'>Amt != 0<span class='tooltip-content'>22</span></div> && <div class='tooltip'>C->countTrailingZeros() >= Amt<span class='tooltip-content'>22</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2012' href='#L_COMPARES_2012'><pre>2012</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>DL.isLegalInteger(TypeBits - Amt)<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2013' href='#L_COMPARES_2013'><pre>2013</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Type *TruncTy = IntegerType::get(Cmp.getContext(), TypeBits - Amt);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2014' href='#L_COMPARES_2014'><pre>2014</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (ShType->isVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2015' href='#L_COMPARES_2015'><pre>2015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>TruncTy = VectorType::get(TruncTy, ShType->getVectorNumElements())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2016' href='#L_COMPARES_2016'><pre>2016</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Constant *NewC =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2017' href='#L_COMPARES_2017'><pre>2017</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> ConstantInt::get(TruncTy, C->ashr(*ShiftAmt).trunc(TypeBits - Amt));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2018' href='#L_COMPARES_2018'><pre>2018</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return new ICmpInst(Pred, Builder->CreateTrunc(X, TruncTy), NewC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2019' href='#L_COMPARES_2019'><pre>2019</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2020' href='#L_COMPARES_2020'><pre>2020</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2021' href='#L_COMPARES_2021'><pre>2021</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2022' href='#L_COMPARES_2022'><pre>2022</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2023' href='#L_COMPARES_2023'><pre>2023</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2024' href='#L_COMPARES_2024'><pre>2024</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp ({al}shr X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2025' href='#L_COMPARES_2025'><pre>2025</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpShrConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2026' href='#L_COMPARES_2026'><pre>2026</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Shr,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2027' href='#L_COMPARES_2027'><pre>2027</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2028' href='#L_COMPARES_2028'><pre>2028</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> // An exact shr only shifts out zero bits, so:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2029' href='#L_COMPARES_2029'><pre>2029</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> // icmp eq/ne (shr X, Y), 0 --> icmp eq/ne X, 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2030' href='#L_COMPARES_2030'><pre>2030</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> Value *X = Shr->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2031' href='#L_COMPARES_2031'><pre>2031</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> CmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2032' href='#L_COMPARES_2032'><pre>2032</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isEquality() && <span class='tooltip-content'>6.64k</span></div><div class='tooltip'>Shr->isExact()<span class='tooltip-content'>4.70k</span></div> && <div class='tooltip'>Shr->hasOneUse()<span class='tooltip-content'>3.23k</span></div> && <div class='tooltip'>*C == 0<span class='tooltip-content'>54</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2033' href='#L_COMPARES_2033'><pre>2033</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, Cmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2034' href='#L_COMPARES_2034'><pre>2034</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2035' href='#L_COMPARES_2035'><pre>2035</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> const APInt *ShiftVal;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2036' href='#L_COMPARES_2036'><pre>2036</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isEquality() && <span class='tooltip-content'>6.60k</span></div><div class='tooltip'>match(Shr->getOperand(0), m_APInt(ShiftVal))<span class='tooltip-content'>4.66k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2037' href='#L_COMPARES_2037'><pre>2037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return foldICmpShrConstConst(Cmp, Shr->getOperand(1), *C, *ShiftVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2038' href='#L_COMPARES_2038'><pre>2038</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2039' href='#L_COMPARES_2039'><pre>2039</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> const APInt *ShiftAmt;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2040' href='#L_COMPARES_2040'><pre>2040</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> if (!match(Shr->getOperand(1), m_APInt(ShiftAmt)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2041' href='#L_COMPARES_2041'><pre>2041</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2042' href='#L_COMPARES_2042'><pre>2042</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2043' href='#L_COMPARES_2043'><pre>2043</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> // Check that the shift amount is in range. If not, don't perform undefined</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2044' href='#L_COMPARES_2044'><pre>2044</pre></a></td><td class='covered-line'><pre>6.60k</pre></td><td class='code'><pre> // shifts. When the shift is visited it will be simplified.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2045' href='#L_COMPARES_2045'><pre>2045</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> unsigned TypeBits = C->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2046' href='#L_COMPARES_2046'><pre>2046</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> unsigned ShAmtVal = ShiftAmt->getLimitedValue(TypeBits);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2047' href='#L_COMPARES_2047'><pre>2047</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> if (<div class='tooltip'>ShAmtVal >= TypeBits || <span class='tooltip-content'>5.57k</span></div><div class='tooltip'>ShAmtVal == 0<span class='tooltip-content'>5.57k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2048' href='#L_COMPARES_2048'><pre>2048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2049' href='#L_COMPARES_2049'><pre>2049</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2050' href='#L_COMPARES_2050'><pre>2050</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> bool IsAShr = Shr->getOpcode() == Instruction::AShr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2051' href='#L_COMPARES_2051'><pre>2051</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.isEquality()<span class='tooltip-content'>5.57k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.28k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2052' href='#L_COMPARES_2052'><pre>2052</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> // If we have an unsigned comparison and an ashr, we can't simplify this.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2053' href='#L_COMPARES_2053'><pre>2053</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> // Similarly for signed comparisons with lshr.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2054' href='#L_COMPARES_2054'><pre>2054</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> if (Cmp.isSigned() != IsAShr)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2055' href='#L_COMPARES_2055'><pre>2055</pre></a></td><td class='covered-line'><pre>746</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2056' href='#L_COMPARES_2056'><pre>2056</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2057' href='#L_COMPARES_2057'><pre>2057</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> // Otherwise, all lshr and most exact ashr's are equivalent to a udiv/sdiv</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2058' href='#L_COMPARES_2058'><pre>2058</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> // by a power of 2. Since we already have logic to simplify these,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2059' href='#L_COMPARES_2059'><pre>2059</pre></a></td><td class='covered-line'><pre>1.28k</pre></td><td class='code'><pre> // transform to div and then simplify the resultant comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2060' href='#L_COMPARES_2060'><pre>2060</pre></a></td><td class='covered-line'><pre>543</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>543</span></div><div class='tooltip'>IsAShr && <span class='tooltip-content'>543</span></div><div class='tooltip'>(!Shr->isExact() || <span class='tooltip-content'>509</span></div><div class='tooltip'>ShAmtVal == TypeBits - 1<span class='tooltip-content'>52</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2061' href='#L_COMPARES_2061'><pre>2061</pre></a></td><td class='covered-line'><pre>457</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2062' href='#L_COMPARES_2062'><pre>2062</pre></a></td><td class='covered-line'><pre>543</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2063' href='#L_COMPARES_2063'><pre>2063</pre></a></td><td class='covered-line'><pre>543</pre></td><td class='code'><pre> // Revisit the shift (to delete it).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2064' href='#L_COMPARES_2064'><pre>2064</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Worklist.Add(Shr);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2065' href='#L_COMPARES_2065'><pre>2065</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2066' href='#L_COMPARES_2066'><pre>2066</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Constant *DivCst = ConstantInt::get(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2067' href='#L_COMPARES_2067'><pre>2067</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Shr->getType(), APInt::getOneBitSet(TypeBits, ShAmtVal));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2068' href='#L_COMPARES_2068'><pre>2068</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2069' href='#L_COMPARES_2069'><pre>2069</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> Value *Tmp = IsAShr ? Builder->CreateSDiv(X, DivCst, "", Shr->isExact())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2070' href='#L_COMPARES_2070'><pre>2070</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> : Builder->CreateUDiv(X, DivCst, "", Shr->isExact());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2071' href='#L_COMPARES_2071'><pre>2071</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2072' href='#L_COMPARES_2072'><pre>2072</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Cmp.setOperand(0, Tmp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2073' href='#L_COMPARES_2073'><pre>2073</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2074' href='#L_COMPARES_2074'><pre>2074</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> // If the builder folded the binop, just return it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2075' href='#L_COMPARES_2075'><pre>2075</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> BinaryOperator *TheDiv = dyn_cast<BinaryOperator>(Tmp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2076' href='#L_COMPARES_2076'><pre>2076</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> if (!TheDiv)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2077' href='#L_COMPARES_2077'><pre>2077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &Cmp</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2078' href='#L_COMPARES_2078'><pre>2078</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2079' href='#L_COMPARES_2079'><pre>2079</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> // Otherwise, fold this div/compare.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2080' href='#L_COMPARES_2080'><pre>2080</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> assert(TheDiv->getOpcode() == Instruction::SDiv ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2081' href='#L_COMPARES_2081'><pre>2081</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> TheDiv->getOpcode() == Instruction::UDiv);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2082' href='#L_COMPARES_2082'><pre>2082</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2083' href='#L_COMPARES_2083'><pre>2083</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> Instruction *Res = foldICmpDivConstant(Cmp, TheDiv, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2084' href='#L_COMPARES_2084'><pre>2084</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> assert(Res && "This div/cst should have folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2085' href='#L_COMPARES_2085'><pre>2085</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2086' href='#L_COMPARES_2086'><pre>2086</pre></a></td><td class='covered-line'><pre>86</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2087' href='#L_COMPARES_2087'><pre>2087</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2088' href='#L_COMPARES_2088'><pre>2088</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> // Handle equality comparisons of shift-by-constant.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2089' href='#L_COMPARES_2089'><pre>2089</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2090' href='#L_COMPARES_2090'><pre>2090</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> // If the comparison constant changes with the shift, the comparison cannot</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2091' href='#L_COMPARES_2091'><pre>2091</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> // succeed (bits of the comparison constant cannot match the shifted value).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2092' href='#L_COMPARES_2092'><pre>2092</pre></a></td><td class='covered-line'><pre>5.57k</pre></td><td class='code'><pre> // This should be known by InstSimplify and already be folded to true/false.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2093' href='#L_COMPARES_2093'><pre>2093</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> assert(((IsAShr && C->shl(ShAmtVal).ashr(ShAmtVal) == *C) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2094' href='#L_COMPARES_2094'><pre>2094</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> (!IsAShr && C->shl(ShAmtVal).lshr(ShAmtVal) == *C)) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2095' href='#L_COMPARES_2095'><pre>2095</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> "Expected icmp+shr simplify did not occur.");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2096' href='#L_COMPARES_2096'><pre>2096</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2097' href='#L_COMPARES_2097'><pre>2097</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> // Check if the bits shifted out are known to be zero. If so, we can compare</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2098' href='#L_COMPARES_2098'><pre>2098</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> // against the unshifted value:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2099' href='#L_COMPARES_2099'><pre>2099</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> // (X & 4) >> 1 == 2 --> (X & 4) == 4.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2100' href='#L_COMPARES_2100'><pre>2100</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> Constant *ShiftedCmpRHS = ConstantInt::get(Shr->getType(), *C << ShAmtVal);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2101' href='#L_COMPARES_2101'><pre>2101</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre> if (<div class='tooltip'>Shr->hasOneUse()<span class='tooltip-content'>4.29k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>161</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2102' href='#L_COMPARES_2102'><pre>2102</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> if (Shr->isExact())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2103' href='#L_COMPARES_2103'><pre>2103</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ShiftedCmpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2104' href='#L_COMPARES_2104'><pre>2104</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2105' href='#L_COMPARES_2105'><pre>2105</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> // Otherwise strength reduce the shift into an 'and'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2106' href='#L_COMPARES_2106'><pre>2106</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2107' href='#L_COMPARES_2107'><pre>2107</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> Constant *Mask = ConstantInt::get(Shr->getType(), Val);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2108' href='#L_COMPARES_2108'><pre>2108</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(X, Mask, Shr->getName() + ".mask");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2109' href='#L_COMPARES_2109'><pre>2109</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> return new ICmpInst(Pred, And, ShiftedCmpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2110' href='#L_COMPARES_2110'><pre>2110</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2111' href='#L_COMPARES_2111'><pre>2111</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2112' href='#L_COMPARES_2112'><pre>2112</pre></a></td><td class='covered-line'><pre>4.12k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2113' href='#L_COMPARES_2113'><pre>2113</pre></a></td><td class='covered-line'><pre>4.29k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2114' href='#L_COMPARES_2114'><pre>2114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2115' href='#L_COMPARES_2115'><pre>2115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (udiv X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2116' href='#L_COMPARES_2116'><pre>2116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpUDivConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2117' href='#L_COMPARES_2117'><pre>2117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *UDiv,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2118' href='#L_COMPARES_2118'><pre>2118</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2119' href='#L_COMPARES_2119'><pre>2119</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2120' href='#L_COMPARES_2120'><pre>2120</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> if (!match(UDiv->getOperand(0), m_APInt(C2)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2121' href='#L_COMPARES_2121'><pre>2121</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2122' href='#L_COMPARES_2122'><pre>2122</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2123' href='#L_COMPARES_2123'><pre>2123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> assert<span class='red'>(C2 != 0 && "udiv 0, X should have been simplified already.");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2124' href='#L_COMPARES_2124'><pre>2124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2125' href='#L_COMPARES_2125'><pre>2125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (icmp ugt (udiv C2, Y), C) -> (icmp ule Y, C2/(C+1))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2126' href='#L_COMPARES_2126'><pre>2126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Y = UDiv->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2127' href='#L_COMPARES_2127'><pre>2127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Cmp.getPredicate() == ICmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2128' href='#L_COMPARES_2128'><pre>2128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(!C->isMaxValue() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2129' href='#L_COMPARES_2129'><pre>2129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "icmp ugt X, UINT_MAX should have been simplified already.");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2130' href='#L_COMPARES_2130'><pre>2130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_ULE, Y,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2131' href='#L_COMPARES_2131'><pre>2131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(Y->getType(), C2->udiv(*C + 1)));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2132' href='#L_COMPARES_2132'><pre>2132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2133' href='#L_COMPARES_2133'><pre>2133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2134' href='#L_COMPARES_2134'><pre>2134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (icmp ult (udiv C2, Y), C) -> (icmp ugt Y, C2/C)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2135' href='#L_COMPARES_2135'><pre>2135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Cmp.getPredicate() == ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2136' href='#L_COMPARES_2136'><pre>2136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(C != 0 && "icmp ult X, 0 should have been simplified already.");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2137' href='#L_COMPARES_2137'><pre>2137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_UGT, Y,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2138' href='#L_COMPARES_2138'><pre>2138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(Y->getType(), C2->udiv(*C)));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2139' href='#L_COMPARES_2139'><pre>2139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2140' href='#L_COMPARES_2140'><pre>2140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2141' href='#L_COMPARES_2141'><pre>2141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2142' href='#L_COMPARES_2142'><pre>2142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2143' href='#L_COMPARES_2143'><pre>2143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2144' href='#L_COMPARES_2144'><pre>2144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp ({su}div X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2145' href='#L_COMPARES_2145'><pre>2145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpDivConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2146' href='#L_COMPARES_2146'><pre>2146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Div,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2147' href='#L_COMPARES_2147'><pre>2147</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2148' href='#L_COMPARES_2148'><pre>2148</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // Fold: icmp pred ([us]div X, C2), C -> range test</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2149' href='#L_COMPARES_2149'><pre>2149</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // Fold this div into the comparison, producing a range check.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2150' href='#L_COMPARES_2150'><pre>2150</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // Determine, based on the divide type, what the range is being</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2151' href='#L_COMPARES_2151'><pre>2151</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // checked. If there is an overflow on the low or high side, remember</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2152' href='#L_COMPARES_2152'><pre>2152</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // it, otherwise compute the range [low, hi) bounding the new value.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2153' href='#L_COMPARES_2153'><pre>2153</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // See: InsertRangeTest above for the kinds of replacements possible.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2154' href='#L_COMPARES_2154'><pre>2154</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2155' href='#L_COMPARES_2155'><pre>2155</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> if (!match(Div->getOperand(1), m_APInt(C2)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2156' href='#L_COMPARES_2156'><pre>2156</pre></a></td><td class='covered-line'><pre>210</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2157' href='#L_COMPARES_2157'><pre>2157</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2158' href='#L_COMPARES_2158'><pre>2158</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // FIXME: If the operand types don't match the type of the divide</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2159' href='#L_COMPARES_2159'><pre>2159</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // then don't attempt this transform. The code below doesn't have the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2160' href='#L_COMPARES_2160'><pre>2160</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // logic to deal with a signed divide and an unsigned compare (and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2161' href='#L_COMPARES_2161'><pre>2161</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // vice versa). This is because (x /s C2) <s C produces different</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2162' href='#L_COMPARES_2162'><pre>2162</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // results than (x /s C2) <u C or (x /u C2) <s C or even</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2163' href='#L_COMPARES_2163'><pre>2163</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // (x /u C2) <u C. Simply casting the operands and result won't</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2164' href='#L_COMPARES_2164'><pre>2164</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // work. :( The if statement below tests that condition and bails</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2165' href='#L_COMPARES_2165'><pre>2165</pre></a></td><td class='covered-line'><pre>567</pre></td><td class='code'><pre> // if it finds it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2166' href='#L_COMPARES_2166'><pre>2166</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> bool DivIsSigned = Div->getOpcode() == Instruction::SDiv;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2167' href='#L_COMPARES_2167'><pre>2167</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.isEquality() && <span class='tooltip-content'>357</span></div><div class='tooltip'>DivIsSigned != Cmp.isSigned()<span class='tooltip-content'>335</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2168' href='#L_COMPARES_2168'><pre>2168</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2169' href='#L_COMPARES_2169'><pre>2169</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2170' href='#L_COMPARES_2170'><pre>2170</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> // The ProdOV computation fails on divide by 0 and divide by -1. Cases with</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2171' href='#L_COMPARES_2171'><pre>2171</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> // INT_MIN will also fail if the divisor is 1. Although folds of all these</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2172' href='#L_COMPARES_2172'><pre>2172</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> // division-by-constant cases should be present, we can not assert that they</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2173' href='#L_COMPARES_2173'><pre>2173</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> // have happened before we reach this icmp instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2174' href='#L_COMPARES_2174'><pre>2174</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>190</span></div><div class='tooltip'>*C2 == 0 || <span class='tooltip-content'>190</span></div><div class='tooltip'>*C2 == 1<span class='tooltip-content'>190</span></div> || <div class='tooltip'>(DivIsSigned && <span class='tooltip-content'>190</span></div><div class='tooltip'>C2->isAllOnesValue()<span class='tooltip-content'>152</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2175' href='#L_COMPARES_2175'><pre>2175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2176' href='#L_COMPARES_2176'><pre>2176</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2177' href='#L_COMPARES_2177'><pre>2177</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // TODO: We could do all of the computations below using APInt.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2178' href='#L_COMPARES_2178'><pre>2178</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Constant *CmpRHS = cast<Constant>(Cmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2179' href='#L_COMPARES_2179'><pre>2179</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Constant *DivRHS = cast<Constant>(Div->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2180' href='#L_COMPARES_2180'><pre>2180</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2181' href='#L_COMPARES_2181'><pre>2181</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // Compute Prod = CmpRHS * DivRHS. We are essentially solving an equation of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2182' href='#L_COMPARES_2182'><pre>2182</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // form X / C2 = C. We solve for X by multiplying C2 (DivRHS) and C (CmpRHS).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2183' href='#L_COMPARES_2183'><pre>2183</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // By solving for X, we can turn this into a range check instead of computing</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2184' href='#L_COMPARES_2184'><pre>2184</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // a divide.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2185' href='#L_COMPARES_2185'><pre>2185</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Constant *Prod = ConstantExpr::getMul(CmpRHS, DivRHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2186' href='#L_COMPARES_2186'><pre>2186</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2187' href='#L_COMPARES_2187'><pre>2187</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // Determine if the product overflows by seeing if the product is not equal to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2188' href='#L_COMPARES_2188'><pre>2188</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // the divide. Make sure we do the same kind of divide as in the LHS</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2189' href='#L_COMPARES_2189'><pre>2189</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // instruction that we're folding.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2190' href='#L_COMPARES_2190'><pre>2190</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2191' href='#L_COMPARES_2191'><pre>2191</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> : ConstantExpr::getUDiv(Prod, DivRHS)) != CmpRHS;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2192' href='#L_COMPARES_2192'><pre>2192</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2193' href='#L_COMPARES_2193'><pre>2193</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2194' href='#L_COMPARES_2194'><pre>2194</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2195' href='#L_COMPARES_2195'><pre>2195</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // If the division is known to be exact, then there is no remainder from the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2196' href='#L_COMPARES_2196'><pre>2196</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // divide, so the covered range size is unit, otherwise it is the divisor.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2197' href='#L_COMPARES_2197'><pre>2197</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Constant *RangeSize =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2198' href='#L_COMPARES_2198'><pre>2198</pre></a></td><td class='covered-line'><pre>128</pre></td><td class='code'><pre> Div->isExact() ? <div class='tooltip'>ConstantInt::get(Div->getType(), 1)<span class='tooltip-content'>62</span></div> : <div class='tooltip'>DivRHS<span class='tooltip-content'>128</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2199' href='#L_COMPARES_2199'><pre>2199</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2200' href='#L_COMPARES_2200'><pre>2200</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // Figure out the interval that is being checked. For example, a comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2201' href='#L_COMPARES_2201'><pre>2201</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // like "X /u 5 == 0" is really checking that X is in the interval [0, 5).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2202' href='#L_COMPARES_2202'><pre>2202</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // Compute this interval based on the constants involved and the signedness of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2203' href='#L_COMPARES_2203'><pre>2203</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // the compare/divide. This computes a half-open interval, keeping track of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2204' href='#L_COMPARES_2204'><pre>2204</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // whether either value in the interval overflows. After analysis each</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2205' href='#L_COMPARES_2205'><pre>2205</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // overflow variable is set to 0 if it's corresponding bound variable is valid</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2206' href='#L_COMPARES_2206'><pre>2206</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> // -1 if overflowed off the bottom end, or +1 if overflowed off the top end.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2207' href='#L_COMPARES_2207'><pre>2207</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> int LoOverflow = 0, HiOverflow = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2208' href='#L_COMPARES_2208'><pre>2208</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Constant *LoBound = nullptr, *HiBound = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2209' href='#L_COMPARES_2209'><pre>2209</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2210' href='#L_COMPARES_2210'><pre>2210</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> if (<div class='tooltip'>!DivIsSigned<span class='tooltip-content'>190</span></div>) <div class='tooltip'>{ // udiv<span class='tooltip-content'>38</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2211' href='#L_COMPARES_2211'><pre>2211</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> // e.g. X/5 op 3 --> [15, 20)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2212' href='#L_COMPARES_2212'><pre>2212</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> LoBound = Prod;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2213' href='#L_COMPARES_2213'><pre>2213</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> HiOverflow = LoOverflow = ProdOV;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2214' href='#L_COMPARES_2214'><pre>2214</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> if (<div class='tooltip'>!HiOverflow<span class='tooltip-content'>38</span></div>) <div class='tooltip'>{<span class='tooltip-content'>38</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2215' href='#L_COMPARES_2215'><pre>2215</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> // If this is not an exact divide, then many values in the range collapse</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2216' href='#L_COMPARES_2216'><pre>2216</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> // to the same result value.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2217' href='#L_COMPARES_2217'><pre>2217</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> HiOverflow = addWithOverflow(HiBound, LoBound, RangeSize, false);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2218' href='#L_COMPARES_2218'><pre>2218</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2219' href='#L_COMPARES_2219'><pre>2219</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>152</span></div><div class='tooltip'>C2->isStrictlyPositive()<span class='tooltip-content'>152</span></div>) <div class='tooltip'>{ // Divisor is > 0.<span class='tooltip-content'>152</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2220' href='#L_COMPARES_2220'><pre>2220</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 0<span class='tooltip-content'>152</span></div>) <div class='tooltip'>{ // (X / pos) op 0<span class='tooltip-content'>124</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2221' href='#L_COMPARES_2221'><pre>2221</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> // Can't overflow. e.g. X/2 op 0 --> [-1, 2)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2222' href='#L_COMPARES_2222'><pre>2222</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> LoBound = ConstantExpr::getNeg(SubOne(RangeSize));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2223' href='#L_COMPARES_2223'><pre>2223</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> HiBound = RangeSize;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2224' href='#L_COMPARES_2224'><pre>2224</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>28</span></div><div class='tooltip'>C->isStrictlyPositive()<span class='tooltip-content'>28</span></div>) <div class='tooltip'>{ // (X / pos) op pos<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2225' href='#L_COMPARES_2225'><pre>2225</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> LoBound = Prod; // e.g. X/5 op 3 --> [15, 20)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2226' href='#L_COMPARES_2226'><pre>2226</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> HiOverflow = LoOverflow = ProdOV;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2227' href='#L_COMPARES_2227'><pre>2227</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> if (!HiOverflow)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2228' href='#L_COMPARES_2228'><pre>2228</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> HiOverflow = addWithOverflow(HiBound, Prod, RangeSize, true);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2229' href='#L_COMPARES_2229'><pre>2229</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> } else { // (X / pos) op neg</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2230' href='#L_COMPARES_2230'><pre>2230</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // e.g. X/5 op -3 --> [-15-4, -15+1) --> [-19, -14)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2231' href='#L_COMPARES_2231'><pre>2231</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> HiBound = AddOne(Prod);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2232' href='#L_COMPARES_2232'><pre>2232</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> LoOverflow = HiOverflow = ProdOV ? <div class='tooltip'>-1<span class='tooltip-content'>7</span></div> : <div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2233' href='#L_COMPARES_2233'><pre>2233</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>!LoOverflow<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2234' href='#L_COMPARES_2234'><pre>2234</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Constant *DivNeg = ConstantExpr::getNeg(RangeSize);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2235' href='#L_COMPARES_2235'><pre>2235</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> LoOverflow = addWithOverflow(LoBound, HiBound, DivNeg, true) ? <div class='tooltip'>-1<span class='tooltip-content'>7</span></div> : <div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2236' href='#L_COMPARES_2236'><pre>2236</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2237' href='#L_COMPARES_2237'><pre>2237</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2238' href='#L_COMPARES_2238'><pre>2238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C2->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // Divisor is < 0.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2239' href='#L_COMPARES_2239'><pre>2239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Div->isExact()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2240' href='#L_COMPARES_2240'><pre>2240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>RangeSize = ConstantExpr::getNeg(RangeSize)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2241' href='#L_COMPARES_2241'><pre>2241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>*C == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // (X / neg) op 0</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2242' href='#L_COMPARES_2242'><pre>2242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // e.g. X/-5 op 0 --> [-4, 5)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2243' href='#L_COMPARES_2243'><pre>2243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoBound = AddOne(RangeSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2244' href='#L_COMPARES_2244'><pre>2244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> HiBound = ConstantExpr::getNeg(RangeSize);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2245' href='#L_COMPARES_2245'><pre>2245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>HiBound == DivRHS</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // -INTMIN = INTMIN</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2246' href='#L_COMPARES_2246'><pre>2246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> HiOverflow = 1; // [INTMIN+1, overflow)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2247' href='#L_COMPARES_2247'><pre>2247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> HiBound = nullptr; // e.g. X/INTMIN = 0 --> X > INTMIN</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2248' href='#L_COMPARES_2248'><pre>2248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2249' href='#L_COMPARES_2249'><pre>2249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C->isStrictlyPositive()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // (X / neg) op pos</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2250' href='#L_COMPARES_2250'><pre>2250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // e.g. X/-5 op 3 --> [-19, -14)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2251' href='#L_COMPARES_2251'><pre>2251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> HiBound = AddOne(Prod);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2252' href='#L_COMPARES_2252'><pre>2252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> HiOverflow = LoOverflow = ProdOV ? </span><div class='tooltip'><span class='red'>-1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2253' href='#L_COMPARES_2253'><pre>2253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!LoOverflow</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2254' href='#L_COMPARES_2254'><pre>2254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>LoOverflow = addWithOverflow(LoBound, HiBound, RangeSize, true) ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>-1</span><span class='tooltip-content'>0</span></div><span class='red'>:</span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2255' href='#L_COMPARES_2255'><pre>2255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{ // (X / neg) op neg</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2256' href='#L_COMPARES_2256'><pre>2256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoBound = Prod; // e.g. X/-5 op -3 --> [15, 20)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2257' href='#L_COMPARES_2257'><pre>2257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoOverflow = HiOverflow = ProdOV;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2258' href='#L_COMPARES_2258'><pre>2258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!HiOverflow</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2259' href='#L_COMPARES_2259'><pre>2259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>HiOverflow = subWithOverflow(HiBound, Prod, RangeSize, true)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2260' href='#L_COMPARES_2260'><pre>2260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2261' href='#L_COMPARES_2261'><pre>2261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2262' href='#L_COMPARES_2262'><pre>2262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Dividing by a negative swaps the condition. LT <-> GT</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2263' href='#L_COMPARES_2263'><pre>2263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::getSwappedPredicate(Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2264' href='#L_COMPARES_2264'><pre>2264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2265' href='#L_COMPARES_2265'><pre>2265</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2266' href='#L_COMPARES_2266'><pre>2266</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> Value *X = Div->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2267' href='#L_COMPARES_2267'><pre>2267</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> switch (Pred) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2268' href='#L_COMPARES_2268'><pre>2268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unhandled icmp opcode!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2269' href='#L_COMPARES_2269'><pre>2269</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2270' href='#L_COMPARES_2270'><pre>2270</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> if (<div class='tooltip'>LoOverflow && <span class='tooltip-content'>14</span></div><div class='tooltip'><span class='red'>HiOverflow</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2271' href='#L_COMPARES_2271'><pre>2271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getFalse())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2272' href='#L_COMPARES_2272'><pre>2272</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>14</span></div><div class='tooltip'>HiOverflow<span class='tooltip-content'>14</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2273' href='#L_COMPARES_2273'><pre>2273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return new ICmpInst(DivIsSigned ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2274' href='#L_COMPARES_2274'><pre>2274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ICmpInst::ICMP_UGE</span><span class='red'>, X, LoBound)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2275' href='#L_COMPARES_2275'><pre>2275</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>14</span></div><div class='tooltip'>LoOverflow<span class='tooltip-content'>14</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2276' href='#L_COMPARES_2276'><pre>2276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return new ICmpInst(DivIsSigned ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2277' href='#L_COMPARES_2277'><pre>2277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ICmpInst::ICMP_ULT</span><span class='red'>, X, HiBound)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2278' href='#L_COMPARES_2278'><pre>2278</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return replaceInstUsesWith(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2279' href='#L_COMPARES_2279'><pre>2279</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Cmp, insertRangeTest(X, LoBound->getUniqueInteger(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2280' href='#L_COMPARES_2280'><pre>2280</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> HiBound->getUniqueInteger(), DivIsSigned, true));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2281' href='#L_COMPARES_2281'><pre>2281</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2282' href='#L_COMPARES_2282'><pre>2282</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (<div class='tooltip'>LoOverflow && <span class='tooltip-content'>8</span></div><div class='tooltip'><span class='red'>HiOverflow</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2283' href='#L_COMPARES_2283'><pre>2283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getTrue())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2284' href='#L_COMPARES_2284'><pre>2284</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8</span></div><div class='tooltip'>HiOverflow<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2285' href='#L_COMPARES_2285'><pre>2285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return new ICmpInst(DivIsSigned ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2286' href='#L_COMPARES_2286'><pre>2286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ICmpInst::ICMP_ULT</span><span class='red'>, X, LoBound)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2287' href='#L_COMPARES_2287'><pre>2287</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8</span></div><div class='tooltip'>LoOverflow<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2288' href='#L_COMPARES_2288'><pre>2288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return new ICmpInst(DivIsSigned ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2289' href='#L_COMPARES_2289'><pre>2289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ICmpInst::ICMP_UGE</span><span class='red'>, X, HiBound)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2290' href='#L_COMPARES_2290'><pre>2290</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return replaceInstUsesWith(Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2291' href='#L_COMPARES_2291'><pre>2291</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> insertRangeTest(X, LoBound->getUniqueInteger(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2292' href='#L_COMPARES_2292'><pre>2292</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> HiBound->getUniqueInteger(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2293' href='#L_COMPARES_2293'><pre>2293</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> DivIsSigned, false));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2294' href='#L_COMPARES_2294'><pre>2294</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2295' href='#L_COMPARES_2295'><pre>2295</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2296' href='#L_COMPARES_2296'><pre>2296</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> if (LoOverflow == +1) // Low bound is greater than input range.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2297' href='#L_COMPARES_2297'><pre>2297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getTrue())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2298' href='#L_COMPARES_2298'><pre>2298</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>60</span></div><div class='tooltip'>LoOverflow == -1<span class='tooltip-content'>60</span></div>) // Low bound is less than input range.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2299' href='#L_COMPARES_2299'><pre>2299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getFalse())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2300' href='#L_COMPARES_2300'><pre>2300</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, LoBound);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2301' href='#L_COMPARES_2301'><pre>2301</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2302' href='#L_COMPARES_2302'><pre>2302</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2303' href='#L_COMPARES_2303'><pre>2303</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> if (HiOverflow == +1) // High bound greater than input range.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2304' href='#L_COMPARES_2304'><pre>2304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getFalse())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2305' href='#L_COMPARES_2305'><pre>2305</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>108</span></div><div class='tooltip'>HiOverflow == -1<span class='tooltip-content'>108</span></div>) // High bound less than input range.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2306' href='#L_COMPARES_2306'><pre>2306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(Cmp, Builder->getTrue())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2307' href='#L_COMPARES_2307'><pre>2307</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>108</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGT<span class='tooltip-content'>108</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2308' href='#L_COMPARES_2308'><pre>2308</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2309' href='#L_COMPARES_2309'><pre>2309</pre></a></td><td class='covered-line'><pre>87</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2310' href='#L_COMPARES_2310'><pre>2310</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2311' href='#L_COMPARES_2311'><pre>2311</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2312' href='#L_COMPARES_2312'><pre>2312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2313' href='#L_COMPARES_2313'><pre>2313</pre></a></td><td class='covered-line'><pre>190</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2314' href='#L_COMPARES_2314'><pre>2314</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2315' href='#L_COMPARES_2315'><pre>2315</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (sub X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2316' href='#L_COMPARES_2316'><pre>2316</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpSubConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2317' href='#L_COMPARES_2317'><pre>2317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Sub,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2318' href='#L_COMPARES_2318'><pre>2318</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2319' href='#L_COMPARES_2319'><pre>2319</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> Value *X = Sub->getOperand(0), *Y = Sub->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2320' href='#L_COMPARES_2320'><pre>2320</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2321' href='#L_COMPARES_2321'><pre>2321</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2322' href='#L_COMPARES_2322'><pre>2322</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> // The following transforms are only worth it if the only user of the subtract</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2323' href='#L_COMPARES_2323'><pre>2323</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> // is the icmp.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2324' href='#L_COMPARES_2324'><pre>2324</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> if (!Sub->hasOneUse())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2325' href='#L_COMPARES_2325'><pre>2325</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2326' href='#L_COMPARES_2326'><pre>2326</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2327' href='#L_COMPARES_2327'><pre>2327</pre></a></td><td class='covered-line'><pre>1.40k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.40k</span></div><div class='tooltip'>Sub->hasNoSignedWrap()<span class='tooltip-content'>1.40k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>540</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2328' href='#L_COMPARES_2328'><pre>2328</pre></a></td><td class='covered-line'><pre>540</pre></td><td class='code'><pre> // (icmp sgt (sub nsw X, Y), -1) -> (icmp sge X, Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2329' href='#L_COMPARES_2329'><pre>2329</pre></a></td><td class='covered-line'><pre>540</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>540</span></div><div class='tooltip'>C->isAllOnesValue()<span class='tooltip-content'>89</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2330' href='#L_COMPARES_2330'><pre>2330</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2331' href='#L_COMPARES_2331'><pre>2331</pre></a></td><td class='covered-line'><pre>540</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2332' href='#L_COMPARES_2332'><pre>2332</pre></a></td><td class='covered-line'><pre>540</pre></td><td class='code'><pre> // (icmp sgt (sub nsw X, Y), 0) -> (icmp sgt X, Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2333' href='#L_COMPARES_2333'><pre>2333</pre></a></td><td class='covered-line'><pre>539</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>539</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>539</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>88</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2334' href='#L_COMPARES_2334'><pre>2334</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGT, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2335' href='#L_COMPARES_2335'><pre>2335</pre></a></td><td class='covered-line'><pre>539</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2336' href='#L_COMPARES_2336'><pre>2336</pre></a></td><td class='covered-line'><pre>539</pre></td><td class='code'><pre> // (icmp slt (sub nsw X, Y), 0) -> (icmp slt X, Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2337' href='#L_COMPARES_2337'><pre>2337</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>538</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>538</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>111</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2338' href='#L_COMPARES_2338'><pre>2338</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SLT, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2339' href='#L_COMPARES_2339'><pre>2339</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2340' href='#L_COMPARES_2340'><pre>2340</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre> // (icmp slt (sub nsw X, Y), 1) -> (icmp sle X, Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2341' href='#L_COMPARES_2341'><pre>2341</pre></a></td><td class='covered-line'><pre>536</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>536</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>536</span></div><div class='tooltip'>*C == 1<span class='tooltip-content'>109</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2342' href='#L_COMPARES_2342'><pre>2342</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SLE, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2343' href='#L_COMPARES_2343'><pre>2343</pre></a></td><td class='covered-line'><pre>536</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2344' href='#L_COMPARES_2344'><pre>2344</pre></a></td><td class='covered-line'><pre>1.40k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2345' href='#L_COMPARES_2345'><pre>2345</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2346' href='#L_COMPARES_2346'><pre>2346</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> if (!match(X, m_APInt(C2)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2347' href='#L_COMPARES_2347'><pre>2347</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2348' href='#L_COMPARES_2348'><pre>2348</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2349' href='#L_COMPARES_2349'><pre>2349</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> // C2 - Y <u C -> (Y | (C - 1)) == C2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2350' href='#L_COMPARES_2350'><pre>2350</pre></a></td><td class='covered-line'><pre>1.39k</pre></td><td class='code'><pre> // iff (C2 & (C - 1)) == C - 1 and C is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2351' href='#L_COMPARES_2351'><pre>2351</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT && <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>C->isPowerOf2()</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2352' href='#L_COMPARES_2352'><pre>2352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>(*C2 & (*C - 1)) == (*C - 1)</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2353' href='#L_COMPARES_2353'><pre>2353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_EQ, Builder->CreateOr(Y, *C - 1), X)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2354' href='#L_COMPARES_2354'><pre>2354</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2355' href='#L_COMPARES_2355'><pre>2355</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // C2 - Y >u C -> (Y | C) != C2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2356' href='#L_COMPARES_2356'><pre>2356</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // iff C2 & C == C and C + 1 is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2357' href='#L_COMPARES_2357'><pre>2357</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGT && <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>(*C + 1).isPowerOf2()</span><span class='tooltip-content'>0</span></div> && <div class='tooltip'><span class='red'>(*C2 & *C) == *C</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2358' href='#L_COMPARES_2358'><pre>2358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_NE, Builder->CreateOr(Y, *C), X)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2359' href='#L_COMPARES_2359'><pre>2359</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2360' href='#L_COMPARES_2360'><pre>2360</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2361' href='#L_COMPARES_2361'><pre>2361</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2362' href='#L_COMPARES_2362'><pre>2362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2363' href='#L_COMPARES_2363'><pre>2363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp (add X, Y), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2364' href='#L_COMPARES_2364'><pre>2364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpAddConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2365' href='#L_COMPARES_2365'><pre>2365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *Add,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2366' href='#L_COMPARES_2366'><pre>2366</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2367' href='#L_COMPARES_2367'><pre>2367</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> Value *Y = Add->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2368' href='#L_COMPARES_2368'><pre>2368</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2369' href='#L_COMPARES_2369'><pre>2369</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isEquality() || <span class='tooltip-content'>79.0k</span></div><div class='tooltip'>!match(Y, m_APInt(C2))<span class='tooltip-content'>24.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2370' href='#L_COMPARES_2370'><pre>2370</pre></a></td><td class='covered-line'><pre>59.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2371' href='#L_COMPARES_2371'><pre>2371</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2372' href='#L_COMPARES_2372'><pre>2372</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> // Fold icmp pred (add X, C2), C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2373' href='#L_COMPARES_2373'><pre>2373</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> Value *X = Add->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2374' href='#L_COMPARES_2374'><pre>2374</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> Type *Ty = Add->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2375' href='#L_COMPARES_2375'><pre>2375</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> CmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2376' href='#L_COMPARES_2376'><pre>2376</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2377' href='#L_COMPARES_2377'><pre>2377</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> // If the add does not wrap, we can always adjust the compare by subtracting</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2378' href='#L_COMPARES_2378'><pre>2378</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> // the constants. Equality comparisons are handled elsewhere. SGE/SLE are</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2379' href='#L_COMPARES_2379'><pre>2379</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> // canonicalized to SGT/SLT.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2380' href='#L_COMPARES_2380'><pre>2380</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre> if (Add->hasNoSignedWrap() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2381' href='#L_COMPARES_2381'><pre>2381</pre></a></td><td class='covered-line'><pre>5.97k</pre></td><td class='code'><pre> <div class='tooltip'>(Pred == ICmpInst::ICMP_SGT || <span class='tooltip-content'>5.97k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT<span class='tooltip-content'>5.29k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>2.67k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2382' href='#L_COMPARES_2382'><pre>2382</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> bool Overflow;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2383' href='#L_COMPARES_2383'><pre>2383</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> APInt NewC = C->ssub_ov(*C2, Overflow);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2384' href='#L_COMPARES_2384'><pre>2384</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // If there is overflow, the result must be true or false.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2385' href='#L_COMPARES_2385'><pre>2385</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // TODO: Can we assert there is no overflow because InstSimplify always</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2386' href='#L_COMPARES_2386'><pre>2386</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // handles those cases?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2387' href='#L_COMPARES_2387'><pre>2387</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> if (!Overflow)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2388' href='#L_COMPARES_2388'><pre>2388</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // icmp Pred (add nsw X, C2), C --> icmp Pred X, (C - C2)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2389' href='#L_COMPARES_2389'><pre>2389</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> return new ICmpInst(Pred, X, ConstantInt::get(Ty, NewC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2390' href='#L_COMPARES_2390'><pre>2390</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2391' href='#L_COMPARES_2391'><pre>2391</pre></a></td><td class='covered-line'><pre>19.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2392' href='#L_COMPARES_2392'><pre>2392</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> auto CR = ConstantRange::makeExactICmpRegion(Pred, *C).subtract(*C2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2393' href='#L_COMPARES_2393'><pre>2393</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> const APInt &Upper = CR.getUpper();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2394' href='#L_COMPARES_2394'><pre>2394</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> const APInt &Lower = CR.getLower();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2395' href='#L_COMPARES_2395'><pre>2395</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>Cmp.isSigned()<span class='tooltip-content'>16.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>730</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2396' href='#L_COMPARES_2396'><pre>2396</pre></a></td><td class='covered-line'><pre>730</pre></td><td class='code'><pre> if (Lower.isSignBit())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2397' href='#L_COMPARES_2397'><pre>2397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantInt::get(Ty, Upper))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2398' href='#L_COMPARES_2398'><pre>2398</pre></a></td><td class='covered-line'><pre>730</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>730</span></div><div class='tooltip'>Upper.isSignBit()<span class='tooltip-content'>730</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2399' href='#L_COMPARES_2399'><pre>2399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_SGE, X, ConstantInt::get(Ty, Lower))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2400' href='#L_COMPARES_2400'><pre>2400</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2401' href='#L_COMPARES_2401'><pre>2401</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> if (Lower.isMinValue())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2402' href='#L_COMPARES_2402'><pre>2402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantInt::get(Ty, Upper))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2403' href='#L_COMPARES_2403'><pre>2403</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.2k</span></div><div class='tooltip'>Upper.isMinValue()<span class='tooltip-content'>16.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2404' href='#L_COMPARES_2404'><pre>2404</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_UGE, X, ConstantInt::get(Ty, Lower));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2405' href='#L_COMPARES_2405'><pre>2405</pre></a></td><td class='covered-line'><pre>16.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2406' href='#L_COMPARES_2406'><pre>2406</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2407' href='#L_COMPARES_2407'><pre>2407</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.9k</span></div><div class='tooltip'>!Add->hasOneUse()<span class='tooltip-content'>16.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2408' href='#L_COMPARES_2408'><pre>2408</pre></a></td><td class='covered-line'><pre>4.77k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2409' href='#L_COMPARES_2409'><pre>2409</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2410' href='#L_COMPARES_2410'><pre>2410</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // X+C <u C2 -> (X & -C2) == C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2411' href='#L_COMPARES_2411'><pre>2411</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // iff C & (C2-1) == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2412' href='#L_COMPARES_2412'><pre>2412</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // C2 is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2413' href='#L_COMPARES_2413'><pre>2413</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.1k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT && <span class='tooltip-content'>12.1k</span></div><div class='tooltip'>C->isPowerOf2()<span class='tooltip-content'>10.4k</span></div> && <div class='tooltip'>(*C2 & (*C - 1)) == 0<span class='tooltip-content'>6.01k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2414' href='#L_COMPARES_2414'><pre>2414</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Builder->CreateAnd(X, -(*C)),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2415' href='#L_COMPARES_2415'><pre>2415</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> ConstantExpr::getNeg(cast<Constant>(Y)));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2416' href='#L_COMPARES_2416'><pre>2416</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2417' href='#L_COMPARES_2417'><pre>2417</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> // X+C >u C2 -> (X & ~C2) != C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2418' href='#L_COMPARES_2418'><pre>2418</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> // iff C & C2 == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2419' href='#L_COMPARES_2419'><pre>2419</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> // C2+1 is a power of 2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2420' href='#L_COMPARES_2420'><pre>2420</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.1k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_UGT && <span class='tooltip-content'>12.1k</span></div><div class='tooltip'>(*C + 1).isPowerOf2()<span class='tooltip-content'>1.72k</span></div> && <div class='tooltip'>(*C2 & *C) == 0<span class='tooltip-content'>524</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2421' href='#L_COMPARES_2421'><pre>2421</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Builder->CreateAnd(X, ~(*C)),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2422' href='#L_COMPARES_2422'><pre>2422</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> ConstantExpr::getNeg(cast<Constant>(Y)));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2423' href='#L_COMPARES_2423'><pre>2423</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2424' href='#L_COMPARES_2424'><pre>2424</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2425' href='#L_COMPARES_2425'><pre>2425</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2426' href='#L_COMPARES_2426'><pre>2426</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2427' href='#L_COMPARES_2427'><pre>2427</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold integer comparisons with a constant operand: icmp Pred X, C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2428' href='#L_COMPARES_2428'><pre>2428</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where X is some kind of instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2429' href='#L_COMPARES_2429'><pre>2429</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpInstWithConstant(ICmpInst &Cmp) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2430' href='#L_COMPARES_2430'><pre>2430</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2431' href='#L_COMPARES_2431'><pre>2431</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> if (!match(Cmp.getOperand(1), m_APInt(C)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2432' href='#L_COMPARES_2432'><pre>2432</pre></a></td><td class='covered-line'><pre>619k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2433' href='#L_COMPARES_2433'><pre>2433</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2434' href='#L_COMPARES_2434'><pre>2434</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> BinaryOperator *BO;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2435' href='#L_COMPARES_2435'><pre>2435</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Cmp.getOperand(0), m_BinOp(BO))<span class='tooltip-content'>710k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>150k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2436' href='#L_COMPARES_2436'><pre>2436</pre></a></td><td class='covered-line'><pre>150k</pre></td><td class='code'><pre> switch (BO->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2437' href='#L_COMPARES_2437'><pre>2437</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2438' href='#L_COMPARES_2438'><pre>2438</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> if (Instruction *I = foldICmpXorConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2439' href='#L_COMPARES_2439'><pre>2439</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2440' href='#L_COMPARES_2440'><pre>2440</pre></a></td><td class='covered-line'><pre>498</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2441' href='#L_COMPARES_2441'><pre>2441</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2442' href='#L_COMPARES_2442'><pre>2442</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpAndConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2443' href='#L_COMPARES_2443'><pre>2443</pre></a></td><td class='covered-line'><pre>698</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2444' href='#L_COMPARES_2444'><pre>2444</pre></a></td><td class='covered-line'><pre>45.7k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2445' href='#L_COMPARES_2445'><pre>2445</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2446' href='#L_COMPARES_2446'><pre>2446</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpOrConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2447' href='#L_COMPARES_2447'><pre>2447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2448' href='#L_COMPARES_2448'><pre>2448</pre></a></td><td class='covered-line'><pre>4.83k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2449' href='#L_COMPARES_2449'><pre>2449</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2450' href='#L_COMPARES_2450'><pre>2450</pre></a></td><td class='covered-line'><pre>442</pre></td><td class='code'><pre> if (Instruction *I = foldICmpMulConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2451' href='#L_COMPARES_2451'><pre>2451</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2452' href='#L_COMPARES_2452'><pre>2452</pre></a></td><td class='covered-line'><pre>438</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2453' href='#L_COMPARES_2453'><pre>2453</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2454' href='#L_COMPARES_2454'><pre>2454</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpShlConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2455' href='#L_COMPARES_2455'><pre>2455</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2456' href='#L_COMPARES_2456'><pre>2456</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2457' href='#L_COMPARES_2457'><pre>2457</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2458' href='#L_COMPARES_2458'><pre>2458</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2459' href='#L_COMPARES_2459'><pre>2459</pre></a></td><td class='covered-line'><pre>6.64k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpShrConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2460' href='#L_COMPARES_2460'><pre>2460</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2461' href='#L_COMPARES_2461'><pre>2461</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2462' href='#L_COMPARES_2462'><pre>2462</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2463' href='#L_COMPARES_2463'><pre>2463</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> if (Instruction *I = foldICmpUDivConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2464' href='#L_COMPARES_2464'><pre>2464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2465' href='#L_COMPARES_2465'><pre>2465</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>76</span></div><div class='tooltip'>;<span class='tooltip-content'>76</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2466' href='#L_COMPARES_2466'><pre>2466</pre></a></td><td class='covered-line'><pre>481</pre></td><td class='code'><pre> case Instruction::SDiv:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2467' href='#L_COMPARES_2467'><pre>2467</pre></a></td><td class='covered-line'><pre>481</pre></td><td class='code'><pre> if (Instruction *I = foldICmpDivConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2468' href='#L_COMPARES_2468'><pre>2468</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2469' href='#L_COMPARES_2469'><pre>2469</pre></a></td><td class='covered-line'><pre>377</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2470' href='#L_COMPARES_2470'><pre>2470</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2471' href='#L_COMPARES_2471'><pre>2471</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpSubConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2472' href='#L_COMPARES_2472'><pre>2472</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2473' href='#L_COMPARES_2473'><pre>2473</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2474' href='#L_COMPARES_2474'><pre>2474</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2475' href='#L_COMPARES_2475'><pre>2475</pre></a></td><td class='covered-line'><pre>79.0k</pre></td><td class='code'><pre> if (Instruction *I = foldICmpAddConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2476' href='#L_COMPARES_2476'><pre>2476</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2477' href='#L_COMPARES_2477'><pre>2477</pre></a></td><td class='covered-line'><pre>76.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2478' href='#L_COMPARES_2478'><pre>2478</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2479' href='#L_COMPARES_2479'><pre>2479</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2480' href='#L_COMPARES_2480'><pre>2480</pre></a></td><td class='covered-line'><pre>150k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2481' href='#L_COMPARES_2481'><pre>2481</pre></a></td><td class='covered-line'><pre>150k</pre></td><td class='code'><pre> // TODO: These folds could be refactored to be part of the above calls.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2482' href='#L_COMPARES_2482'><pre>2482</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>147k</span></div><div class='tooltip'>I<span class='tooltip-content'>147k</span></div> = foldICmpBinOpEqualityWithConstant(Cmp, BO, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2483' href='#L_COMPARES_2483'><pre>2483</pre></a></td><td class='covered-line'><pre>390</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2484' href='#L_COMPARES_2484'><pre>2484</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2485' href='#L_COMPARES_2485'><pre>2485</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2486' href='#L_COMPARES_2486'><pre>2486</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> Instruction *LHSI;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2487' href='#L_COMPARES_2487'><pre>2487</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> if (match(Cmp.getOperand(0), m_Instruction(LHSI)) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2488' href='#L_COMPARES_2488'><pre>2488</pre></a></td><td class='covered-line'><pre>667k</pre></td><td class='code'><pre> LHSI->getOpcode() == Instruction::Trunc)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2489' href='#L_COMPARES_2489'><pre>2489</pre></a></td><td class='covered-line'><pre>12.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>12.6k</span></div><div class='tooltip'>I<span class='tooltip-content'>12.6k</span></div> = foldICmpTruncConstant(Cmp, LHSI, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2490' href='#L_COMPARES_2490'><pre>2490</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2491' href='#L_COMPARES_2491'><pre>2491</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2492' href='#L_COMPARES_2492'><pre>2492</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>706k</span></div><div class='tooltip'>I<span class='tooltip-content'>706k</span></div> = foldICmpIntrinsicWithConstant(Cmp, C))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2493' href='#L_COMPARES_2493'><pre>2493</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2494' href='#L_COMPARES_2494'><pre>2494</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2495' href='#L_COMPARES_2495'><pre>2495</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2496' href='#L_COMPARES_2496'><pre>2496</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2497' href='#L_COMPARES_2497'><pre>2497</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2498' href='#L_COMPARES_2498'><pre>2498</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold an icmp equality instruction with binary operator LHS and constant RHS:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2499' href='#L_COMPARES_2499'><pre>2499</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// icmp eq/ne BO, C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2500' href='#L_COMPARES_2500'><pre>2500</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2501' href='#L_COMPARES_2501'><pre>2501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *BO,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2502' href='#L_COMPARES_2502'><pre>2502</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2503' href='#L_COMPARES_2503'><pre>2503</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> // TODO: Some of these folds could work with arbitrary constants, but this</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2504' href='#L_COMPARES_2504'><pre>2504</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> // function is limited to scalar and vector splat constants.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2505' href='#L_COMPARES_2505'><pre>2505</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre> if (!Cmp.isEquality())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2506' href='#L_COMPARES_2506'><pre>2506</pre></a></td><td class='covered-line'><pre>33.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2507' href='#L_COMPARES_2507'><pre>2507</pre></a></td><td class='covered-line'><pre>147k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2508' href='#L_COMPARES_2508'><pre>2508</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2509' href='#L_COMPARES_2509'><pre>2509</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> bool isICMP_NE = Pred == ICmpInst::ICMP_NE;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2510' href='#L_COMPARES_2510'><pre>2510</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> Constant *RHS = cast<Constant>(Cmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2511' href='#L_COMPARES_2511'><pre>2511</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2512' href='#L_COMPARES_2512'><pre>2512</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2513' href='#L_COMPARES_2513'><pre>2513</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> switch (BO->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2514' href='#L_COMPARES_2514'><pre>2514</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> case Instruction::SRem:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2515' href='#L_COMPARES_2515'><pre>2515</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2516' href='#L_COMPARES_2516'><pre>2516</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 0 && <span class='tooltip-content'>704</span></div><div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>669</span></div>) <div class='tooltip'>{<span class='tooltip-content'>592</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2517' href='#L_COMPARES_2517'><pre>2517</pre></a></td><td class='covered-line'><pre>592</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2518' href='#L_COMPARES_2518'><pre>2518</pre></a></td><td class='covered-line'><pre>592</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp1, m_APInt(BOC)) && <span class='tooltip-content'>592</span></div><div class='tooltip'>BOC->sgt(1)<span class='tooltip-content'>394</span></div> && <div class='tooltip'>BOC->isPowerOf2()<span class='tooltip-content'>394</span></div>) <div class='tooltip'>{<span class='tooltip-content'>37</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2519' href='#L_COMPARES_2519'><pre>2519</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Value *NewRem = Builder->CreateURem(BOp0, BOp1, BO->getName());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2520' href='#L_COMPARES_2520'><pre>2520</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> return new ICmpInst(Pred, NewRem,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2521' href='#L_COMPARES_2521'><pre>2521</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Constant::getNullValue(BO->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2522' href='#L_COMPARES_2522'><pre>2522</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2523' href='#L_COMPARES_2523'><pre>2523</pre></a></td><td class='covered-line'><pre>592</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2524' href='#L_COMPARES_2524'><pre>2524</pre></a></td><td class='covered-line'><pre>667</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2525' href='#L_COMPARES_2525'><pre>2525</pre></a></td><td class='covered-line'><pre>54.0k</pre></td><td class='code'><pre> case Instruction::Add: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2526' href='#L_COMPARES_2526'><pre>2526</pre></a></td><td class='covered-line'><pre>54.0k</pre></td><td class='code'><pre> // Replace ((add A, B) != C) with (A != C-B) if B & C are constants.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2527' href='#L_COMPARES_2527'><pre>2527</pre></a></td><td class='covered-line'><pre>54.0k</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2528' href='#L_COMPARES_2528'><pre>2528</pre></a></td><td class='covered-line'><pre>54.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp1, m_APInt(BOC))<span class='tooltip-content'>54.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>52.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2529' href='#L_COMPARES_2529'><pre>2529</pre></a></td><td class='covered-line'><pre>52.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>52.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>73</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2530' href='#L_COMPARES_2530'><pre>2530</pre></a></td><td class='covered-line'><pre>73</pre></td><td class='code'><pre> Constant *SubC = ConstantExpr::getSub(RHS, cast<Constant>(BOp1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2531' href='#L_COMPARES_2531'><pre>2531</pre></a></td><td class='covered-line'><pre>73</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, SubC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2532' href='#L_COMPARES_2532'><pre>2532</pre></a></td><td class='covered-line'><pre>73</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2533' href='#L_COMPARES_2533'><pre>2533</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>1.51k</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>1.51k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>640</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2534' href='#L_COMPARES_2534'><pre>2534</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> // Replace ((add A, B) != 0) with (A != -B) if A or B is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2535' href='#L_COMPARES_2535'><pre>2535</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> // efficiently invertible, or if the add has just this one use.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2536' href='#L_COMPARES_2536'><pre>2536</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> if (Value *NegVal = dyn_castNegVal(BOp1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2537' href='#L_COMPARES_2537'><pre>2537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, BOp0, NegVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2538' href='#L_COMPARES_2538'><pre>2538</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>640</span></div><div class='tooltip'>NegVal<span class='tooltip-content'>640</span></div> = dyn_castNegVal(BOp0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2539' href='#L_COMPARES_2539'><pre>2539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, NegVal, BOp1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2540' href='#L_COMPARES_2540'><pre>2540</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>640</span></div><div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>640</span></div>) <div class='tooltip'>{<span class='tooltip-content'>53</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2541' href='#L_COMPARES_2541'><pre>2541</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> Value *Neg = Builder->CreateNeg(BOp1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2542' href='#L_COMPARES_2542'><pre>2542</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> Neg->takeName(BO);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2543' href='#L_COMPARES_2543'><pre>2543</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, Neg);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2544' href='#L_COMPARES_2544'><pre>2544</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2545' href='#L_COMPARES_2545'><pre>2545</pre></a></td><td class='covered-line'><pre>640</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2546' href='#L_COMPARES_2546'><pre>2546</pre></a></td><td class='covered-line'><pre>53.9k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2547' href='#L_COMPARES_2547'><pre>2547</pre></a></td><td class='covered-line'><pre>54.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2548' href='#L_COMPARES_2548'><pre>2548</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2549' href='#L_COMPARES_2549'><pre>2549</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> if (<div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>252</span></div>) <div class='tooltip'>{<span class='tooltip-content'>59</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2550' href='#L_COMPARES_2550'><pre>2550</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>BOC<span class='tooltip-content'>59</span></div> = dyn_cast<Constant>(BOp1)) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2551' href='#L_COMPARES_2551'><pre>2551</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // For the xor case, we can xor two constants together, eliminating</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2552' href='#L_COMPARES_2552'><pre>2552</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // the explicit xor.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2553' href='#L_COMPARES_2553'><pre>2553</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, ConstantExpr::getXor(RHS, BOC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2554' href='#L_COMPARES_2554'><pre>2554</pre></a></td><td class='covered-line'><pre>49</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>49</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>49</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2555' href='#L_COMPARES_2555'><pre>2555</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Replace ((xor A, B) != 0) with (A != B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2556' href='#L_COMPARES_2556'><pre>2556</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, BOp1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2557' href='#L_COMPARES_2557'><pre>2557</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2558' href='#L_COMPARES_2558'><pre>2558</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2559' href='#L_COMPARES_2559'><pre>2559</pre></a></td><td class='covered-line'><pre>241</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2560' href='#L_COMPARES_2560'><pre>2560</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2561' href='#L_COMPARES_2561'><pre>2561</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>2.72k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>633</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2562' href='#L_COMPARES_2562'><pre>2562</pre></a></td><td class='covered-line'><pre>633</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2563' href='#L_COMPARES_2563'><pre>2563</pre></a></td><td class='covered-line'><pre>633</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp0, m_APInt(BOC))<span class='tooltip-content'>633</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2564' href='#L_COMPARES_2564'><pre>2564</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // Replace ((sub BOC, B) != C) with (B != BOC-C).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2565' href='#L_COMPARES_2565'><pre>2565</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *SubC = ConstantExpr::getSub(cast<Constant>(BOp0), RHS);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2566' href='#L_COMPARES_2566'><pre>2566</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp1, SubC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2567' href='#L_COMPARES_2567'><pre>2567</pre></a></td><td class='covered-line'><pre>632</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>632</span></div><div class='tooltip'>*C == 0<span class='tooltip-content'>632</span></div>) <div class='tooltip'>{<span class='tooltip-content'>91</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2568' href='#L_COMPARES_2568'><pre>2568</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> // Replace ((sub A, B) != 0) with (A != B).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2569' href='#L_COMPARES_2569'><pre>2569</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, BOp1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2570' href='#L_COMPARES_2570'><pre>2570</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2571' href='#L_COMPARES_2571'><pre>2571</pre></a></td><td class='covered-line'><pre>633</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2572' href='#L_COMPARES_2572'><pre>2572</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2573' href='#L_COMPARES_2573'><pre>2573</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> case Instruction::Or: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2574' href='#L_COMPARES_2574'><pre>2574</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2575' href='#L_COMPARES_2575'><pre>2575</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp1, m_APInt(BOC)) && <span class='tooltip-content'>4.00k</span></div><div class='tooltip'>BO->hasOneUse()<span class='tooltip-content'>897</span></div> && <div class='tooltip'>RHS->isAllOnesValue()<span class='tooltip-content'>831</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2576' href='#L_COMPARES_2576'><pre>2576</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // Comparing if all bits outside of a constant mask are set?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2577' href='#L_COMPARES_2577'><pre>2577</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // Replace (X | C) == -1 with (X & ~C) == ~C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2578' href='#L_COMPARES_2578'><pre>2578</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // This removes the -1 constant.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2579' href='#L_COMPARES_2579'><pre>2579</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Constant *NotBOC = ConstantExpr::getNot(cast<Constant>(BOp1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2580' href='#L_COMPARES_2580'><pre>2580</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(BOp0, NotBOC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2581' href='#L_COMPARES_2581'><pre>2581</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return new ICmpInst(Pred, And, NotBOC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2582' href='#L_COMPARES_2582'><pre>2582</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2583' href='#L_COMPARES_2583'><pre>2583</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2584' href='#L_COMPARES_2584'><pre>2584</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2585' href='#L_COMPARES_2585'><pre>2585</pre></a></td><td class='covered-line'><pre>44.8k</pre></td><td class='code'><pre> case Instruction::And: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2586' href='#L_COMPARES_2586'><pre>2586</pre></a></td><td class='covered-line'><pre>44.8k</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2587' href='#L_COMPARES_2587'><pre>2587</pre></a></td><td class='covered-line'><pre>44.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp1, m_APInt(BOC))<span class='tooltip-content'>44.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>39.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2588' href='#L_COMPARES_2588'><pre>2588</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre> // If we have ((X & C) == C), turn it into ((X & C) != 0).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2589' href='#L_COMPARES_2589'><pre>2589</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>C == BOC && <span class='tooltip-content'>39.5k</span></div><div class='tooltip'>C->isPowerOf2()<span class='tooltip-content'>518</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2590' href='#L_COMPARES_2590'><pre>2590</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> <div class='tooltip'>return new ICmpInst(isICMP_NE ? <span class='tooltip-content'>35</span></div><div class='tooltip'>ICmpInst::ICMP_EQ<span class='tooltip-content'>35</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_NE</span><span class='tooltip-content'>0</span></div>,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2591' href='#L_COMPARES_2591'><pre>2591</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> BO, Constant::getNullValue(RHS->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2592' href='#L_COMPARES_2592'><pre>2592</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2593' href='#L_COMPARES_2593'><pre>2593</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre> // Don't perform the following transforms if the AND has multiple uses</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2594' href='#L_COMPARES_2594'><pre>2594</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>39.5k</span></div><div class='tooltip'>!BO->hasOneUse()<span class='tooltip-content'>39.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2595' href='#L_COMPARES_2595'><pre>2595</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2596' href='#L_COMPARES_2596'><pre>2596</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2597' href='#L_COMPARES_2597'><pre>2597</pre></a></td><td class='covered-line'><pre>39.5k</pre></td><td class='code'><pre> // Replace (and X, (1 << size(X)-1) != 0) with x s< 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2598' href='#L_COMPARES_2598'><pre>2598</pre></a></td><td class='covered-line'><pre>37.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.0k</span></div><div class='tooltip'>BOC->isSignBit()<span class='tooltip-content'>37.0k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2599' href='#L_COMPARES_2599'><pre>2599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Zero = Constant::getNullValue(BOp0->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2600' href='#L_COMPARES_2600'><pre>2600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NewPred = isICMP_NE ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2601' href='#L_COMPARES_2601'><pre>2601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(NewPred, BOp0, Zero);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2602' href='#L_COMPARES_2602'><pre>2602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2603' href='#L_COMPARES_2603'><pre>2603</pre></a></td><td class='covered-line'><pre>37.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2604' href='#L_COMPARES_2604'><pre>2604</pre></a></td><td class='covered-line'><pre>37.0k</pre></td><td class='code'><pre> // ((X & ~7) == 0) --> X < 8</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2605' href='#L_COMPARES_2605'><pre>2605</pre></a></td><td class='covered-line'><pre>37.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.0k</span></div><div class='tooltip'>*C == 0 && <span class='tooltip-content'>37.0k</span></div><div class='tooltip'>(~(*BOC) + 1).isPowerOf2()<span class='tooltip-content'>33.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>78</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2606' href='#L_COMPARES_2606'><pre>2606</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> Constant *NegBOC = ConstantExpr::getNeg(cast<Constant>(BOp1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2607' href='#L_COMPARES_2607'><pre>2607</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> auto NewPred = isICMP_NE ? <div class='tooltip'>ICmpInst::ICMP_UGE<span class='tooltip-content'>78</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2608' href='#L_COMPARES_2608'><pre>2608</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> return new ICmpInst(NewPred, BOp0, NegBOC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2609' href='#L_COMPARES_2609'><pre>2609</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2610' href='#L_COMPARES_2610'><pre>2610</pre></a></td><td class='covered-line'><pre>37.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2611' href='#L_COMPARES_2611'><pre>2611</pre></a></td><td class='covered-line'><pre>42.2k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2612' href='#L_COMPARES_2612'><pre>2612</pre></a></td><td class='covered-line'><pre>44.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2613' href='#L_COMPARES_2613'><pre>2613</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2614' href='#L_COMPARES_2614'><pre>2614</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 0 && <span class='tooltip-content'>66</span></div><div class='tooltip'>BO->hasNoSignedWrap()<span class='tooltip-content'>66</span></div>) <div class='tooltip'>{<span class='tooltip-content'>46</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2615' href='#L_COMPARES_2615'><pre>2615</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> const APInt *BOC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2616' href='#L_COMPARES_2616'><pre>2616</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BOp1, m_APInt(BOC)) && <span class='tooltip-content'>46</span></div><div class='tooltip'>*BOC != 0<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2617' href='#L_COMPARES_2617'><pre>2617</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // The trivial case (mul X, 0) is handled by InstSimplify.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2618' href='#L_COMPARES_2618'><pre>2618</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // General case : (mul X, C) != 0 iff X != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2619' href='#L_COMPARES_2619'><pre>2619</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (mul X, C) == 0 iff X == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2620' href='#L_COMPARES_2620'><pre>2620</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(Pred, BOp0, Constant::getNullValue(RHS->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2621' href='#L_COMPARES_2621'><pre>2621</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2622' href='#L_COMPARES_2622'><pre>2622</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2623' href='#L_COMPARES_2623'><pre>2623</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2624' href='#L_COMPARES_2624'><pre>2624</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2625' href='#L_COMPARES_2625'><pre>2625</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (<div class='tooltip'>*C == 0<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2626' href='#L_COMPARES_2626'><pre>2626</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // (icmp eq/ne (udiv A, B), 0) -> (icmp ugt/ule i32 B, A)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2627' href='#L_COMPARES_2627'><pre>2627</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> auto NewPred = isICMP_NE ? <div class='tooltip'>ICmpInst::ICMP_ULE<span class='tooltip-content'>5</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2628' href='#L_COMPARES_2628'><pre>2628</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return new ICmpInst(NewPred, BOp1, BOp0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2629' href='#L_COMPARES_2629'><pre>2629</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2630' href='#L_COMPARES_2630'><pre>2630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2631' href='#L_COMPARES_2631'><pre>2631</pre></a></td><td class='covered-line'><pre>6.54k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2632' href='#L_COMPARES_2632'><pre>2632</pre></a></td><td class='covered-line'><pre>6.54k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2633' href='#L_COMPARES_2633'><pre>2633</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2634' href='#L_COMPARES_2634'><pre>2634</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2635' href='#L_COMPARES_2635'><pre>2635</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2636' href='#L_COMPARES_2636'><pre>2636</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2637' href='#L_COMPARES_2637'><pre>2637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold an icmp with LLVM intrinsic and constant operand: icmp Pred II, C.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2638' href='#L_COMPARES_2638'><pre>2638</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldICmpIntrinsicWithConstant(ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2639' href='#L_COMPARES_2639'><pre>2639</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> const APInt *C) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2640' href='#L_COMPARES_2640'><pre>2640</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> IntrinsicInst *II = dyn_cast<IntrinsicInst>(Cmp.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2641' href='#L_COMPARES_2641'><pre>2641</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> if (<div class='tooltip'>!II || <span class='tooltip-content'>706k</span></div><div class='tooltip'>!Cmp.isEquality()<span class='tooltip-content'>4</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2642' href='#L_COMPARES_2642'><pre>2642</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2643' href='#L_COMPARES_2643'><pre>2643</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2644' href='#L_COMPARES_2644'><pre>2644</pre></a></td><td class='covered-line'><pre>706k</pre></td><td class='code'><pre> // Handle icmp {eq|ne} <intrinsic>, intcst.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2645' href='#L_COMPARES_2645'><pre>2645</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> switch (II->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2646' href='#L_COMPARES_2646'><pre>2646</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> case Intrinsic::bswap:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2647' href='#L_COMPARES_2647'><pre>2647</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Worklist.Add(II);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2648' href='#L_COMPARES_2648'><pre>2648</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Cmp.setOperand(0, II->getArgOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2649' href='#L_COMPARES_2649'><pre>2649</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Cmp.setOperand(1, Builder->getInt(C->byteSwap()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2650' href='#L_COMPARES_2650'><pre>2650</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return &Cmp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2651' href='#L_COMPARES_2651'><pre>2651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::ctlz:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2652' href='#L_COMPARES_2652'><pre>2652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::cttz:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2653' href='#L_COMPARES_2653'><pre>2653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ctz(A) == bitwidth(A) -> A == 0 and likewise for !=</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2654' href='#L_COMPARES_2654'><pre>2654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>*C == C->getBitWidth()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2655' href='#L_COMPARES_2655'><pre>2655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2656' href='#L_COMPARES_2656'><pre>2656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp.setOperand(0, II->getArgOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2657' href='#L_COMPARES_2657'><pre>2657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp.setOperand(1, ConstantInt::getNullValue(II->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2658' href='#L_COMPARES_2658'><pre>2658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &Cmp;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2659' href='#L_COMPARES_2659'><pre>2659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2660' href='#L_COMPARES_2660'><pre>2660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2661' href='#L_COMPARES_2661'><pre>2661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::ctpop: {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2662' href='#L_COMPARES_2662'><pre>2662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // popcount(A) == 0 -> A == 0 and likewise for !=</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2663' href='#L_COMPARES_2663'><pre>2663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // popcount(A) == bitwidth(A) -> A == -1 and likewise for !=</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2664' href='#L_COMPARES_2664'><pre>2664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool IsZero = *C == 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2665' href='#L_COMPARES_2665'><pre>2665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>IsZero || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>*C == C->getBitWidth()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2666' href='#L_COMPARES_2666'><pre>2666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2667' href='#L_COMPARES_2667'><pre>2667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp.setOperand(0, II->getArgOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2668' href='#L_COMPARES_2668'><pre>2668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewOp = IsZero ? </span><span class='red'>Constant::getNullValue(II->getType())</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2669' href='#L_COMPARES_2669'><pre>2669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Constant::getAllOnesValue(II->getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2670' href='#L_COMPARES_2670'><pre>2670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp.setOperand(1, NewOp);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2671' href='#L_COMPARES_2671'><pre>2671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &Cmp;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2672' href='#L_COMPARES_2672'><pre>2672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2673' href='#L_COMPARES_2673'><pre>2673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2674' href='#L_COMPARES_2674'><pre>2674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2675' href='#L_COMPARES_2675'><pre>2675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2676' href='#L_COMPARES_2676'><pre>2676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2677' href='#L_COMPARES_2677'><pre>2677</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2678' href='#L_COMPARES_2678'><pre>2678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2679' href='#L_COMPARES_2679'><pre>2679</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2680' href='#L_COMPARES_2680'><pre>2680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2681' href='#L_COMPARES_2681'><pre>2681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Handle icmp with constant (but not simple integer constant) RHS.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2682' href='#L_COMPARES_2682'><pre>2682</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpInstWithConstantNotInt(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2683' href='#L_COMPARES_2683'><pre>2683</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2684' href='#L_COMPARES_2684'><pre>2684</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> Constant *RHSC = dyn_cast<Constant>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2685' href='#L_COMPARES_2685'><pre>2685</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> Instruction *LHSI = dyn_cast<Instruction>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2686' href='#L_COMPARES_2686'><pre>2686</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> if (<div class='tooltip'>!RHSC || <span class='tooltip-content'>1.32M</span></div><div class='tooltip'>!LHSI<span class='tooltip-content'>998k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2687' href='#L_COMPARES_2687'><pre>2687</pre></a></td><td class='covered-line'><pre>389k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2688' href='#L_COMPARES_2688'><pre>2688</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2689' href='#L_COMPARES_2689'><pre>2689</pre></a></td><td class='covered-line'><pre>936k</pre></td><td class='code'><pre> switch (LHSI->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2690' href='#L_COMPARES_2690'><pre>2690</pre></a></td><td class='covered-line'><pre>488</pre></td><td class='code'><pre> case Instruction::GetElementPtr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2691' href='#L_COMPARES_2691'><pre>2691</pre></a></td><td class='covered-line'><pre>488</pre></td><td class='code'><pre> // icmp pred GEP (P, int 0, int 0, int 0), null -> icmp pred P, null</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2692' href='#L_COMPARES_2692'><pre>2692</pre></a></td><td class='covered-line'><pre>488</pre></td><td class='code'><pre> if (RHSC->isNullValue() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2693' href='#L_COMPARES_2693'><pre>2693</pre></a></td><td class='covered-line'><pre>405</pre></td><td class='code'><pre> cast<GetElementPtrInst>(LHSI)->hasAllZeroIndices())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2694' href='#L_COMPARES_2694'><pre>2694</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return new ICmpInst(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2695' href='#L_COMPARES_2695'><pre>2695</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> I.getPredicate(), LHSI->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2696' href='#L_COMPARES_2696'><pre>2696</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Constant::getNullValue(LHSI->getOperand(0)->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2697' href='#L_COMPARES_2697'><pre>2697</pre></a></td><td class='covered-line'><pre>473</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2698' href='#L_COMPARES_2698'><pre>2698</pre></a></td><td class='covered-line'><pre>119k</pre></td><td class='code'><pre> case Instruction::PHI:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2699' href='#L_COMPARES_2699'><pre>2699</pre></a></td><td class='covered-line'><pre>119k</pre></td><td class='code'><pre> // Only fold icmp into the PHI if the phi and icmp are in the same</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2700' href='#L_COMPARES_2700'><pre>2700</pre></a></td><td class='covered-line'><pre>119k</pre></td><td class='code'><pre> // block. If in the same block, we're encouraging jump threading. If</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2701' href='#L_COMPARES_2701'><pre>2701</pre></a></td><td class='covered-line'><pre>119k</pre></td><td class='code'><pre> // not, we are just pessimizing the code by making an i1 phi.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2702' href='#L_COMPARES_2702'><pre>2702</pre></a></td><td class='covered-line'><pre>119k</pre></td><td class='code'><pre> if (LHSI->getParent() == I.getParent())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2703' href='#L_COMPARES_2703'><pre>2703</pre></a></td><td class='covered-line'><pre>66.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>66.1k</span></div><div class='tooltip'>NV<span class='tooltip-content'>66.1k</span></div> = FoldOpIntoPhi(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2704' href='#L_COMPARES_2704'><pre>2704</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2705' href='#L_COMPARES_2705'><pre>2705</pre></a></td><td class='covered-line'><pre>118k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2706' href='#L_COMPARES_2706'><pre>2706</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> case Instruction::Select: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2707' href='#L_COMPARES_2707'><pre>2707</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // If either operand of the select is a constant, we can fold the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2708' href='#L_COMPARES_2708'><pre>2708</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // comparison into the select arms, which will cause one to be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2709' href='#L_COMPARES_2709'><pre>2709</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // constant folded and the select turned into a bitwise or.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2710' href='#L_COMPARES_2710'><pre>2710</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> Value *Op1 = nullptr, *Op2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2711' href='#L_COMPARES_2711'><pre>2711</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> ConstantInt *CI = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2712' href='#L_COMPARES_2712'><pre>2712</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>8.87k</span></div> = dyn_cast<Constant>(LHSI->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>1.32k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2713' href='#L_COMPARES_2713'><pre>2713</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2714' href='#L_COMPARES_2714'><pre>2714</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> CI = dyn_cast<ConstantInt>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2715' href='#L_COMPARES_2715'><pre>2715</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2716' href='#L_COMPARES_2716'><pre>2716</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>8.87k</span></div> = dyn_cast<Constant>(LHSI->getOperand(2))) <div class='tooltip'>{<span class='tooltip-content'>2.84k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2717' href='#L_COMPARES_2717'><pre>2717</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> Op2 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2718' href='#L_COMPARES_2718'><pre>2718</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> CI = dyn_cast<ConstantInt>(Op2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2719' href='#L_COMPARES_2719'><pre>2719</pre></a></td><td class='covered-line'><pre>2.84k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2720' href='#L_COMPARES_2720'><pre>2720</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2721' href='#L_COMPARES_2721'><pre>2721</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // We only want to perform this transformation if it will not lead to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2722' href='#L_COMPARES_2722'><pre>2722</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // additional code. This is true if either both sides of the select</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2723' href='#L_COMPARES_2723'><pre>2723</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // fold to a constant (in which case the icmp is replaced with a select</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2724' href='#L_COMPARES_2724'><pre>2724</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // which will usually simplify) or this is the only user of the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2725' href='#L_COMPARES_2725'><pre>2725</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // select (in which case we are trading a select+icmp for a simpler</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2726' href='#L_COMPARES_2726'><pre>2726</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // select+icmp) or all uses of the select can be replaced based on</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2727' href='#L_COMPARES_2727'><pre>2727</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> // dominance information ("Global cases").</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2728' href='#L_COMPARES_2728'><pre>2728</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> bool Transform = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2729' href='#L_COMPARES_2729'><pre>2729</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op1 && <span class='tooltip-content'>8.87k</span></div><div class='tooltip'>Op2<span class='tooltip-content'>1.32k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2730' href='#L_COMPARES_2730'><pre>2730</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Transform = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2731' href='#L_COMPARES_2731'><pre>2731</pre></a></td><td class='covered-line'><pre>8.86k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>8.86k</span></div><div class='tooltip'>Op1 || <span class='tooltip-content'>8.86k</span></div><div class='tooltip'>Op2<span class='tooltip-content'>7.55k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.15k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2732' href='#L_COMPARES_2732'><pre>2732</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> // Local case</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2733' href='#L_COMPARES_2733'><pre>2733</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> if (LHSI->hasOneUse())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2734' href='#L_COMPARES_2734'><pre>2734</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Transform = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2735' href='#L_COMPARES_2735'><pre>2735</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> // Global cases</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2736' href='#L_COMPARES_2736'><pre>2736</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>4.13k</span></div><div class='tooltip'>CI && <span class='tooltip-content'>4.13k</span></div><div class='tooltip'>!CI->isZero()<span class='tooltip-content'>4.13k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2737' href='#L_COMPARES_2737'><pre>2737</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> // When Op1 is constant try replacing select with second operand.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2738' href='#L_COMPARES_2738'><pre>2738</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> // Otherwise Op2 is constant and try replacing select with first</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2739' href='#L_COMPARES_2739'><pre>2739</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> // operand.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2740' href='#L_COMPARES_2740'><pre>2740</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> Transform =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2741' href='#L_COMPARES_2741'><pre>2741</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> replacedSelectWithOperand(cast<SelectInst>(LHSI), &I, Op1 ? <div class='tooltip'>2<span class='tooltip-content'>1.17k</span></div> : <div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div>);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2742' href='#L_COMPARES_2742'><pre>2742</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2743' href='#L_COMPARES_2743'><pre>2743</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> if (<div class='tooltip'>Transform<span class='tooltip-content'>8.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>48</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2744' href='#L_COMPARES_2744'><pre>2744</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> if (!Op1)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2745' href='#L_COMPARES_2745'><pre>2745</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Op1 = Builder->CreateICmp(I.getPredicate(), LHSI->getOperand(1), RHSC,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2746' href='#L_COMPARES_2746'><pre>2746</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2747' href='#L_COMPARES_2747'><pre>2747</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> if (!Op2)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2748' href='#L_COMPARES_2748'><pre>2748</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Op2 = Builder->CreateICmp(I.getPredicate(), LHSI->getOperand(2), RHSC,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2749' href='#L_COMPARES_2749'><pre>2749</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2750' href='#L_COMPARES_2750'><pre>2750</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> return SelectInst::Create(LHSI->getOperand(0), Op1, Op2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2751' href='#L_COMPARES_2751'><pre>2751</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2752' href='#L_COMPARES_2752'><pre>2752</pre></a></td><td class='covered-line'><pre>8.82k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2753' href='#L_COMPARES_2753'><pre>2753</pre></a></td><td class='covered-line'><pre>8.87k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2754' href='#L_COMPARES_2754'><pre>2754</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre> case Instruction::IntToPtr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2755' href='#L_COMPARES_2755'><pre>2755</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre> // icmp pred inttoptr(X), null -> icmp pred X, 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2756' href='#L_COMPARES_2756'><pre>2756</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre> if (RHSC->isNullValue() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2757' href='#L_COMPARES_2757'><pre>2757</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre> DL.getIntPtrType(RHSC->getType()) == LHSI->getOperand(0)->getType())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2758' href='#L_COMPARES_2758'><pre>2758</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> return new ICmpInst(</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2759' href='#L_COMPARES_2759'><pre>2759</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> I.getPredicate(), LHSI->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2760' href='#L_COMPARES_2760'><pre>2760</pre></a></td><td class='covered-line'><pre>553</pre></td><td class='code'><pre> Constant::getNullValue(LHSI->getOperand(0)->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2761' href='#L_COMPARES_2761'><pre>2761</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2762' href='#L_COMPARES_2762'><pre>2762</pre></a></td><td class='covered-line'><pre>557</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2763' href='#L_COMPARES_2763'><pre>2763</pre></a></td><td class='covered-line'><pre>465k</pre></td><td class='code'><pre> case Instruction::Load:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2764' href='#L_COMPARES_2764'><pre>2764</pre></a></td><td class='covered-line'><pre>465k</pre></td><td class='code'><pre> // Try to optimize things like "A[i] > 4" to index computations.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2765' href='#L_COMPARES_2765'><pre>2765</pre></a></td><td class='covered-line'><pre>465k</pre></td><td class='code'><pre> if (GetElementPtrInst *GEP =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2766' href='#L_COMPARES_2766'><pre>2766</pre></a></td><td class='covered-line'><pre>365k</pre></td><td class='code'><pre> dyn_cast<GetElementPtrInst>(LHSI->getOperand(0))) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2767' href='#L_COMPARES_2767'><pre>2767</pre></a></td><td class='covered-line'><pre>365k</pre></td><td class='code'><pre> if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GEP->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2768' href='#L_COMPARES_2768'><pre>2768</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>GV->isConstant() && <span class='tooltip-content'>15.2k</span></div><div class='tooltip'>GV->hasDefinitiveInitializer()<span class='tooltip-content'>1.24k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2769' href='#L_COMPARES_2769'><pre>2769</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> !cast<LoadInst>(LHSI)->isVolatile())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2770' href='#L_COMPARES_2770'><pre>2770</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.03k</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.03k</span></div> = foldCmpLoadFromIndexedGlobal(GEP, GV, I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2771' href='#L_COMPARES_2771'><pre>2771</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2772' href='#L_COMPARES_2772'><pre>2772</pre></a></td><td class='covered-line'><pre>365k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2773' href='#L_COMPARES_2773'><pre>2773</pre></a></td><td class='covered-line'><pre>464k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2774' href='#L_COMPARES_2774'><pre>2774</pre></a></td><td class='covered-line'><pre>936k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2775' href='#L_COMPARES_2775'><pre>2775</pre></a></td><td class='covered-line'><pre>936k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2776' href='#L_COMPARES_2776'><pre>2776</pre></a></td><td class='covered-line'><pre>934k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2777' href='#L_COMPARES_2777'><pre>2777</pre></a></td><td class='covered-line'><pre>936k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2778' href='#L_COMPARES_2778'><pre>2778</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2779' href='#L_COMPARES_2779'><pre>2779</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold icmp (binop), X or icmp X, (binop).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2780' href='#L_COMPARES_2780'><pre>2780</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpBinOp(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2781' href='#L_COMPARES_2781'><pre>2781</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2782' href='#L_COMPARES_2782'><pre>2782</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2783' href='#L_COMPARES_2783'><pre>2783</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> // Special logic for binary operators.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2784' href='#L_COMPARES_2784'><pre>2784</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2785' href='#L_COMPARES_2785'><pre>2785</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2786' href='#L_COMPARES_2786'><pre>2786</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> if (<div class='tooltip'>!BO0 && <span class='tooltip-content'>1.31M</span></div><div class='tooltip'>!BO1<span class='tooltip-content'>1.07M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2787' href='#L_COMPARES_2787'><pre>2787</pre></a></td><td class='covered-line'><pre>1.05M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2788' href='#L_COMPARES_2788'><pre>2788</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2789' href='#L_COMPARES_2789'><pre>2789</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> CmpInst::Predicate Pred = I.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2790' href='#L_COMPARES_2790'><pre>2790</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> bool NoOp0WrapProblem = false, NoOp1WrapProblem = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2791' href='#L_COMPARES_2791'><pre>2791</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO0 && <span class='tooltip-content'>256k</span></div><div class='tooltip'>isa<OverflowingBinaryOperator>(BO0)<span class='tooltip-content'>235k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2792' href='#L_COMPARES_2792'><pre>2792</pre></a></td><td class='covered-line'><pre>169k</pre></td><td class='code'><pre> NoOp0WrapProblem =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2793' href='#L_COMPARES_2793'><pre>2793</pre></a></td><td class='covered-line'><pre>169k</pre></td><td class='code'><pre> ICmpInst::isEquality(Pred) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2794' href='#L_COMPARES_2794'><pre>2794</pre></a></td><td class='covered-line'><pre>83.8k</pre></td><td class='code'><pre> <div class='tooltip'>(CmpInst::isUnsigned(Pred) && <span class='tooltip-content'>83.8k</span></div><div class='tooltip'>BO0->hasNoUnsignedWrap()<span class='tooltip-content'>32.5k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2795' href='#L_COMPARES_2795'><pre>2795</pre></a></td><td class='covered-line'><pre>79.9k</pre></td><td class='code'><pre> <div class='tooltip'>(CmpInst::isSigned(Pred) && <span class='tooltip-content'>79.9k</span></div><div class='tooltip'>BO0->hasNoSignedWrap()<span class='tooltip-content'>51.2k</span></div>);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2796' href='#L_COMPARES_2796'><pre>2796</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO1 && <span class='tooltip-content'>256k</span></div><div class='tooltip'>isa<OverflowingBinaryOperator>(BO1)<span class='tooltip-content'>35.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2797' href='#L_COMPARES_2797'><pre>2797</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre> NoOp1WrapProblem =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2798' href='#L_COMPARES_2798'><pre>2798</pre></a></td><td class='covered-line'><pre>26.1k</pre></td><td class='code'><pre> ICmpInst::isEquality(Pred) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2799' href='#L_COMPARES_2799'><pre>2799</pre></a></td><td class='covered-line'><pre>21.7k</pre></td><td class='code'><pre> <div class='tooltip'>(CmpInst::isUnsigned(Pred) && <span class='tooltip-content'>21.7k</span></div><div class='tooltip'>BO1->hasNoUnsignedWrap()<span class='tooltip-content'>5.18k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2800' href='#L_COMPARES_2800'><pre>2800</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre> <div class='tooltip'>(CmpInst::isSigned(Pred) && <span class='tooltip-content'>21.2k</span></div><div class='tooltip'>BO1->hasNoSignedWrap()<span class='tooltip-content'>16.5k</span></div>);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2801' href='#L_COMPARES_2801'><pre>2801</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2802' href='#L_COMPARES_2802'><pre>2802</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // Analyze the case when either Op0 or Op1 is an add instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2803' href='#L_COMPARES_2803'><pre>2803</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2804' href='#L_COMPARES_2804'><pre>2804</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr, *C = nullptr, *D = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2805' href='#L_COMPARES_2805'><pre>2805</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO0 && <span class='tooltip-content'>256k</span></div><div class='tooltip'>BO0->getOpcode() == Instruction::Add<span class='tooltip-content'>235k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>154k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2806' href='#L_COMPARES_2806'><pre>2806</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> A = BO0->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2807' href='#L_COMPARES_2807'><pre>2807</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> B = BO0->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2808' href='#L_COMPARES_2808'><pre>2808</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2809' href='#L_COMPARES_2809'><pre>2809</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO1 && <span class='tooltip-content'>256k</span></div><div class='tooltip'>BO1->getOpcode() == Instruction::Add<span class='tooltip-content'>35.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2810' href='#L_COMPARES_2810'><pre>2810</pre></a></td><td class='covered-line'><pre>19.8k</pre></td><td class='code'><pre> C = BO1->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2811' href='#L_COMPARES_2811'><pre>2811</pre></a></td><td class='covered-line'><pre>19.8k</pre></td><td class='code'><pre> D = BO1->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2812' href='#L_COMPARES_2812'><pre>2812</pre></a></td><td class='covered-line'><pre>19.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2813' href='#L_COMPARES_2813'><pre>2813</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2814' href='#L_COMPARES_2814'><pre>2814</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp (X+Y), X -> icmp Y, 0 for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2815' href='#L_COMPARES_2815'><pre>2815</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> if (<div class='tooltip'>(A == Op1 || <span class='tooltip-content'>256k</span></div><div class='tooltip'>B == Op1<span class='tooltip-content'>256k</span></div>) && <div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>518</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2816' href='#L_COMPARES_2816'><pre>2816</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> <div class='tooltip'>return new ICmpInst(Pred, A == Op1 ? <span class='tooltip-content'>37</span></div><div class='tooltip'>B<span class='tooltip-content'>3</span></div> : <div class='tooltip'>A<span class='tooltip-content'>34</span></div>,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2817' href='#L_COMPARES_2817'><pre>2817</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> Constant::getNullValue(Op1->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2818' href='#L_COMPARES_2818'><pre>2818</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2819' href='#L_COMPARES_2819'><pre>2819</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp X, (X+Y) -> icmp 0, Y for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2820' href='#L_COMPARES_2820'><pre>2820</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>(C == Op0 || <span class='tooltip-content'>256k</span></div><div class='tooltip'>D == Op0<span class='tooltip-content'>256k</span></div>) && <div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>210</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2821' href='#L_COMPARES_2821'><pre>2821</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2822' href='#L_COMPARES_2822'><pre>2822</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> C == Op0 ? <div class='tooltip'>D<span class='tooltip-content'>26</span></div> : <div class='tooltip'>C<span class='tooltip-content'>14</span></div>);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2823' href='#L_COMPARES_2823'><pre>2823</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2824' href='#L_COMPARES_2824'><pre>2824</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp (X+Y), (X+Z) -> icmp Y, Z for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2825' href='#L_COMPARES_2825'><pre>2825</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>A && <span class='tooltip-content'>256k</span></div><div class='tooltip'>C<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>(A == C || <span class='tooltip-content'>4.84k</span></div><div class='tooltip'>A == D<span class='tooltip-content'>4.82k</span></div> || <div class='tooltip'>B == C<span class='tooltip-content'>4.77k</span></div> || <div class='tooltip'>B == D<span class='tooltip-content'>4.77k</span></div>) && <div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>249</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2826' href='#L_COMPARES_2826'><pre>2826</pre></a></td><td class='covered-line'><pre>200</pre></td><td class='code'><pre> NoOp1WrapProblem &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2827' href='#L_COMPARES_2827'><pre>2827</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // Try not to increase register pressure.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2828' href='#L_COMPARES_2828'><pre>2828</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> <div class='tooltip'>BO0->hasOneUse()<span class='tooltip-content'>150</span></div> && <div class='tooltip'><span class='red'>BO1->hasOneUse()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2829' href='#L_COMPARES_2829'><pre>2829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Determine Y and Z in the form icmp (X+Y), (X+Z).</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2830' href='#L_COMPARES_2830'><pre>2830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Y, *Z;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2831' href='#L_COMPARES_2831'><pre>2831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>A == C</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2832' href='#L_COMPARES_2832'><pre>2832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // C + B == C + D -> B == D</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2833' href='#L_COMPARES_2833'><pre>2833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = B;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2834' href='#L_COMPARES_2834'><pre>2834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = D;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2835' href='#L_COMPARES_2835'><pre>2835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>A == D</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2836' href='#L_COMPARES_2836'><pre>2836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // D + B == C + D -> B == C</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2837' href='#L_COMPARES_2837'><pre>2837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = B;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2838' href='#L_COMPARES_2838'><pre>2838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = C;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2839' href='#L_COMPARES_2839'><pre>2839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2840' href='#L_COMPARES_2840'><pre>2840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // A + C == C + D -> A == D</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2841' href='#L_COMPARES_2841'><pre>2841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = A;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2842' href='#L_COMPARES_2842'><pre>2842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = D;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2843' href='#L_COMPARES_2843'><pre>2843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2844' href='#L_COMPARES_2844'><pre>2844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(B == D);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2845' href='#L_COMPARES_2845'><pre>2845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // A + D == C + D -> A == C</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2846' href='#L_COMPARES_2846'><pre>2846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = A;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2847' href='#L_COMPARES_2847'><pre>2847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = C;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2848' href='#L_COMPARES_2848'><pre>2848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2849' href='#L_COMPARES_2849'><pre>2849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, Y, Z);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2850' href='#L_COMPARES_2850'><pre>2850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2851' href='#L_COMPARES_2851'><pre>2851</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2852' href='#L_COMPARES_2852'><pre>2852</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp slt (X + -1), Y -> icmp sle X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2853' href='#L_COMPARES_2853'><pre>2853</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>A && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SLT<span class='tooltip-content'>121k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2854' href='#L_COMPARES_2854'><pre>2854</pre></a></td><td class='covered-line'><pre>27.6k</pre></td><td class='code'><pre> match(B, m_AllOnes()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2855' href='#L_COMPARES_2855'><pre>2855</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SLE, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2856' href='#L_COMPARES_2856'><pre>2856</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2857' href='#L_COMPARES_2857'><pre>2857</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sge (X + -1), Y -> icmp sgt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2858' href='#L_COMPARES_2858'><pre>2858</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>A && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SGE<span class='tooltip-content'>121k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2859' href='#L_COMPARES_2859'><pre>2859</pre></a></td><td class='covered-line'><pre>497</pre></td><td class='code'><pre> match(B, m_AllOnes()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2860' href='#L_COMPARES_2860'><pre>2860</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SGT, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2861' href='#L_COMPARES_2861'><pre>2861</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2862' href='#L_COMPARES_2862'><pre>2862</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sle (X + 1), Y -> icmp slt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2863' href='#L_COMPARES_2863'><pre>2863</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>A && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SLE<span class='tooltip-content'>121k</span></div> && <div class='tooltip'>match(B, m_One())<span class='tooltip-content'>205</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2864' href='#L_COMPARES_2864'><pre>2864</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SLT, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2865' href='#L_COMPARES_2865'><pre>2865</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2866' href='#L_COMPARES_2866'><pre>2866</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sgt (X + 1), Y -> icmp sge X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2867' href='#L_COMPARES_2867'><pre>2867</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>A && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SGT<span class='tooltip-content'>121k</span></div> && <div class='tooltip'>match(B, m_One())<span class='tooltip-content'>7.41k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2868' href='#L_COMPARES_2868'><pre>2868</pre></a></td><td class='covered-line'><pre>552</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SGE, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2869' href='#L_COMPARES_2869'><pre>2869</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2870' href='#L_COMPARES_2870'><pre>2870</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sgt X, (Y + -1) -> icmp sge X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2871' href='#L_COMPARES_2871'><pre>2871</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>C && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.6k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SGT<span class='tooltip-content'>10.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2872' href='#L_COMPARES_2872'><pre>2872</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> match(D, m_AllOnes()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2873' href='#L_COMPARES_2873'><pre>2873</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SGE, Op0, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2874' href='#L_COMPARES_2874'><pre>2874</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2875' href='#L_COMPARES_2875'><pre>2875</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sle X, (Y + -1) -> icmp slt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2876' href='#L_COMPARES_2876'><pre>2876</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>C && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.5k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SLE<span class='tooltip-content'>10.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2877' href='#L_COMPARES_2877'><pre>2877</pre></a></td><td class='covered-line'><pre>80</pre></td><td class='code'><pre> match(D, m_AllOnes()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2878' href='#L_COMPARES_2878'><pre>2878</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SLT, Op0, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2879' href='#L_COMPARES_2879'><pre>2879</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2880' href='#L_COMPARES_2880'><pre>2880</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp sge X, (Y + 1) -> icmp sgt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2881' href='#L_COMPARES_2881'><pre>2881</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>C && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.5k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SGE<span class='tooltip-content'>10.6k</span></div> && <div class='tooltip'>match(D, m_One())<span class='tooltip-content'>44</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2882' href='#L_COMPARES_2882'><pre>2882</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SGT, Op0, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2883' href='#L_COMPARES_2883'><pre>2883</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2884' href='#L_COMPARES_2884'><pre>2884</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp slt X, (Y + 1) -> icmp sle X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2885' href='#L_COMPARES_2885'><pre>2885</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>256k</span></div><div class='tooltip'>C && <span class='tooltip-content'>256k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.5k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_SLT<span class='tooltip-content'>10.6k</span></div> && <div class='tooltip'>match(D, m_One())<span class='tooltip-content'>5.30k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2886' href='#L_COMPARES_2886'><pre>2886</pre></a></td><td class='covered-line'><pre>244</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_SLE, Op0, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2887' href='#L_COMPARES_2887'><pre>2887</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2888' href='#L_COMPARES_2888'><pre>2888</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // TODO: The subtraction-related identities shown below also hold, but</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2889' href='#L_COMPARES_2889'><pre>2889</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // canonicalization from (X -nuw 1) to (X + -1) means that the combinations</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2890' href='#L_COMPARES_2890'><pre>2890</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // wouldn't happen even if they were implemented.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2891' href='#L_COMPARES_2891'><pre>2891</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2892' href='#L_COMPARES_2892'><pre>2892</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp ult (X - 1), Y -> icmp ule X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2893' href='#L_COMPARES_2893'><pre>2893</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp uge (X - 1), Y -> icmp ugt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2894' href='#L_COMPARES_2894'><pre>2894</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp ugt X, (Y - 1) -> icmp uge X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2895' href='#L_COMPARES_2895'><pre>2895</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp ule X, (Y - 1) -> icmp ult X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2896' href='#L_COMPARES_2896'><pre>2896</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2897' href='#L_COMPARES_2897'><pre>2897</pre></a></td><td class='covered-line'><pre>256k</pre></td><td class='code'><pre> // icmp ule (X + 1), Y -> icmp ult X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2898' href='#L_COMPARES_2898'><pre>2898</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>A && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_ULE<span class='tooltip-content'>121k</span></div> && <div class='tooltip'>match(B, m_One())<span class='tooltip-content'>7</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2899' href='#L_COMPARES_2899'><pre>2899</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_ULT, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2900' href='#L_COMPARES_2900'><pre>2900</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2901' href='#L_COMPARES_2901'><pre>2901</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp ugt (X + 1), Y -> icmp uge X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2902' href='#L_COMPARES_2902'><pre>2902</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>A && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_UGT<span class='tooltip-content'>121k</span></div> && <div class='tooltip'>match(B, m_One())<span class='tooltip-content'>402</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2903' href='#L_COMPARES_2903'><pre>2903</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_UGE, A, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2904' href='#L_COMPARES_2904'><pre>2904</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2905' href='#L_COMPARES_2905'><pre>2905</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp uge X, (Y + 1) -> icmp ugt X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2906' href='#L_COMPARES_2906'><pre>2906</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>C && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.3k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_UGE<span class='tooltip-content'>10.4k</span></div> && <div class='tooltip'><span class='red'>match(D, m_One())</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2907' href='#L_COMPARES_2907'><pre>2907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(CmpInst::ICMP_UGT, Op0, C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2908' href='#L_COMPARES_2908'><pre>2908</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2909' href='#L_COMPARES_2909'><pre>2909</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp ult X, (Y + 1) -> icmp ule X, Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2910' href='#L_COMPARES_2910'><pre>2910</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>C && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>19.3k</span></div> && <div class='tooltip'>Pred == CmpInst::ICMP_ULT<span class='tooltip-content'>10.4k</span></div> && <div class='tooltip'>match(D, m_One())<span class='tooltip-content'>181</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2911' href='#L_COMPARES_2911'><pre>2911</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new ICmpInst(CmpInst::ICMP_ULE, Op0, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2912' href='#L_COMPARES_2912'><pre>2912</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2913' href='#L_COMPARES_2913'><pre>2913</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // if C1 has greater magnitude than C2:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2914' href='#L_COMPARES_2914'><pre>2914</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (X + C1), (Y + C2) -> icmp (X + C3), Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2915' href='#L_COMPARES_2915'><pre>2915</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // s.t. C3 = C1 - C2</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2916' href='#L_COMPARES_2916'><pre>2916</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2917' href='#L_COMPARES_2917'><pre>2917</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // if C2 has greater magnitude than C1:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2918' href='#L_COMPARES_2918'><pre>2918</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (X + C1), (Y + C2) -> icmp X, (Y + C3)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2919' href='#L_COMPARES_2919'><pre>2919</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // s.t. C3 = C2 - C1</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2920' href='#L_COMPARES_2920'><pre>2920</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>A && <span class='tooltip-content'>255k</span></div><div class='tooltip'>C<span class='tooltip-content'>154k</span></div> && <div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>4.59k</span></div> && <div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>3.47k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2921' href='#L_COMPARES_2921'><pre>2921</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> <div class='tooltip'>(BO0->hasOneUse() || <span class='tooltip-content'>2.52k</span></div><div class='tooltip'>BO1->hasOneUse()<span class='tooltip-content'>2.41k</span></div>) && <div class='tooltip'>!I.isUnsigned()<span class='tooltip-content'>817</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2922' href='#L_COMPARES_2922'><pre>2922</pre></a></td><td class='covered-line'><pre>817</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>817</span></div><div class='tooltip'>C1<span class='tooltip-content'>817</span></div> = dyn_cast<ConstantInt>(B))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2923' href='#L_COMPARES_2923'><pre>2923</pre></a></td><td class='covered-line'><pre>590</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>590</span></div><div class='tooltip'>C2<span class='tooltip-content'>590</span></div> = dyn_cast<ConstantInt>(D)) <div class='tooltip'>{<span class='tooltip-content'>357</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2924' href='#L_COMPARES_2924'><pre>2924</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> const APInt &AP1 = C1->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2925' href='#L_COMPARES_2925'><pre>2925</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> const APInt &AP2 = C2->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2926' href='#L_COMPARES_2926'><pre>2926</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> if (<div class='tooltip'>AP1.isNegative() == AP2.isNegative()<span class='tooltip-content'>357</span></div>) <div class='tooltip'>{<span class='tooltip-content'>167</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2927' href='#L_COMPARES_2927'><pre>2927</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> APInt AP1Abs = C1->getValue().abs();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2928' href='#L_COMPARES_2928'><pre>2928</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> APInt AP2Abs = C2->getValue().abs();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2929' href='#L_COMPARES_2929'><pre>2929</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> if (<div class='tooltip'>AP1Abs.uge(AP2Abs)<span class='tooltip-content'>167</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2930' href='#L_COMPARES_2930'><pre>2930</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> ConstantInt *C3 = Builder->getInt(AP1 - AP2);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2931' href='#L_COMPARES_2931'><pre>2931</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateNSWAdd(A, C3);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2932' href='#L_COMPARES_2932'><pre>2932</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return new ICmpInst(Pred, NewAdd, C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2933' href='#L_COMPARES_2933'><pre>2933</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2934' href='#L_COMPARES_2934'><pre>2934</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> ConstantInt *C3 = Builder->getInt(AP2 - AP1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2935' href='#L_COMPARES_2935'><pre>2935</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> Value *NewAdd = Builder->CreateNSWAdd(C, C3);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2936' href='#L_COMPARES_2936'><pre>2936</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> return new ICmpInst(Pred, A, NewAdd);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2937' href='#L_COMPARES_2937'><pre>2937</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2938' href='#L_COMPARES_2938'><pre>2938</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2939' href='#L_COMPARES_2939'><pre>2939</pre></a></td><td class='covered-line'><pre>357</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2940' href='#L_COMPARES_2940'><pre>2940</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2941' href='#L_COMPARES_2941'><pre>2941</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // Analyze the case when either Op0 or Op1 is a sub instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2942' href='#L_COMPARES_2942'><pre>2942</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2943' href='#L_COMPARES_2943'><pre>2943</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> A = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2944' href='#L_COMPARES_2944'><pre>2944</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> B = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2945' href='#L_COMPARES_2945'><pre>2945</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> C = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2946' href='#L_COMPARES_2946'><pre>2946</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> D = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2947' href='#L_COMPARES_2947'><pre>2947</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO0 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>BO0->getOpcode() == Instruction::Sub<span class='tooltip-content'>234k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>11.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2948' href='#L_COMPARES_2948'><pre>2948</pre></a></td><td class='covered-line'><pre>11.9k</pre></td><td class='code'><pre> A = BO0->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2949' href='#L_COMPARES_2949'><pre>2949</pre></a></td><td class='covered-line'><pre>11.9k</pre></td><td class='code'><pre> B = BO0->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2950' href='#L_COMPARES_2950'><pre>2950</pre></a></td><td class='covered-line'><pre>11.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2951' href='#L_COMPARES_2951'><pre>2951</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO1 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>BO1->getOpcode() == Instruction::Sub<span class='tooltip-content'>35.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.40k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2952' href='#L_COMPARES_2952'><pre>2952</pre></a></td><td class='covered-line'><pre>3.40k</pre></td><td class='code'><pre> C = BO1->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2953' href='#L_COMPARES_2953'><pre>2953</pre></a></td><td class='covered-line'><pre>3.40k</pre></td><td class='code'><pre> D = BO1->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2954' href='#L_COMPARES_2954'><pre>2954</pre></a></td><td class='covered-line'><pre>3.40k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2955' href='#L_COMPARES_2955'><pre>2955</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2956' href='#L_COMPARES_2956'><pre>2956</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (X-Y), X -> icmp 0, Y for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2957' href='#L_COMPARES_2957'><pre>2957</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> if (<div class='tooltip'>A == Op1 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>25</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2958' href='#L_COMPARES_2958'><pre>2958</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2959' href='#L_COMPARES_2959'><pre>2959</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2960' href='#L_COMPARES_2960'><pre>2960</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp X, (X-Y) -> icmp Y, 0 for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2961' href='#L_COMPARES_2961'><pre>2961</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>C == Op0 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>4</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2962' href='#L_COMPARES_2962'><pre>2962</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2963' href='#L_COMPARES_2963'><pre>2963</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2964' href='#L_COMPARES_2964'><pre>2964</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (Y-X), (Z-X) -> icmp Y, Z for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2965' href='#L_COMPARES_2965'><pre>2965</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>B && <span class='tooltip-content'>255k</span></div><div class='tooltip'>D<span class='tooltip-content'>11.9k</span></div> && <div class='tooltip'>B == D<span class='tooltip-content'>442</span></div> && <div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>45</span></div> && <div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>36</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2966' href='#L_COMPARES_2966'><pre>2966</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // Try not to increase register pressure.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2967' href='#L_COMPARES_2967'><pre>2967</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>BO0->hasOneUse()<span class='tooltip-content'>36</span></div> && <div class='tooltip'><span class='red'>BO1->hasOneUse()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2968' href='#L_COMPARES_2968'><pre>2968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, A, C)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2969' href='#L_COMPARES_2969'><pre>2969</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2970' href='#L_COMPARES_2970'><pre>2970</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (X-Y), (X-Z) -> icmp Z, Y for equalities or if there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2971' href='#L_COMPARES_2971'><pre>2971</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>A && <span class='tooltip-content'>255k</span></div><div class='tooltip'>C<span class='tooltip-content'>11.9k</span></div> && <div class='tooltip'>A == C<span class='tooltip-content'>442</span></div> && <div class='tooltip'>NoOp0WrapProblem<span class='tooltip-content'>30</span></div> && <div class='tooltip'>NoOp1WrapProblem<span class='tooltip-content'>30</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2972' href='#L_COMPARES_2972'><pre>2972</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // Try not to increase register pressure.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2973' href='#L_COMPARES_2973'><pre>2973</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> <div class='tooltip'>BO0->hasOneUse()<span class='tooltip-content'>30</span></div> && <div class='tooltip'><span class='red'>BO1->hasOneUse()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2974' href='#L_COMPARES_2974'><pre>2974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, D, B)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2975' href='#L_COMPARES_2975'><pre>2975</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2976' href='#L_COMPARES_2976'><pre>2976</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (0-X) < cst --> x > -cst</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2977' href='#L_COMPARES_2977'><pre>2977</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>NoOp0WrapProblem && <span class='tooltip-content'>255k</span></div><div class='tooltip'>ICmpInst::isSigned(Pred)<span class='tooltip-content'>129k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>39.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2978' href='#L_COMPARES_2978'><pre>2978</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2979' href='#L_COMPARES_2979'><pre>2979</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> if (match(BO0, m_Neg(m_Value(X))))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2980' href='#L_COMPARES_2980'><pre>2980</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>2</span></div><div class='tooltip'>RHSC<span class='tooltip-content'>2</span></div> = dyn_cast<ConstantInt>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2981' href='#L_COMPARES_2981'><pre>2981</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>!RHSC->isMinValue(/*isSigned=*/true)<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2982' href='#L_COMPARES_2982'><pre>2982</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(I.getSwappedPredicate(), X,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2983' href='#L_COMPARES_2983'><pre>2983</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> ConstantExpr::getNeg(RHSC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2984' href='#L_COMPARES_2984'><pre>2984</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2985' href='#L_COMPARES_2985'><pre>2985</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2986' href='#L_COMPARES_2986'><pre>2986</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> BinaryOperator *SRem = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2987' href='#L_COMPARES_2987'><pre>2987</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp (srem X, Y), Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2988' href='#L_COMPARES_2988'><pre>2988</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO0 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>BO0->getOpcode() == Instruction::SRem<span class='tooltip-content'>234k</span></div> && <div class='tooltip'>Op1 == BO0->getOperand(1)<span class='tooltip-content'>927</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2989' href='#L_COMPARES_2989'><pre>2989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>SRem = BO0</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2990' href='#L_COMPARES_2990'><pre>2990</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> // icmp Y, (srem X, Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2991' href='#L_COMPARES_2991'><pre>2991</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>BO1 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>BO1->getOpcode() == Instruction::SRem<span class='tooltip-content'>35.0k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2992' href='#L_COMPARES_2992'><pre>2992</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> Op0 == BO1->getOperand(1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2993' href='#L_COMPARES_2993'><pre>2993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>SRem = BO1</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2994' href='#L_COMPARES_2994'><pre>2994</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> if (<div class='tooltip'>SRem<span class='tooltip-content'>255k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2995' href='#L_COMPARES_2995'><pre>2995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We don't check hasOneUse to avoid increasing register pressure because</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2996' href='#L_COMPARES_2996'><pre>2996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the value we use is the same value this instruction was already using.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2997' href='#L_COMPARES_2997'><pre>2997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (SRem == BO0 ? </span><div class='tooltip'><span class='red'>ICmpInst::getSwappedPredicate(Pred)</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Pred</span><span class='tooltip-content'>0</span></div><span class='red'>) {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2998' href='#L_COMPARES_2998'><pre>2998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_2999' href='#L_COMPARES_2999'><pre>2999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3000' href='#L_COMPARES_3000'><pre>3000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3001' href='#L_COMPARES_3001'><pre>3001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3002' href='#L_COMPARES_3002'><pre>3002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3003' href='#L_COMPARES_3003'><pre>3003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3004' href='#L_COMPARES_3004'><pre>3004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3005' href='#L_COMPARES_3005'><pre>3005</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3006' href='#L_COMPARES_3006'><pre>3006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_SGT, SRem->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3007' href='#L_COMPARES_3007'><pre>3007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getAllOnesValue(SRem->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3008' href='#L_COMPARES_3008'><pre>3008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3009' href='#L_COMPARES_3009'><pre>3009</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3010' href='#L_COMPARES_3010'><pre>3010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_SLT, SRem->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3011' href='#L_COMPARES_3011'><pre>3011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(SRem->getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3012' href='#L_COMPARES_3012'><pre>3012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3013' href='#L_COMPARES_3013'><pre>3013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3014' href='#L_COMPARES_3014'><pre>3014</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3015' href='#L_COMPARES_3015'><pre>3015</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>BO0 && <span class='tooltip-content'>255k</span></div><div class='tooltip'>BO1<span class='tooltip-content'>234k</span></div> && <div class='tooltip'>BO0->getOpcode() == BO1->getOpcode()<span class='tooltip-content'>13.4k</span></div> && <div class='tooltip'>BO0->hasOneUse()<span class='tooltip-content'>5.84k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3016' href='#L_COMPARES_3016'><pre>3016</pre></a></td><td class='covered-line'><pre>604</pre></td><td class='code'><pre> <div class='tooltip'>BO1->hasOneUse()<span class='tooltip-content'>604</span></div> && <div class='tooltip'>BO0->getOperand(1) == BO1->getOperand(1)<span class='tooltip-content'>366</span></div>) <div class='tooltip'>{<span class='tooltip-content'>84</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3017' href='#L_COMPARES_3017'><pre>3017</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> switch (BO0->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3018' href='#L_COMPARES_3018'><pre>3018</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3019' href='#L_COMPARES_3019'><pre>3019</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3020' href='#L_COMPARES_3020'><pre>3020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Instruction::Add:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3021' href='#L_COMPARES_3021'><pre>3021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Sub:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3022' href='#L_COMPARES_3022'><pre>3022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Xor:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3023' href='#L_COMPARES_3023'><pre>3023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I.isEquality()</span><span class='red'>) // a+x icmp eq/ne b+x --> a icmp b</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3024' href='#L_COMPARES_3024'><pre>3024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), BO0->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3025' href='#L_COMPARES_3025'><pre>3025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO1->getOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3026' href='#L_COMPARES_3026'><pre>3026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3027' href='#L_COMPARES_3027'><pre>3027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantInt *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(BO0->getOperand(1))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3028' href='#L_COMPARES_3028'><pre>3028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CI->getValue().isSignBit()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3029' href='#L_COMPARES_3029'><pre>3029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ICmpInst::Predicate Pred =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3030' href='#L_COMPARES_3030'><pre>3030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.isSigned() ? </span><div class='tooltip'><span class='red'>I.getUnsignedPredicate()</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>I.getSignedPredicate()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3031' href='#L_COMPARES_3031'><pre>3031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3032' href='#L_COMPARES_3032'><pre>3032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3033' href='#L_COMPARES_3033'><pre>3033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3034' href='#L_COMPARES_3034'><pre>3034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>BO0->getOpcode() == Instruction::Xor && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI->isMaxValue(true)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3035' href='#L_COMPARES_3035'><pre>3035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ICmpInst::Predicate Pred =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3036' href='#L_COMPARES_3036'><pre>3036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.isSigned() ? </span><div class='tooltip'><span class='red'>I.getUnsignedPredicate()</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>I.getSignedPredicate()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3037' href='#L_COMPARES_3037'><pre>3037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = I.getSwappedPredicate(Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3038' href='#L_COMPARES_3038'><pre>3038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, BO0->getOperand(0), BO1->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3039' href='#L_COMPARES_3039'><pre>3039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3040' href='#L_COMPARES_3040'><pre>3040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3041' href='#L_COMPARES_3041'><pre>3041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3042' href='#L_COMPARES_3042'><pre>3042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Mul:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3043' href='#L_COMPARES_3043'><pre>3043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!I.isEquality()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3044' href='#L_COMPARES_3044'><pre>3044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3045' href='#L_COMPARES_3045'><pre>3045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3046' href='#L_COMPARES_3046'><pre>3046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantInt *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(BO0->getOperand(1))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3047' href='#L_COMPARES_3047'><pre>3047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // a * Cst icmp eq/ne b * Cst --> a & Mask icmp b & Mask</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3048' href='#L_COMPARES_3048'><pre>3048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Mask = -1 >> count-trailing-zeros(Cst).</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3049' href='#L_COMPARES_3049'><pre>3049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CI->isZero() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CI->isOne()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3050' href='#L_COMPARES_3050'><pre>3050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt &AP = CI->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3051' href='#L_COMPARES_3051'><pre>3051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *Mask = ConstantInt::get(</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3052' href='#L_COMPARES_3052'><pre>3052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.getContext(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3053' href='#L_COMPARES_3053'><pre>3053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt::getLowBitsSet(AP.getBitWidth(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3054' href='#L_COMPARES_3054'><pre>3054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AP.getBitWidth() - AP.countTrailingZeros()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3055' href='#L_COMPARES_3055'><pre>3055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *And1 = Builder->CreateAnd(BO0->getOperand(0), Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3056' href='#L_COMPARES_3056'><pre>3056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *And2 = Builder->CreateAnd(BO1->getOperand(0), Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3057' href='#L_COMPARES_3057'><pre>3057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(I.getPredicate(), And1, And2);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3058' href='#L_COMPARES_3058'><pre>3058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3059' href='#L_COMPARES_3059'><pre>3059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3060' href='#L_COMPARES_3060'><pre>3060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3061' href='#L_COMPARES_3061'><pre>3061</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre><span class='red'> </span>case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3062' href='#L_COMPARES_3062'><pre>3062</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3063' href='#L_COMPARES_3063'><pre>3063</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> if (I.isSigned())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3064' href='#L_COMPARES_3064'><pre>3064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3065' href='#L_COMPARES_3065'><pre>3065</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>32</span></div><div class='tooltip'>;<span class='tooltip-content'>32</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3066' href='#L_COMPARES_3066'><pre>3066</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> case Instruction::SDiv:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3067' href='#L_COMPARES_3067'><pre>3067</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3068' href='#L_COMPARES_3068'><pre>3068</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> if (<div class='tooltip'>!BO0->isExact() || <span class='tooltip-content'>60</span></div><div class='tooltip'>!BO1->isExact()<span class='tooltip-content'>12</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3069' href='#L_COMPARES_3069'><pre>3069</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3070' href='#L_COMPARES_3070'><pre>3070</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), BO0->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3071' href='#L_COMPARES_3071'><pre>3071</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> BO1->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3072' href='#L_COMPARES_3072'><pre>3072</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Instruction::Shl: {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3073' href='#L_COMPARES_3073'><pre>3073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool NUW = BO0->hasNoUnsignedWrap() && </span><span class='red'>BO1->hasNoUnsignedWrap()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3074' href='#L_COMPARES_3074'><pre>3074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool NSW = BO0->hasNoSignedWrap() && </span><span class='red'>BO1->hasNoSignedWrap()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3075' href='#L_COMPARES_3075'><pre>3075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!NUW && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!NSW</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3076' href='#L_COMPARES_3076'><pre>3076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3077' href='#L_COMPARES_3077'><pre>3077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!NSW && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I.isSigned()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3078' href='#L_COMPARES_3078'><pre>3078</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3079' href='#L_COMPARES_3079'><pre>3079</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), BO0->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3080' href='#L_COMPARES_3080'><pre>3080</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO1->getOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3081' href='#L_COMPARES_3081'><pre>3081</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3082' href='#L_COMPARES_3082'><pre>3082</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3083' href='#L_COMPARES_3083'><pre>3083</pre></a></td><td class='covered-line'><pre>84</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3084' href='#L_COMPARES_3084'><pre>3084</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3085' href='#L_COMPARES_3085'><pre>3085</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>255k</span></div><div class='tooltip'>BO0<span class='tooltip-content'>255k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>234k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3086' href='#L_COMPARES_3086'><pre>3086</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> // Transform A & (L - 1) `ult` L --> L != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3087' href='#L_COMPARES_3087'><pre>3087</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> auto LSubOne = m_Add(m_Specific(Op1), m_AllOnes());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3088' href='#L_COMPARES_3088'><pre>3088</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> auto BitwiseAnd =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3089' href='#L_COMPARES_3089'><pre>3089</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> m_CombineOr(m_And(m_Value(), LSubOne), m_And(LSubOne, m_Value()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3090' href='#L_COMPARES_3090'><pre>3090</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3091' href='#L_COMPARES_3091'><pre>3091</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(BO0, BitwiseAnd) && <span class='tooltip-content'>234k</span></div><div class='tooltip'><span class='red'>I.getPredicate() == ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3092' href='#L_COMPARES_3092'><pre>3092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Zero = Constant::getNullValue(BO0->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3093' href='#L_COMPARES_3093'><pre>3093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(ICmpInst::ICMP_NE, Op1, Zero);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3094' href='#L_COMPARES_3094'><pre>3094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3095' href='#L_COMPARES_3095'><pre>3095</pre></a></td><td class='covered-line'><pre>234k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3096' href='#L_COMPARES_3096'><pre>3096</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3097' href='#L_COMPARES_3097'><pre>3097</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3098' href='#L_COMPARES_3098'><pre>3098</pre></a></td><td class='covered-line'><pre>255k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3099' href='#L_COMPARES_3099'><pre>3099</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3100' href='#L_COMPARES_3100'><pre>3100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold icmp Pred min|max(X, Y), X.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3101' href='#L_COMPARES_3101'><pre>3101</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre>static Instruction *foldICmpWithMinMax(ICmpInst &Cmp) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3102' href='#L_COMPARES_3102'><pre>3102</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3103' href='#L_COMPARES_3103'><pre>3103</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Value *Op0 = Cmp.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3104' href='#L_COMPARES_3104'><pre>3104</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Value *X = Cmp.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3105' href='#L_COMPARES_3105'><pre>3105</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3106' href='#L_COMPARES_3106'><pre>3106</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // Canonicalize minimum or maximum operand to LHS of the icmp.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3107' href='#L_COMPARES_3107'><pre>3107</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (match(X, m_c_SMin(m_Specific(Op0), m_Value())) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3108' href='#L_COMPARES_3108'><pre>3108</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> match(X, m_c_SMax(m_Specific(Op0), m_Value())) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3109' href='#L_COMPARES_3109'><pre>3109</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> match(X, m_c_UMin(m_Specific(Op0), m_Value())) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3110' href='#L_COMPARES_3110'><pre>3110</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>match(X, m_c_UMax(m_Specific(Op0), m_Value()))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3111' href='#L_COMPARES_3111'><pre>3111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, X);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3112' href='#L_COMPARES_3112'><pre>3112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = Cmp.getSwappedPredicate();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3113' href='#L_COMPARES_3113'><pre>3113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3114' href='#L_COMPARES_3114'><pre>3114</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3115' href='#L_COMPARES_3115'><pre>3115</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Value *Y;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3116' href='#L_COMPARES_3116'><pre>3116</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_c_SMin(m_Specific(X), m_Value(Y)))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3117' href='#L_COMPARES_3117'><pre>3117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) == X --> X s<= Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3118' href='#L_COMPARES_3118'><pre>3118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) s>= X --> X s<= Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3119' href='#L_COMPARES_3119'><pre>3119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_EQ || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3120' href='#L_COMPARES_3120'><pre>3120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_SLE, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3121' href='#L_COMPARES_3121'><pre>3121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3122' href='#L_COMPARES_3122'><pre>3122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) != X --> X s> Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3123' href='#L_COMPARES_3123'><pre>3123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) s< X --> X s> Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3124' href='#L_COMPARES_3124'><pre>3124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3125' href='#L_COMPARES_3125'><pre>3125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_SGT, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3126' href='#L_COMPARES_3126'><pre>3126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3127' href='#L_COMPARES_3127'><pre>3127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These cases should be handled in InstSimplify:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3128' href='#L_COMPARES_3128'><pre>3128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) s<= X --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3129' href='#L_COMPARES_3129'><pre>3129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smin(X, Y) s> X --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3130' href='#L_COMPARES_3130'><pre>3130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3131' href='#L_COMPARES_3131'><pre>3131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3132' href='#L_COMPARES_3132'><pre>3132</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3133' href='#L_COMPARES_3133'><pre>3133</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op0, m_c_SMax(m_Specific(X), m_Value(Y)))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3134' href='#L_COMPARES_3134'><pre>3134</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // smax(X, Y) == X --> X s>= Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3135' href='#L_COMPARES_3135'><pre>3135</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // smax(X, Y) s<= X --> X s>= Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3136' href='#L_COMPARES_3136'><pre>3136</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == CmpInst::ICMP_EQ || <span class='tooltip-content'>7</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_SLE</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3137' href='#L_COMPARES_3137'><pre>3137</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGE, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3138' href='#L_COMPARES_3138'><pre>3138</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3139' href='#L_COMPARES_3139'><pre>3139</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // smax(X, Y) != X --> X s< Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3140' href='#L_COMPARES_3140'><pre>3140</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // smax(X, Y) s> X --> X s< Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3141' href='#L_COMPARES_3141'><pre>3141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3142' href='#L_COMPARES_3142'><pre>3142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_SLT, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3143' href='#L_COMPARES_3143'><pre>3143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3144' href='#L_COMPARES_3144'><pre>3144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These cases should be handled in InstSimplify:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3145' href='#L_COMPARES_3145'><pre>3145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smax(X, Y) s>= X --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3146' href='#L_COMPARES_3146'><pre>3146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // smax(X, Y) s< X --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3147' href='#L_COMPARES_3147'><pre>3147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3148' href='#L_COMPARES_3148'><pre>3148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3149' href='#L_COMPARES_3149'><pre>3149</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3150' href='#L_COMPARES_3150'><pre>3150</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op0, m_c_UMin(m_Specific(X), m_Value(Y)))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3151' href='#L_COMPARES_3151'><pre>3151</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // umin(X, Y) == X --> X u<= Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3152' href='#L_COMPARES_3152'><pre>3152</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // umin(X, Y) u>= X --> X u<= Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3153' href='#L_COMPARES_3153'><pre>3153</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == CmpInst::ICMP_EQ || <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_UGE</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3154' href='#L_COMPARES_3154'><pre>3154</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_ULE, X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3155' href='#L_COMPARES_3155'><pre>3155</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3156' href='#L_COMPARES_3156'><pre>3156</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // umin(X, Y) != X --> X u> Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3157' href='#L_COMPARES_3157'><pre>3157</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // umin(X, Y) u< X --> X u> Y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3158' href='#L_COMPARES_3158'><pre>3158</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3159' href='#L_COMPARES_3159'><pre>3159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_UGT, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3160' href='#L_COMPARES_3160'><pre>3160</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3161' href='#L_COMPARES_3161'><pre>3161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These cases should be handled in InstSimplify:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3162' href='#L_COMPARES_3162'><pre>3162</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umin(X, Y) u<= X --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3163' href='#L_COMPARES_3163'><pre>3163</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umin(X, Y) u> X --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3164' href='#L_COMPARES_3164'><pre>3164</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3165' href='#L_COMPARES_3165'><pre>3165</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3166' href='#L_COMPARES_3166'><pre>3166</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3167' href='#L_COMPARES_3167'><pre>3167</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op0, m_c_UMax(m_Specific(X), m_Value(Y)))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3168' href='#L_COMPARES_3168'><pre>3168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) == X --> X u>= Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3169' href='#L_COMPARES_3169'><pre>3169</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) u<= X --> X u>= Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3170' href='#L_COMPARES_3170'><pre>3170</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_EQ || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_ULE</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3171' href='#L_COMPARES_3171'><pre>3171</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_UGE, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3172' href='#L_COMPARES_3172'><pre>3172</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3173' href='#L_COMPARES_3173'><pre>3173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) != X --> X u< Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3174' href='#L_COMPARES_3174'><pre>3174</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) u> X --> X u< Y</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3175' href='#L_COMPARES_3175'><pre>3175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == CmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3176' href='#L_COMPARES_3176'><pre>3176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(ICmpInst::ICMP_ULT, X, Y)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3177' href='#L_COMPARES_3177'><pre>3177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3178' href='#L_COMPARES_3178'><pre>3178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These cases should be handled in InstSimplify:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3179' href='#L_COMPARES_3179'><pre>3179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) u>= X --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3180' href='#L_COMPARES_3180'><pre>3180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // umax(X, Y) u< X --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3181' href='#L_COMPARES_3181'><pre>3181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3182' href='#L_COMPARES_3182'><pre>3182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3183' href='#L_COMPARES_3183'><pre>3183</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3184' href='#L_COMPARES_3184'><pre>3184</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3185' href='#L_COMPARES_3185'><pre>3185</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3186' href='#L_COMPARES_3186'><pre>3186</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3187' href='#L_COMPARES_3187'><pre>3187</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpEquality(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3188' href='#L_COMPARES_3188'><pre>3188</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (!I.isEquality())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3189' href='#L_COMPARES_3189'><pre>3189</pre></a></td><td class='covered-line'><pre>337k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3190' href='#L_COMPARES_3190'><pre>3190</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3191' href='#L_COMPARES_3191'><pre>3191</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3192' href='#L_COMPARES_3192'><pre>3192</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> Value *A, *B, *C, *D;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3193' href='#L_COMPARES_3193'><pre>3193</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Xor(m_Value(A), m_Value(B)))<span class='tooltip-content'>971k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>264</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3194' href='#L_COMPARES_3194'><pre>3194</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre> if (<div class='tooltip'>A == Op1 || <span class='tooltip-content'>264</span></div><div class='tooltip'>B == Op1<span class='tooltip-content'>264</span></div>) <div class='tooltip'>{ // (A^B) == A -> B == 0<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3195' href='#L_COMPARES_3195'><pre>3195</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *OtherVal = A == Op1 ? <div class='tooltip'><span class='red'>B</span><span class='tooltip-content'>0</span></div> : <div class='tooltip'>A<span class='tooltip-content'>2</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3196' href='#L_COMPARES_3196'><pre>3196</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), OtherVal,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3197' href='#L_COMPARES_3197'><pre>3197</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Constant::getNullValue(A->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3198' href='#L_COMPARES_3198'><pre>3198</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3199' href='#L_COMPARES_3199'><pre>3199</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3200' href='#L_COMPARES_3200'><pre>3200</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>262</span></div><div class='tooltip'>match(Op1, m_Xor(m_Value(C), m_Value(D)))<span class='tooltip-content'>262</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3201' href='#L_COMPARES_3201'><pre>3201</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // A^c1 == C^c2 --> A == C^(c1^c2)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3202' href='#L_COMPARES_3202'><pre>3202</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt *C1, *C2;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3203' href='#L_COMPARES_3203'><pre>3203</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>match(B, m_ConstantInt(C1)) && <span class='tooltip-content'>1</span></div><div class='tooltip'>match(D, m_ConstantInt(C2))<span class='tooltip-content'>1</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3204' href='#L_COMPARES_3204'><pre>3204</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>Op1->hasOneUse()<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3205' href='#L_COMPARES_3205'><pre>3205</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *NC = Builder->getInt(C1->getValue() ^ C2->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3206' href='#L_COMPARES_3206'><pre>3206</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *Xor = Builder->CreateXor(C, NC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3207' href='#L_COMPARES_3207'><pre>3207</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), A, Xor);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3208' href='#L_COMPARES_3208'><pre>3208</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3209' href='#L_COMPARES_3209'><pre>3209</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3210' href='#L_COMPARES_3210'><pre>3210</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // A^B == A^D -> B == D</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3211' href='#L_COMPARES_3211'><pre>3211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>A == C</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3212' href='#L_COMPARES_3212'><pre>3212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), B, D)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3213' href='#L_COMPARES_3213'><pre>3213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>A == D</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3214' href='#L_COMPARES_3214'><pre>3214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), B, C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3215' href='#L_COMPARES_3215'><pre>3215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == C</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3216' href='#L_COMPARES_3216'><pre>3216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), A, D)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3217' href='#L_COMPARES_3217'><pre>3217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>B == D</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3218' href='#L_COMPARES_3218'><pre>3218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ICmpInst(I.getPredicate(), A, C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3219' href='#L_COMPARES_3219'><pre>3219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3220' href='#L_COMPARES_3220'><pre>3220</pre></a></td><td class='covered-line'><pre>262</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3221' href='#L_COMPARES_3221'><pre>3221</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3222' href='#L_COMPARES_3222'><pre>3222</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>971k</span></div><div class='tooltip'>match(Op1, m_Xor(m_Value(A), m_Value(B))) && <span class='tooltip-content'>971k</span></div><div class='tooltip'>(A == Op0 || <span class='tooltip-content'>225</span></div><div class='tooltip'>B == Op0<span class='tooltip-content'>225</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3223' href='#L_COMPARES_3223'><pre>3223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // A == (A^B) -> B == 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3224' href='#L_COMPARES_3224'><pre>3224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *OtherVal = A == Op0 ? </span><div class='tooltip'><span class='red'>B</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>A</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3225' href='#L_COMPARES_3225'><pre>3225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(I.getPredicate(), OtherVal,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3226' href='#L_COMPARES_3226'><pre>3226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(A->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3227' href='#L_COMPARES_3227'><pre>3227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3228' href='#L_COMPARES_3228'><pre>3228</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3229' href='#L_COMPARES_3229'><pre>3229</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // (X&Z) == (Y&Z) -> (X^Y) & Z == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3230' href='#L_COMPARES_3230'><pre>3230</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>971k</span></div><div class='tooltip'>match(Op0, m_OneUse(m_And(m_Value(A), m_Value(B)))) &&<span class='tooltip-content'>971k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3231' href='#L_COMPARES_3231'><pre>3231</pre></a></td><td class='covered-line'><pre>42.1k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_OneUse(m_And(m_Value(C), m_Value(D))))<span class='tooltip-content'>42.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>25</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3232' href='#L_COMPARES_3232'><pre>3232</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Value *X = nullptr, *Y = nullptr, *Z = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3233' href='#L_COMPARES_3233'><pre>3233</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3234' href='#L_COMPARES_3234'><pre>3234</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> if (<div class='tooltip'>A == C<span class='tooltip-content'>25</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3235' href='#L_COMPARES_3235'><pre>3235</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> X = B;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3236' href='#L_COMPARES_3236'><pre>3236</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Y = D;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3237' href='#L_COMPARES_3237'><pre>3237</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Z = A;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3238' href='#L_COMPARES_3238'><pre>3238</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>24</span></div><div class='tooltip'>A == D<span class='tooltip-content'>24</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3239' href='#L_COMPARES_3239'><pre>3239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> X = B;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3240' href='#L_COMPARES_3240'><pre>3240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = C;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3241' href='#L_COMPARES_3241'><pre>3241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = A;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3242' href='#L_COMPARES_3242'><pre>3242</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>24</span></div><div class='tooltip'>B == C<span class='tooltip-content'>24</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3243' href='#L_COMPARES_3243'><pre>3243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> X = A;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3244' href='#L_COMPARES_3244'><pre>3244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Y = D;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3245' href='#L_COMPARES_3245'><pre>3245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Z = B;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3246' href='#L_COMPARES_3246'><pre>3246</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>24</span></div><div class='tooltip'>B == D<span class='tooltip-content'>24</span></div>) <div class='tooltip'>{<span class='tooltip-content'>24</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3247' href='#L_COMPARES_3247'><pre>3247</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> X = A;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3248' href='#L_COMPARES_3248'><pre>3248</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Y = C;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3249' href='#L_COMPARES_3249'><pre>3249</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> Z = B;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3250' href='#L_COMPARES_3250'><pre>3250</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3251' href='#L_COMPARES_3251'><pre>3251</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3252' href='#L_COMPARES_3252'><pre>3252</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> if (<div class='tooltip'>X<span class='tooltip-content'>25</span></div>) <div class='tooltip'>{ // Build (X^Y) & Z<span class='tooltip-content'>25</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3253' href='#L_COMPARES_3253'><pre>3253</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Op1 = Builder->CreateXor(X, Y);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3254' href='#L_COMPARES_3254'><pre>3254</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> Op1 = Builder->CreateAnd(Op1, Z);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3255' href='#L_COMPARES_3255'><pre>3255</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> I.setOperand(0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3256' href='#L_COMPARES_3256'><pre>3256</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> I.setOperand(1, Constant::getNullValue(Op1->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3257' href='#L_COMPARES_3257'><pre>3257</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3258' href='#L_COMPARES_3258'><pre>3258</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3259' href='#L_COMPARES_3259'><pre>3259</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3260' href='#L_COMPARES_3260'><pre>3260</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3261' href='#L_COMPARES_3261'><pre>3261</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // Transform (zext A) == (B & (1<<X)-1) --> A == (trunc B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3262' href='#L_COMPARES_3262'><pre>3262</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // and (B & (1<<X)-1) == (zext A) --> A == (trunc B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3263' href='#L_COMPARES_3263'><pre>3263</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> ConstantInt *Cst1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3264' href='#L_COMPARES_3264'><pre>3264</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> if (<div class='tooltip'>(Op0->hasOneUse() && <span class='tooltip-content'>971k</span></div><div class='tooltip'>match(Op0, m_ZExt(m_Value(A)))<span class='tooltip-content'>375k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3265' href='#L_COMPARES_3265'><pre>3265</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> match(Op1, m_And(m_Value(B), m_ConstantInt(Cst1)))) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3266' href='#L_COMPARES_3266'><pre>3266</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> <div class='tooltip'>(Op1->hasOneUse() && <span class='tooltip-content'>971k</span></div><div class='tooltip'>match(Op0, m_And(m_Value(B), m_ConstantInt(Cst1)))<span class='tooltip-content'>90.8k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3267' href='#L_COMPARES_3267'><pre>3267</pre></a></td><td class='covered-line'><pre>1.33k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_ZExt(m_Value(A)))<span class='tooltip-content'>1.33k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3268' href='#L_COMPARES_3268'><pre>3268</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> APInt Pow2 = Cst1->getValue() + 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3269' href='#L_COMPARES_3269'><pre>3269</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (<div class='tooltip'>Pow2.isPowerOf2() && <span class='tooltip-content'>8</span></div><div class='tooltip'>isa<IntegerType>(A->getType())<span class='tooltip-content'>2</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3270' href='#L_COMPARES_3270'><pre>3270</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Pow2.logBase2() == cast<IntegerType>(A->getType())->getBitWidth())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3271' href='#L_COMPARES_3271'><pre>3271</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), A,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3272' href='#L_COMPARES_3272'><pre>3272</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Builder->CreateTrunc(B, A->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3273' href='#L_COMPARES_3273'><pre>3273</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3274' href='#L_COMPARES_3274'><pre>3274</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3275' href='#L_COMPARES_3275'><pre>3275</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // (A >> C) == (B >> C) --> (A^B) u< (1 << C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3276' href='#L_COMPARES_3276'><pre>3276</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // For lshr and ashr pairs.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3277' href='#L_COMPARES_3277'><pre>3277</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>971k</span></div><div class='tooltip'>(match(Op0, m_OneUse(m_LShr(m_Value(A), m_ConstantInt(Cst1)))) &&<span class='tooltip-content'>971k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3278' href='#L_COMPARES_3278'><pre>3278</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> match(Op1, m_OneUse(m_LShr(m_Value(B), m_Specific(Cst1))))) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3279' href='#L_COMPARES_3279'><pre>3279</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> (match(Op0, m_OneUse(m_AShr(m_Value(A), m_ConstantInt(Cst1)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3280' href='#L_COMPARES_3280'><pre>3280</pre></a></td><td class='covered-line'><pre>114</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_OneUse(m_AShr(m_Value(B), m_Specific(Cst1))))<span class='tooltip-content'>114</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3281' href='#L_COMPARES_3281'><pre>3281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned TypeBits = Cst1->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3282' href='#L_COMPARES_3282'><pre>3282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ShAmt = (unsigned)Cst1->getLimitedValue(TypeBits);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3283' href='#L_COMPARES_3283'><pre>3283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ShAmt < TypeBits && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ShAmt != 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3284' href='#L_COMPARES_3284'><pre>3284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ICmpInst::Predicate Pred = I.getPredicate() == ICmpInst::ICMP_NE</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3285' href='#L_COMPARES_3285'><pre>3285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>ICmpInst::ICMP_UGE</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3286' href='#L_COMPARES_3286'><pre>3286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>ICmpInst::ICMP_ULT</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3287' href='#L_COMPARES_3287'><pre>3287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Xor = Builder->CreateXor(A, B, I.getName() + ".unshifted");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3288' href='#L_COMPARES_3288'><pre>3288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt CmpVal = APInt::getOneBitSet(TypeBits, ShAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3289' href='#L_COMPARES_3289'><pre>3289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(Pred, Xor, Builder->getInt(CmpVal));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3290' href='#L_COMPARES_3290'><pre>3290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3291' href='#L_COMPARES_3291'><pre>3291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3292' href='#L_COMPARES_3292'><pre>3292</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3293' href='#L_COMPARES_3293'><pre>3293</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3294' href='#L_COMPARES_3294'><pre>3294</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>971k</span></div><div class='tooltip'>match(Op0, m_OneUse(m_Shl(m_Value(A), m_ConstantInt(Cst1)))) &&<span class='tooltip-content'>971k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3295' href='#L_COMPARES_3295'><pre>3295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(Op1, m_OneUse(m_Shl(m_Value(B), m_Specific(Cst1))))</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3296' href='#L_COMPARES_3296'><pre>3296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned TypeBits = Cst1->getBitWidth();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3297' href='#L_COMPARES_3297'><pre>3297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ShAmt = (unsigned)Cst1->getLimitedValue(TypeBits);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3298' href='#L_COMPARES_3298'><pre>3298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ShAmt < TypeBits && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ShAmt != 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3299' href='#L_COMPARES_3299'><pre>3299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Xor = Builder->CreateXor(A, B, I.getName() + ".unshifted");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3300' href='#L_COMPARES_3300'><pre>3300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt AndVal = APInt::getLowBitsSet(TypeBits, TypeBits - ShAmt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3301' href='#L_COMPARES_3301'><pre>3301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *And = Builder->CreateAnd(Xor, Builder->getInt(AndVal),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3302' href='#L_COMPARES_3302'><pre>3302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.getName() + ".mask");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3303' href='#L_COMPARES_3303'><pre>3303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(I.getPredicate(), And,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3304' href='#L_COMPARES_3304'><pre>3304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(Cst1->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3305' href='#L_COMPARES_3305'><pre>3305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3306' href='#L_COMPARES_3306'><pre>3306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3307' href='#L_COMPARES_3307'><pre>3307</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3308' href='#L_COMPARES_3308'><pre>3308</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // Transform "icmp eq (trunc (lshr(X, cst1)), cst" to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3309' href='#L_COMPARES_3309'><pre>3309</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // "icmp (and X, mask), cst"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3310' href='#L_COMPARES_3310'><pre>3310</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> uint64_t ShAmt = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3311' href='#L_COMPARES_3311'><pre>3311</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> if (Op0->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3312' href='#L_COMPARES_3312'><pre>3312</pre></a></td><td class='covered-line'><pre>375k</pre></td><td class='code'><pre> match(Op0, m_Trunc(m_OneUse(m_LShr(m_Value(A), m_ConstantInt(ShAmt))))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3313' href='#L_COMPARES_3313'><pre>3313</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> match(Op1, m_ConstantInt(Cst1)) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3314' href='#L_COMPARES_3314'><pre>3314</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // Only do this when A has multiple uses. This is most important to do</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3315' href='#L_COMPARES_3315'><pre>3315</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> // when it exposes other optimizations.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3316' href='#L_COMPARES_3316'><pre>3316</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>!A->hasOneUse()<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3317' href='#L_COMPARES_3317'><pre>3317</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned ASize = cast<IntegerType>(A->getType())->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3318' href='#L_COMPARES_3318'><pre>3318</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3319' href='#L_COMPARES_3319'><pre>3319</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>ShAmt < ASize<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3320' href='#L_COMPARES_3320'><pre>3320</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt MaskV =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3321' href='#L_COMPARES_3321'><pre>3321</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt::getLowBitsSet(ASize, Op0->getType()->getPrimitiveSizeInBits());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3322' href='#L_COMPARES_3322'><pre>3322</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> MaskV <<= ShAmt;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3323' href='#L_COMPARES_3323'><pre>3323</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3324' href='#L_COMPARES_3324'><pre>3324</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt CmpV = Cst1->getValue().zext(ASize);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3325' href='#L_COMPARES_3325'><pre>3325</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> CmpV <<= ShAmt;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3326' href='#L_COMPARES_3326'><pre>3326</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3327' href='#L_COMPARES_3327'><pre>3327</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *Mask = Builder->CreateAnd(A, Builder->getInt(MaskV));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3328' href='#L_COMPARES_3328'><pre>3328</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), Mask, Builder->getInt(CmpV));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3329' href='#L_COMPARES_3329'><pre>3329</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3330' href='#L_COMPARES_3330'><pre>3330</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3331' href='#L_COMPARES_3331'><pre>3331</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3332' href='#L_COMPARES_3332'><pre>3332</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3333' href='#L_COMPARES_3333'><pre>3333</pre></a></td><td class='covered-line'><pre>971k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3334' href='#L_COMPARES_3334'><pre>3334</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3335' href='#L_COMPARES_3335'><pre>3335</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Handle icmp (cast x to y), (cast/cst). We only handle extending casts so</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3336' href='#L_COMPARES_3336'><pre>3336</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// far.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3337' href='#L_COMPARES_3337'><pre>3337</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpWithCastAndCast(ICmpInst &ICmp) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3338' href='#L_COMPARES_3338'><pre>3338</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> const CastInst *LHSCI = cast<CastInst>(ICmp.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3339' href='#L_COMPARES_3339'><pre>3339</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> Value *LHSCIOp = LHSCI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3340' href='#L_COMPARES_3340'><pre>3340</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> Type *SrcTy = LHSCIOp->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3341' href='#L_COMPARES_3341'><pre>3341</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> Type *DestTy = LHSCI->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3342' href='#L_COMPARES_3342'><pre>3342</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> Value *RHSCIOp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3343' href='#L_COMPARES_3343'><pre>3343</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3344' href='#L_COMPARES_3344'><pre>3344</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // Turn icmp (ptrtoint x), (ptrtoint/c) into a compare of the input if the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3345' href='#L_COMPARES_3345'><pre>3345</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // integer type is the same size as the pointer type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3346' href='#L_COMPARES_3346'><pre>3346</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> if (LHSCI->getOpcode() == Instruction::PtrToInt &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3347' href='#L_COMPARES_3347'><pre>3347</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> <div class='tooltip'>DL.getPointerTypeSizeInBits(SrcTy) == DestTy->getIntegerBitWidth()<span class='tooltip-content'>70</span></div>) <div class='tooltip'>{<span class='tooltip-content'>70</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3348' href='#L_COMPARES_3348'><pre>3348</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Value *RHSOp = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3349' href='#L_COMPARES_3349'><pre>3349</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>RHSC<span class='tooltip-content'>70</span></div> = dyn_cast<PtrToIntOperator>(ICmp.getOperand(1))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3350' href='#L_COMPARES_3350'><pre>3350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *RHSCIOp = RHSC->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3351' href='#L_COMPARES_3351'><pre>3351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHSCIOp->getType()->getPointerAddressSpace() ==</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3352' href='#L_COMPARES_3352'><pre>3352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LHSCIOp->getType()->getPointerAddressSpace()</span><span class='red'>) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3353' href='#L_COMPARES_3353'><pre>3353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHSOp = RHSC->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3354' href='#L_COMPARES_3354'><pre>3354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the pointer types don't match, insert a bitcast.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3355' href='#L_COMPARES_3355'><pre>3355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>LHSCIOp->getType() != RHSOp->getType()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3356' href='#L_COMPARES_3356'><pre>3356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>RHSOp = Builder->CreateBitCast(RHSOp, LHSCIOp->getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3357' href='#L_COMPARES_3357'><pre>3357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3358' href='#L_COMPARES_3358'><pre>3358</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (auto *<span class='tooltip-content'>70</span></div><div class='tooltip'>RHSC<span class='tooltip-content'>70</span></div> = dyn_cast<Constant>(ICmp.getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>70</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3359' href='#L_COMPARES_3359'><pre>3359</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> RHSOp = ConstantExpr::getIntToPtr(RHSC, SrcTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3360' href='#L_COMPARES_3360'><pre>3360</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3361' href='#L_COMPARES_3361'><pre>3361</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3362' href='#L_COMPARES_3362'><pre>3362</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (RHSOp)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3363' href='#L_COMPARES_3363'><pre>3363</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getPredicate(), LHSCIOp, RHSOp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3364' href='#L_COMPARES_3364'><pre>3364</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3365' href='#L_COMPARES_3365'><pre>3365</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3366' href='#L_COMPARES_3366'><pre>3366</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // The code below only handles extension cast instructions, so far.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3367' href='#L_COMPARES_3367'><pre>3367</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> // Enforce this.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3368' href='#L_COMPARES_3368'><pre>3368</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>27.2k</span></div><div class='tooltip'>LHSCI->getOpcode() != Instruction::ZExt &&<span class='tooltip-content'>27.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3369' href='#L_COMPARES_3369'><pre>3369</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> LHSCI->getOpcode() != Instruction::SExt)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3370' href='#L_COMPARES_3370'><pre>3370</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3371' href='#L_COMPARES_3371'><pre>3371</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3372' href='#L_COMPARES_3372'><pre>3372</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> bool isSignedExt = LHSCI->getOpcode() == Instruction::SExt;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3373' href='#L_COMPARES_3373'><pre>3373</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> bool isSignedCmp = ICmp.isSigned();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3374' href='#L_COMPARES_3374'><pre>3374</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3375' href='#L_COMPARES_3375'><pre>3375</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>CI<span class='tooltip-content'>12.1k</span></div> = dyn_cast<CastInst>(ICmp.getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>1.13k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3376' href='#L_COMPARES_3376'><pre>3376</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre> // Not an extension from the same type?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3377' href='#L_COMPARES_3377'><pre>3377</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre> RHSCIOp = CI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3378' href='#L_COMPARES_3378'><pre>3378</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre> if (RHSCIOp->getType() != LHSCIOp->getType())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3379' href='#L_COMPARES_3379'><pre>3379</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3380' href='#L_COMPARES_3380'><pre>3380</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3381' href='#L_COMPARES_3381'><pre>3381</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre> // If the signedness of the two casts doesn't agree (i.e. one is a sext</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3382' href='#L_COMPARES_3382'><pre>3382</pre></a></td><td class='covered-line'><pre>1.13k</pre></td><td class='code'><pre> // and the other is a zext), then we can't handle this.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3383' href='#L_COMPARES_3383'><pre>3383</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>823</span></div><div class='tooltip'>CI->getOpcode() != LHSCI->getOpcode()<span class='tooltip-content'>823</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3384' href='#L_COMPARES_3384'><pre>3384</pre></a></td><td class='covered-line'><pre>346</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3385' href='#L_COMPARES_3385'><pre>3385</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3386' href='#L_COMPARES_3386'><pre>3386</pre></a></td><td class='covered-line'><pre>823</pre></td><td class='code'><pre> // Deal with equality cases early.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3387' href='#L_COMPARES_3387'><pre>3387</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>477</span></div><div class='tooltip'>ICmp.isEquality()<span class='tooltip-content'>477</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3388' href='#L_COMPARES_3388'><pre>3388</pre></a></td><td class='covered-line'><pre>337</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getPredicate(), LHSCIOp, RHSCIOp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3389' href='#L_COMPARES_3389'><pre>3389</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3390' href='#L_COMPARES_3390'><pre>3390</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> // A signed comparison of sign extended values simplifies into a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3391' href='#L_COMPARES_3391'><pre>3391</pre></a></td><td class='covered-line'><pre>477</pre></td><td class='code'><pre> // signed comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3392' href='#L_COMPARES_3392'><pre>3392</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>140</span></div><div class='tooltip'>isSignedCmp && <span class='tooltip-content'>140</span></div><div class='tooltip'>isSignedExt<span class='tooltip-content'>12</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3393' href='#L_COMPARES_3393'><pre>3393</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getPredicate(), LHSCIOp, RHSCIOp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3394' href='#L_COMPARES_3394'><pre>3394</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3395' href='#L_COMPARES_3395'><pre>3395</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> // The other three cases all fold into an unsigned comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3396' href='#L_COMPARES_3396'><pre>3396</pre></a></td><td class='covered-line'><pre>128</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getUnsignedPredicate(), LHSCIOp, RHSCIOp);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3397' href='#L_COMPARES_3397'><pre>3397</pre></a></td><td class='covered-line'><pre>140</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3398' href='#L_COMPARES_3398'><pre>3398</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3399' href='#L_COMPARES_3399'><pre>3399</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> // If we aren't dealing with a constant on the RHS, exit early.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3400' href='#L_COMPARES_3400'><pre>3400</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> auto *C = dyn_cast<Constant>(ICmp.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3401' href='#L_COMPARES_3401'><pre>3401</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> if (!C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3402' href='#L_COMPARES_3402'><pre>3402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3403' href='#L_COMPARES_3403'><pre>3403</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3404' href='#L_COMPARES_3404'><pre>3404</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // Compute the constant that would happen if we truncated to SrcTy then</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3405' href='#L_COMPARES_3405'><pre>3405</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // re-extended to DestTy.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3406' href='#L_COMPARES_3406'><pre>3406</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> Constant *Res1 = ConstantExpr::getTrunc(C, SrcTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3407' href='#L_COMPARES_3407'><pre>3407</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3408' href='#L_COMPARES_3408'><pre>3408</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3409' href='#L_COMPARES_3409'><pre>3409</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // If the re-extended constant didn't change...</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3410' href='#L_COMPARES_3410'><pre>3410</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>Res2 == C<span class='tooltip-content'>11.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3411' href='#L_COMPARES_3411'><pre>3411</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> // Deal with equality cases early.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3412' href='#L_COMPARES_3412'><pre>3412</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> if (ICmp.isEquality())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3413' href='#L_COMPARES_3413'><pre>3413</pre></a></td><td class='covered-line'><pre>9.85k</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getPredicate(), LHSCIOp, Res1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3414' href='#L_COMPARES_3414'><pre>3414</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3415' href='#L_COMPARES_3415'><pre>3415</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> // A signed comparison of sign extended values simplifies into a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3416' href='#L_COMPARES_3416'><pre>3416</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> // signed comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3417' href='#L_COMPARES_3417'><pre>3417</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.10k</span></div><div class='tooltip'>isSignedExt && <span class='tooltip-content'>1.10k</span></div><div class='tooltip'>isSignedCmp<span class='tooltip-content'>468</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3418' href='#L_COMPARES_3418'><pre>3418</pre></a></td><td class='covered-line'><pre>414</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getPredicate(), LHSCIOp, Res1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3419' href='#L_COMPARES_3419'><pre>3419</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3420' href='#L_COMPARES_3420'><pre>3420</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> // The other three cases all fold into an unsigned comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3421' href='#L_COMPARES_3421'><pre>3421</pre></a></td><td class='covered-line'><pre>695</pre></td><td class='code'><pre> return new ICmpInst(ICmp.getUnsignedPredicate(), LHSCIOp, Res1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3422' href='#L_COMPARES_3422'><pre>3422</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3423' href='#L_COMPARES_3423'><pre>3423</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3424' href='#L_COMPARES_3424'><pre>3424</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // The re-extended constant changed, partly changed (in the case of a vector),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3425' href='#L_COMPARES_3425'><pre>3425</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // or could not be determined to be equal (in the case of a constant</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3426' href='#L_COMPARES_3426'><pre>3426</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // expression), so the constant cannot be represented in the shorter type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3427' href='#L_COMPARES_3427'><pre>3427</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // Consequently, we cannot emit a simple comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3428' href='#L_COMPARES_3428'><pre>3428</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // All the cases that fold to true or false will have already been handled</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3429' href='#L_COMPARES_3429'><pre>3429</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> // by SimplifyICmpInst, so only deal with the tricky case.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3430' href='#L_COMPARES_3430'><pre>3430</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3431' href='#L_COMPARES_3431'><pre>3431</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>60</span></div><div class='tooltip'>isSignedCmp || <span class='tooltip-content'>60</span></div><div class='tooltip'>!isSignedExt<span class='tooltip-content'>60</span></div> || <div class='tooltip'>!isa<ConstantInt>(C)<span class='tooltip-content'>60</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3432' href='#L_COMPARES_3432'><pre>3432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3433' href='#L_COMPARES_3433'><pre>3433</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3434' href='#L_COMPARES_3434'><pre>3434</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> // Evaluate the comparison for LT (we invert for GT below). LE and GE cases</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3435' href='#L_COMPARES_3435'><pre>3435</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> // should have been folded away previously and not enter in here.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3436' href='#L_COMPARES_3436'><pre>3436</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3437' href='#L_COMPARES_3437'><pre>3437</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> // We're performing an unsigned comp with a sign extended value.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3438' href='#L_COMPARES_3438'><pre>3438</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> // This is true if the input is >= 0. [aka >s -1]</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3439' href='#L_COMPARES_3439'><pre>3439</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> Constant *NegOne = Constant::getAllOnesValue(SrcTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3440' href='#L_COMPARES_3440'><pre>3440</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> Value *Result = Builder->CreateICmpSGT(LHSCIOp, NegOne, ICmp.getName());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3441' href='#L_COMPARES_3441'><pre>3441</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3442' href='#L_COMPARES_3442'><pre>3442</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> // Finally, return the value computed.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3443' href='#L_COMPARES_3443'><pre>3443</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> if (ICmp.getPredicate() == ICmpInst::ICMP_ULT)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3444' href='#L_COMPARES_3444'><pre>3444</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> return replaceInstUsesWith(ICmp, Result);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3445' href='#L_COMPARES_3445'><pre>3445</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3446' href='#L_COMPARES_3446'><pre>3446</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> assert(ICmp.getPredicate() == ICmpInst::ICMP_UGT && "ICmp should be folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3447' href='#L_COMPARES_3447'><pre>3447</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return BinaryOperator::CreateNot(Result);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3448' href='#L_COMPARES_3448'><pre>3448</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3449' href='#L_COMPARES_3449'><pre>3449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3450' href='#L_COMPARES_3450'><pre>3450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::OptimizeOverflowCheck(OverflowCheckFlavor OCF, Value *LHS,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3451' href='#L_COMPARES_3451'><pre>3451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *RHS, Instruction &OrigI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3452' href='#L_COMPARES_3452'><pre>3452</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> Value *&Result, Constant *&Overflow) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3453' href='#L_COMPARES_3453'><pre>3453</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> if (<div class='tooltip'>OrigI.isCommutative() && <span class='tooltip-content'>1.05k</span></div><div class='tooltip'>isa<Constant>(LHS)<span class='tooltip-content'>139</span></div> && <div class='tooltip'><span class='red'>!isa<Constant>(RHS)</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3454' href='#L_COMPARES_3454'><pre>3454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>std::swap(LHS, RHS)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3455' href='#L_COMPARES_3455'><pre>3455</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3456' href='#L_COMPARES_3456'><pre>3456</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> auto SetResult = [&](Value *OpResult, Constant *OverflowVal, bool ReuseName) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3457' href='#L_COMPARES_3457'><pre>3457</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Result = OpResult;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3458' href='#L_COMPARES_3458'><pre>3458</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Overflow = OverflowVal;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3459' href='#L_COMPARES_3459'><pre>3459</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (ReuseName)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3460' href='#L_COMPARES_3460'><pre>3460</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Result->takeName(&OrigI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3461' href='#L_COMPARES_3461'><pre>3461</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3462' href='#L_COMPARES_3462'><pre>3462</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3463' href='#L_COMPARES_3463'><pre>3463</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3464' href='#L_COMPARES_3464'><pre>3464</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // If the overflow check was an add followed by a compare, the insertion point</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3465' href='#L_COMPARES_3465'><pre>3465</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // may be pointing to the compare. We want to insert the new instructions</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3466' href='#L_COMPARES_3466'><pre>3466</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // before the add in case there are uses of the add between the add and the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3467' href='#L_COMPARES_3467'><pre>3467</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> // compare.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3468' href='#L_COMPARES_3468'><pre>3468</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> Builder->SetInsertPoint(&OrigI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3469' href='#L_COMPARES_3469'><pre>3469</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3470' href='#L_COMPARES_3470'><pre>3470</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> switch (OCF) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3471' href='#L_COMPARES_3471'><pre>3471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case OCF_INVALID:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3472' href='#L_COMPARES_3472'><pre>3472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("bad overflow check kind!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3473' href='#L_COMPARES_3473'><pre>3473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3474' href='#L_COMPARES_3474'><pre>3474</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre><span class='red'> </span>case OCF_UNSIGNED_ADD: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3475' href='#L_COMPARES_3475'><pre>3475</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> OverflowResult OR = computeOverflowForUnsignedAdd(LHS, RHS, &OrigI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3476' href='#L_COMPARES_3476'><pre>3476</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> if (OR == OverflowResult::NeverOverflows)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3477' href='#L_COMPARES_3477'><pre>3477</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return SetResult(Builder->CreateNUWAdd(LHS, RHS), Builder->getFalse(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3478' href='#L_COMPARES_3478'><pre>3478</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> true);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3479' href='#L_COMPARES_3479'><pre>3479</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3480' href='#L_COMPARES_3480'><pre>3480</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>177</span></div><div class='tooltip'>OR == OverflowResult::AlwaysOverflows<span class='tooltip-content'>177</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3481' href='#L_COMPARES_3481'><pre>3481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(Builder->CreateAdd(LHS, RHS), Builder->getTrue(), true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3482' href='#L_COMPARES_3482'><pre>3482</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3483' href='#L_COMPARES_3483'><pre>3483</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // Fall through uadd into sadd</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3484' href='#L_COMPARES_3484'><pre>3484</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>177</span></div><div class='tooltip'>;<span class='tooltip-content'>177</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3485' href='#L_COMPARES_3485'><pre>3485</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3486' href='#L_COMPARES_3486'><pre>3486</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> case OCF_SIGNED_ADD: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3487' href='#L_COMPARES_3487'><pre>3487</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // X + 0 -> {X, false}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3488' href='#L_COMPARES_3488'><pre>3488</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> if (match(RHS, m_Zero()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3489' href='#L_COMPARES_3489'><pre>3489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(LHS, Builder->getFalse(), false)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3490' href='#L_COMPARES_3490'><pre>3490</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3491' href='#L_COMPARES_3491'><pre>3491</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // We can strength reduce this signed add into a regular add if we can prove</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3492' href='#L_COMPARES_3492'><pre>3492</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> // that it will never overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3493' href='#L_COMPARES_3493'><pre>3493</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>177</span></div><div class='tooltip'>OCF == OCF_SIGNED_ADD<span class='tooltip-content'>177</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3494' href='#L_COMPARES_3494'><pre>3494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>WillNotOverflowSignedAdd(LHS, RHS, OrigI)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3495' href='#L_COMPARES_3495'><pre>3495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return SetResult(Builder->CreateNSWAdd(LHS, RHS), Builder->getFalse(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3496' href='#L_COMPARES_3496'><pre>3496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3497' href='#L_COMPARES_3497'><pre>3497</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3498' href='#L_COMPARES_3498'><pre>3498</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3499' href='#L_COMPARES_3499'><pre>3499</pre></a></td><td class='covered-line'><pre>177</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3500' href='#L_COMPARES_3500'><pre>3500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case OCF_UNSIGNED_SUB:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3501' href='#L_COMPARES_3501'><pre>3501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case OCF_SIGNED_SUB: {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3502' href='#L_COMPARES_3502'><pre>3502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X - 0 -> {X, false}</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3503' href='#L_COMPARES_3503'><pre>3503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(RHS, m_Zero())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3504' href='#L_COMPARES_3504'><pre>3504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return SetResult(LHS, Builder->getFalse(), false)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3505' href='#L_COMPARES_3505'><pre>3505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3506' href='#L_COMPARES_3506'><pre>3506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>OCF == OCF_SIGNED_SUB</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3507' href='#L_COMPARES_3507'><pre>3507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>WillNotOverflowSignedSub(LHS, RHS, OrigI)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3508' href='#L_COMPARES_3508'><pre>3508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return SetResult(Builder->CreateNSWSub(LHS, RHS), Builder->getFalse(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3509' href='#L_COMPARES_3509'><pre>3509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3510' href='#L_COMPARES_3510'><pre>3510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3511' href='#L_COMPARES_3511'><pre>3511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>WillNotOverflowUnsignedSub(LHS, RHS, OrigI)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3512' href='#L_COMPARES_3512'><pre>3512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return SetResult(Builder->CreateNUWSub(LHS, RHS), Builder->getFalse(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3513' href='#L_COMPARES_3513'><pre>3513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3514' href='#L_COMPARES_3514'><pre>3514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3515' href='#L_COMPARES_3515'><pre>3515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3516' href='#L_COMPARES_3516'><pre>3516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3517' href='#L_COMPARES_3517'><pre>3517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3518' href='#L_COMPARES_3518'><pre>3518</pre></a></td><td class='covered-line'><pre>869</pre></td><td class='code'><pre><span class='red'> </span>case OCF_UNSIGNED_MUL: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3519' href='#L_COMPARES_3519'><pre>3519</pre></a></td><td class='covered-line'><pre>869</pre></td><td class='code'><pre> OverflowResult OR = computeOverflowForUnsignedMul(LHS, RHS, &OrigI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3520' href='#L_COMPARES_3520'><pre>3520</pre></a></td><td class='covered-line'><pre>869</pre></td><td class='code'><pre> if (OR == OverflowResult::NeverOverflows)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3521' href='#L_COMPARES_3521'><pre>3521</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return SetResult(Builder->CreateNUWMul(LHS, RHS), Builder->getFalse(),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3522' href='#L_COMPARES_3522'><pre>3522</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> true);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3523' href='#L_COMPARES_3523'><pre>3523</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>860</span></div><div class='tooltip'>OR == OverflowResult::AlwaysOverflows<span class='tooltip-content'>860</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3524' href='#L_COMPARES_3524'><pre>3524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(Builder->CreateMul(LHS, RHS), Builder->getTrue(), true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3525' href='#L_COMPARES_3525'><pre>3525</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>860</span></div><div class='tooltip'>;<span class='tooltip-content'>860</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3526' href='#L_COMPARES_3526'><pre>3526</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3527' href='#L_COMPARES_3527'><pre>3527</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> case OCF_SIGNED_MUL:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3528' href='#L_COMPARES_3528'><pre>3528</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> // X * undef -> undef</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3529' href='#L_COMPARES_3529'><pre>3529</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> if (isa<UndefValue>(RHS))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3530' href='#L_COMPARES_3530'><pre>3530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(RHS, UndefValue::get(Builder->getInt1Ty()), false)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3531' href='#L_COMPARES_3531'><pre>3531</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3532' href='#L_COMPARES_3532'><pre>3532</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> // X * 0 -> {0, false}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3533' href='#L_COMPARES_3533'><pre>3533</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>860</span></div><div class='tooltip'>match(RHS, m_Zero())<span class='tooltip-content'>860</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3534' href='#L_COMPARES_3534'><pre>3534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(RHS, Builder->getFalse(), false)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3535' href='#L_COMPARES_3535'><pre>3535</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3536' href='#L_COMPARES_3536'><pre>3536</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> // X * 1 -> {X, false}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3537' href='#L_COMPARES_3537'><pre>3537</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>860</span></div><div class='tooltip'>match(RHS, m_One())<span class='tooltip-content'>860</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3538' href='#L_COMPARES_3538'><pre>3538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return SetResult(LHS, Builder->getFalse(), false)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3539' href='#L_COMPARES_3539'><pre>3539</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3540' href='#L_COMPARES_3540'><pre>3540</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>860</span></div><div class='tooltip'>OCF == OCF_SIGNED_MUL<span class='tooltip-content'>860</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3541' href='#L_COMPARES_3541'><pre>3541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>WillNotOverflowSignedMul(LHS, RHS, OrigI)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3542' href='#L_COMPARES_3542'><pre>3542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return SetResult(Builder->CreateNSWMul(LHS, RHS), Builder->getFalse(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3543' href='#L_COMPARES_3543'><pre>3543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3544' href='#L_COMPARES_3544'><pre>3544</pre></a></td><td class='covered-line'><pre>860</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3545' href='#L_COMPARES_3545'><pre>3545</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3546' href='#L_COMPARES_3546'><pre>3546</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3547' href='#L_COMPARES_3547'><pre>3547</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3548' href='#L_COMPARES_3548'><pre>3548</pre></a></td><td class='covered-line'><pre>1.05k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3549' href='#L_COMPARES_3549'><pre>3549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3550' href='#L_COMPARES_3550'><pre>3550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Recognize and process idiom involving test for multiplication</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3551' href='#L_COMPARES_3551'><pre>3551</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3552' href='#L_COMPARES_3552'><pre>3552</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3553' href='#L_COMPARES_3553'><pre>3553</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The caller has matched a pattern of the form:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3554' href='#L_COMPARES_3554'><pre>3554</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// I = cmp u (mul(zext A, zext B), V</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3555' href='#L_COMPARES_3555'><pre>3555</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The function checks if this is a test for overflow and if so replaces</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3556' href='#L_COMPARES_3556'><pre>3556</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// multiplication with call to 'mul.with.overflow' intrinsic.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3557' href='#L_COMPARES_3557'><pre>3557</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3558' href='#L_COMPARES_3558'><pre>3558</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param I Compare instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3559' href='#L_COMPARES_3559'><pre>3559</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param MulVal Result of 'mult' instruction. It is one of the arguments of</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3560' href='#L_COMPARES_3560'><pre>3560</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the compare instruction. Must be of integer type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3561' href='#L_COMPARES_3561'><pre>3561</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param OtherVal The other argument of compare instruction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3562' href='#L_COMPARES_3562'><pre>3562</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \returns Instruction which must replace the compare instruction, NULL if no</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3563' href='#L_COMPARES_3563'><pre>3563</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// replacement required.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3564' href='#L_COMPARES_3564'><pre>3564</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *processUMulZExtIdiom(ICmpInst &I, Value *MulVal,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3565' href='#L_COMPARES_3565'><pre>3565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *OtherVal, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3566' href='#L_COMPARES_3566'><pre>3566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't bother doing this transformation for pointers, don't do it for</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3567' href='#L_COMPARES_3567'><pre>3567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // vectors.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3568' href='#L_COMPARES_3568'><pre>3568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!isa<IntegerType>(MulVal->getType())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3569' href='#L_COMPARES_3569'><pre>3569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3570' href='#L_COMPARES_3570'><pre>3570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3571' href='#L_COMPARES_3571'><pre>3571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>(I.getOperand(0) == MulVal || I.getOperand(1) == MulVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3572' href='#L_COMPARES_3572'><pre>3572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(I.getOperand(0) == OtherVal || I.getOperand(1) == OtherVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3573' href='#L_COMPARES_3573'><pre>3573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *MulInstr = dyn_cast<Instruction>(MulVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3574' href='#L_COMPARES_3574'><pre>3574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!MulInstr</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3575' href='#L_COMPARES_3575'><pre>3575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3576' href='#L_COMPARES_3576'><pre>3576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>(MulInstr->getOpcode() == Instruction::Mul);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3577' href='#L_COMPARES_3577'><pre>3577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3578' href='#L_COMPARES_3578'><pre>3578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *LHS = cast<ZExtOperator>(MulInstr->getOperand(0)),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3579' href='#L_COMPARES_3579'><pre>3579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *RHS = cast<ZExtOperator>(MulInstr->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3580' href='#L_COMPARES_3580'><pre>3580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(LHS->getOpcode() == Instruction::ZExt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3581' href='#L_COMPARES_3581'><pre>3581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(RHS->getOpcode() == Instruction::ZExt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3582' href='#L_COMPARES_3582'><pre>3582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *A = LHS->getOperand(0), *B = RHS->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3583' href='#L_COMPARES_3583'><pre>3583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3584' href='#L_COMPARES_3584'><pre>3584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Calculate type and width of the result produced by mul.with.overflow.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3585' href='#L_COMPARES_3585'><pre>3585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *TyA = A->getType(), *TyB = B->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3586' href='#L_COMPARES_3586'><pre>3586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned WidthA = TyA->getPrimitiveSizeInBits(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3587' href='#L_COMPARES_3587'><pre>3587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> WidthB = TyB->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3588' href='#L_COMPARES_3588'><pre>3588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned MulWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3589' href='#L_COMPARES_3589'><pre>3589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *MulType;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3590' href='#L_COMPARES_3590'><pre>3590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>WidthB > WidthA</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3591' href='#L_COMPARES_3591'><pre>3591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MulWidth = WidthB;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3592' href='#L_COMPARES_3592'><pre>3592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MulType = TyB;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3593' href='#L_COMPARES_3593'><pre>3593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3594' href='#L_COMPARES_3594'><pre>3594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MulWidth = WidthA;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3595' href='#L_COMPARES_3595'><pre>3595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MulType = TyA;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3596' href='#L_COMPARES_3596'><pre>3596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3597' href='#L_COMPARES_3597'><pre>3597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3598' href='#L_COMPARES_3598'><pre>3598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // In order to replace the original mul with a narrower mul.with.overflow,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3599' href='#L_COMPARES_3599'><pre>3599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // all uses must ignore upper bits of the product. The number of used low</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3600' href='#L_COMPARES_3600'><pre>3600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bits must be not greater than the width of mul.with.overflow.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3601' href='#L_COMPARES_3601'><pre>3601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MulVal->hasNUsesOrMore(2)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3602' href='#L_COMPARES_3602'><pre>3602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>for (User *U : MulVal->users()) </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3603' href='#L_COMPARES_3603'><pre>3603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>U == &I</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3604' href='#L_COMPARES_3604'><pre>3604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3605' href='#L_COMPARES_3605'><pre>3605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (TruncInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>TI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<TruncInst>(U)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3606' href='#L_COMPARES_3606'><pre>3606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check if truncation ignores bits above MulWidth.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3607' href='#L_COMPARES_3607'><pre>3607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned TruncWidth = TI->getType()->getPrimitiveSizeInBits();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3608' href='#L_COMPARES_3608'><pre>3608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>TruncWidth > MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3609' href='#L_COMPARES_3609'><pre>3609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3610' href='#L_COMPARES_3610'><pre>3610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (BinaryOperator *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>BO</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<BinaryOperator>(U)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3611' href='#L_COMPARES_3611'><pre>3611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check if AND ignores bits above MulWidth.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3612' href='#L_COMPARES_3612'><pre>3612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>BO->getOpcode() != Instruction::And</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3613' href='#L_COMPARES_3613'><pre>3613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3614' href='#L_COMPARES_3614'><pre>3614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantInt *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(BO->getOperand(1))) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3615' href='#L_COMPARES_3615'><pre>3615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt &CVal = CI->getValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3616' href='#L_COMPARES_3616'><pre>3616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>CVal.getBitWidth() - CVal.countLeadingZeros() > MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3617' href='#L_COMPARES_3617'><pre>3617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3618' href='#L_COMPARES_3618'><pre>3618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3619' href='#L_COMPARES_3619'><pre>3619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3620' href='#L_COMPARES_3620'><pre>3620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Other uses prohibit this transformation.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3621' href='#L_COMPARES_3621'><pre>3621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3622' href='#L_COMPARES_3622'><pre>3622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3623' href='#L_COMPARES_3623'><pre>3623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3624' href='#L_COMPARES_3624'><pre>3624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3625' href='#L_COMPARES_3625'><pre>3625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize patterns</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3626' href='#L_COMPARES_3626'><pre>3626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>switch (I.getPredicate()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3627' href='#L_COMPARES_3627'><pre>3627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3628' href='#L_COMPARES_3628'><pre>3628</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3629' href='#L_COMPARES_3629'><pre>3629</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3630' href='#L_COMPARES_3630'><pre>3630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3631' href='#L_COMPARES_3631'><pre>3631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp eq/neq mulval, zext trunc mulval</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3632' href='#L_COMPARES_3632'><pre>3632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ZExtInst *</span><span class='red'>Zext</span><span class='red'> = dyn_cast<ZExtInst>(OtherVal))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3633' href='#L_COMPARES_3633'><pre>3633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Zext->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3634' href='#L_COMPARES_3634'><pre>3634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ZextArg = Zext->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3635' href='#L_COMPARES_3635'><pre>3635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (TruncInst *</span><span class='red'>Trunc</span><span class='red'> = dyn_cast<TruncInst>(ZextArg))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3636' href='#L_COMPARES_3636'><pre>3636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Trunc->getType()->getPrimitiveSizeInBits() == MulWidth</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3637' href='#L_COMPARES_3637'><pre>3637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; //Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3638' href='#L_COMPARES_3638'><pre>3638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3639' href='#L_COMPARES_3639'><pre>3639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3640' href='#L_COMPARES_3640'><pre>3640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3641' href='#L_COMPARES_3641'><pre>3641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3642' href='#L_COMPARES_3642'><pre>3642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp eq/neq mulval, and(mulval, mask), mask selects low MulWidth bits.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3643' href='#L_COMPARES_3643'><pre>3643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ConstantInt *CI;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3644' href='#L_COMPARES_3644'><pre>3644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ValToMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3645' href='#L_COMPARES_3645'><pre>3645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>match(OtherVal, m_And(m_Value(ValToMask), m_ConstantInt(CI)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3646' href='#L_COMPARES_3646'><pre>3646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ValToMask != MulVal</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3647' href='#L_COMPARES_3647'><pre>3647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3648' href='#L_COMPARES_3648'><pre>3648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const APInt &CVal = CI->getValue() + 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3649' href='#L_COMPARES_3649'><pre>3649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>CVal.isPowerOf2()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3650' href='#L_COMPARES_3650'><pre>3650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned MaskWidth = CVal.logBase2();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3651' href='#L_COMPARES_3651'><pre>3651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaskWidth == MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3652' href='#L_COMPARES_3652'><pre>3652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3653' href='#L_COMPARES_3653'><pre>3653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3654' href='#L_COMPARES_3654'><pre>3654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3655' href='#L_COMPARES_3655'><pre>3655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3656' href='#L_COMPARES_3656'><pre>3656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3657' href='#L_COMPARES_3657'><pre>3657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3658' href='#L_COMPARES_3658'><pre>3658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3659' href='#L_COMPARES_3659'><pre>3659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3660' href='#L_COMPARES_3660'><pre>3660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp ugt mulval, max</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3661' href='#L_COMPARES_3661'><pre>3661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(OtherVal)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3662' href='#L_COMPARES_3662'><pre>3662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt MaxVal = APInt::getMaxValue(MulWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3663' href='#L_COMPARES_3663'><pre>3663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MaxVal = MaxVal.zext(CI->getBitWidth());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3664' href='#L_COMPARES_3664'><pre>3664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaxVal.eq(CI->getValue())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3665' href='#L_COMPARES_3665'><pre>3665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3666' href='#L_COMPARES_3666'><pre>3666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3667' href='#L_COMPARES_3667'><pre>3667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3668' href='#L_COMPARES_3668'><pre>3668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3669' href='#L_COMPARES_3669'><pre>3669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3670' href='#L_COMPARES_3670'><pre>3670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3671' href='#L_COMPARES_3671'><pre>3671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3672' href='#L_COMPARES_3672'><pre>3672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp uge mulval, max+1</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3673' href='#L_COMPARES_3673'><pre>3673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(OtherVal)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3674' href='#L_COMPARES_3674'><pre>3674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt MaxVal = APInt::getOneBitSet(CI->getBitWidth(), MulWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3675' href='#L_COMPARES_3675'><pre>3675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaxVal.eq(CI->getValue())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3676' href='#L_COMPARES_3676'><pre>3676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3677' href='#L_COMPARES_3677'><pre>3677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3678' href='#L_COMPARES_3678'><pre>3678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3679' href='#L_COMPARES_3679'><pre>3679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3680' href='#L_COMPARES_3680'><pre>3680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3681' href='#L_COMPARES_3681'><pre>3681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3682' href='#L_COMPARES_3682'><pre>3682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3683' href='#L_COMPARES_3683'><pre>3683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp ule mulval, max</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3684' href='#L_COMPARES_3684'><pre>3684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(OtherVal)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3685' href='#L_COMPARES_3685'><pre>3685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt MaxVal = APInt::getMaxValue(MulWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3686' href='#L_COMPARES_3686'><pre>3686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MaxVal = MaxVal.zext(CI->getBitWidth());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3687' href='#L_COMPARES_3687'><pre>3687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaxVal.eq(CI->getValue())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3688' href='#L_COMPARES_3688'><pre>3688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3689' href='#L_COMPARES_3689'><pre>3689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3690' href='#L_COMPARES_3690'><pre>3690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3691' href='#L_COMPARES_3691'><pre>3691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3692' href='#L_COMPARES_3692'><pre>3692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3693' href='#L_COMPARES_3693'><pre>3693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Recognize pattern:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3694' href='#L_COMPARES_3694'><pre>3694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mulval = mul(zext A, zext B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3695' href='#L_COMPARES_3695'><pre>3695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cmp ule mulval, max + 1</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3696' href='#L_COMPARES_3696'><pre>3696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>CI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(OtherVal)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3697' href='#L_COMPARES_3697'><pre>3697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt MaxVal = APInt::getOneBitSet(CI->getBitWidth(), MulWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3698' href='#L_COMPARES_3698'><pre>3698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaxVal.eq(CI->getValue())</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3699' href='#L_COMPARES_3699'><pre>3699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>; // Recognized</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3700' href='#L_COMPARES_3700'><pre>3700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3701' href='#L_COMPARES_3701'><pre>3701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3702' href='#L_COMPARES_3702'><pre>3702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3703' href='#L_COMPARES_3703'><pre>3703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3704' href='#L_COMPARES_3704'><pre>3704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3705' href='#L_COMPARES_3705'><pre>3705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3706' href='#L_COMPARES_3706'><pre>3706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3707' href='#L_COMPARES_3707'><pre>3707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InstCombiner::BuilderTy *Builder = IC.Builder;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3708' href='#L_COMPARES_3708'><pre>3708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->SetInsertPoint(MulInstr);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3709' href='#L_COMPARES_3709'><pre>3709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3710' href='#L_COMPARES_3710'><pre>3710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace: mul(zext A, zext B) --> mul.with.overflow(A, B)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3711' href='#L_COMPARES_3711'><pre>3711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *MulA = A, *MulB = B;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3712' href='#L_COMPARES_3712'><pre>3712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>WidthA < MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3713' href='#L_COMPARES_3713'><pre>3713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>MulA = Builder->CreateZExt(A, MulType)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3714' href='#L_COMPARES_3714'><pre>3714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>WidthB < MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3715' href='#L_COMPARES_3715'><pre>3715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>MulB = Builder->CreateZExt(B, MulType)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3716' href='#L_COMPARES_3716'><pre>3716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *F = Intrinsic::getDeclaration(I.getModule(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3717' href='#L_COMPARES_3717'><pre>3717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Intrinsic::umul_with_overflow, MulType);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3718' href='#L_COMPARES_3718'><pre>3718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *Call = Builder->CreateCall(F, {MulA, MulB}, "umul");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3719' href='#L_COMPARES_3719'><pre>3719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Worklist.Add(MulInstr);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3720' href='#L_COMPARES_3720'><pre>3720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3721' href='#L_COMPARES_3721'><pre>3721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If there are uses of mul result other than the comparison, we know that</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3722' href='#L_COMPARES_3722'><pre>3722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // they are truncation or binary AND. Change them to use result of</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3723' href='#L_COMPARES_3723'><pre>3723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mul.with.overflow and adjust properly mask/size.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3724' href='#L_COMPARES_3724'><pre>3724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>MulVal->hasNUsesOrMore(2)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3725' href='#L_COMPARES_3725'><pre>3725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Mul = Builder->CreateExtractValue(Call, 0, "umul.value");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3726' href='#L_COMPARES_3726'><pre>3726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (User *U : MulVal->users()) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3727' href='#L_COMPARES_3727'><pre>3727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>U == &I || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>U == OtherVal</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3728' href='#L_COMPARES_3728'><pre>3728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3729' href='#L_COMPARES_3729'><pre>3729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (TruncInst *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>TI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<TruncInst>(U)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3730' href='#L_COMPARES_3730'><pre>3730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>TI->getType()->getPrimitiveSizeInBits() == MulWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3731' href='#L_COMPARES_3731'><pre>3731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IC.replaceInstUsesWith(*TI, Mul)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3732' href='#L_COMPARES_3732'><pre>3732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3733' href='#L_COMPARES_3733'><pre>3733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>TI->setOperand(0, Mul)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3734' href='#L_COMPARES_3734'><pre>3734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (BinaryOperator *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>BO</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<BinaryOperator>(U)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3735' href='#L_COMPARES_3735'><pre>3735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(BO->getOpcode() == Instruction::And);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3736' href='#L_COMPARES_3736'><pre>3736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace (mul & mask) --> zext (mul.with.overflow & short_mask)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3737' href='#L_COMPARES_3737'><pre>3737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *CI = cast<ConstantInt>(BO->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3738' href='#L_COMPARES_3738'><pre>3738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt ShortMask = CI->getValue().trunc(MulWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3739' href='#L_COMPARES_3739'><pre>3739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ShortAnd = Builder->CreateAnd(Mul, ShortMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3740' href='#L_COMPARES_3740'><pre>3740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Zext =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3741' href='#L_COMPARES_3741'><pre>3741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<Instruction>(Builder->CreateZExt(ShortAnd, BO->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3742' href='#L_COMPARES_3742'><pre>3742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Worklist.Add(Zext);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3743' href='#L_COMPARES_3743'><pre>3743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.replaceInstUsesWith(*BO, Zext);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3744' href='#L_COMPARES_3744'><pre>3744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3745' href='#L_COMPARES_3745'><pre>3745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("Unexpected Binary operation");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3746' href='#L_COMPARES_3746'><pre>3746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3747' href='#L_COMPARES_3747'><pre>3747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Worklist.Add(cast<Instruction>(U));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3748' href='#L_COMPARES_3748'><pre>3748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3749' href='#L_COMPARES_3749'><pre>3749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3750' href='#L_COMPARES_3750'><pre>3750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<Instruction>(OtherVal)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3751' href='#L_COMPARES_3751'><pre>3751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IC.Worklist.Add(cast<Instruction>(OtherVal))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3752' href='#L_COMPARES_3752'><pre>3752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3753' href='#L_COMPARES_3753'><pre>3753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The original icmp gets replaced with the overflow value, maybe inverted</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3754' href='#L_COMPARES_3754'><pre>3754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // depending on predicate.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3755' href='#L_COMPARES_3755'><pre>3755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Inverse = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3756' href='#L_COMPARES_3756'><pre>3756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (I.getPredicate()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3757' href='#L_COMPARES_3757'><pre>3757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3758' href='#L_COMPARES_3758'><pre>3758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3759' href='#L_COMPARES_3759'><pre>3759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3760' href='#L_COMPARES_3760'><pre>3760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Inverse = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3761' href='#L_COMPARES_3761'><pre>3761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3762' href='#L_COMPARES_3762'><pre>3762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3763' href='#L_COMPARES_3763'><pre>3763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3764' href='#L_COMPARES_3764'><pre>3764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I.getOperand(0) == MulVal</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3765' href='#L_COMPARES_3765'><pre>3765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3766' href='#L_COMPARES_3766'><pre>3766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Inverse = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3767' href='#L_COMPARES_3767'><pre>3767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3768' href='#L_COMPARES_3768'><pre>3768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3769' href='#L_COMPARES_3769'><pre>3769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3770' href='#L_COMPARES_3770'><pre>3770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I.getOperand(1) == MulVal</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3771' href='#L_COMPARES_3771'><pre>3771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3772' href='#L_COMPARES_3772'><pre>3772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Inverse = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3773' href='#L_COMPARES_3773'><pre>3773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3774' href='#L_COMPARES_3774'><pre>3774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3775' href='#L_COMPARES_3775'><pre>3775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("Unexpected predicate");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3776' href='#L_COMPARES_3776'><pre>3776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3777' href='#L_COMPARES_3777'><pre>3777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Inverse</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3778' href='#L_COMPARES_3778'><pre>3778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Res = Builder->CreateExtractValue(Call, 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3779' href='#L_COMPARES_3779'><pre>3779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateNot(Res);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3780' href='#L_COMPARES_3780'><pre>3780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3781' href='#L_COMPARES_3781'><pre>3781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3782' href='#L_COMPARES_3782'><pre>3782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ExtractValueInst::Create(Call, 1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3783' href='#L_COMPARES_3783'><pre>3783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3784' href='#L_COMPARES_3784'><pre>3784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3785' href='#L_COMPARES_3785'><pre>3785</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// When performing a comparison against a constant, it is possible that not all</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3786' href='#L_COMPARES_3786'><pre>3786</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the bits in the LHS are demanded. This helper method computes the mask that</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3787' href='#L_COMPARES_3787'><pre>3787</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// IS demanded.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3788' href='#L_COMPARES_3788'><pre>3788</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static APInt getDemandedBitsLHSMask(ICmpInst &I, unsigned BitWidth,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3789' href='#L_COMPARES_3789'><pre>3789</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> bool isSignCheck) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3790' href='#L_COMPARES_3790'><pre>3790</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (isSignCheck)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3791' href='#L_COMPARES_3791'><pre>3791</pre></a></td><td class='covered-line'><pre>30.4k</pre></td><td class='code'><pre> return APInt::getSignBit(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3792' href='#L_COMPARES_3792'><pre>3792</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3793' href='#L_COMPARES_3793'><pre>3793</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3794' href='#L_COMPARES_3794'><pre>3794</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> if (<div class='tooltip'>!CI<span class='tooltip-content'>1.32M</span></div>) <div class='tooltip'>return APInt::getAllOnesValue(BitWidth)<span class='tooltip-content'>631k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3795' href='#L_COMPARES_3795'><pre>3795</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> const APInt &RHS = CI->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3796' href='#L_COMPARES_3796'><pre>3796</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3797' href='#L_COMPARES_3797'><pre>3797</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> switch (I.getPredicate()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3798' href='#L_COMPARES_3798'><pre>3798</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> // For a UGT comparison, we don't care about any bits that</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3799' href='#L_COMPARES_3799'><pre>3799</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> // correspond to the trailing ones of the comparand. The value of these</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3800' href='#L_COMPARES_3800'><pre>3800</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> // bits doesn't impact the outcome of the comparison, because any value</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3801' href='#L_COMPARES_3801'><pre>3801</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> // greater than the RHS must differ in a bit higher than these due to carry.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3802' href='#L_COMPARES_3802'><pre>3802</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3803' href='#L_COMPARES_3803'><pre>3803</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> unsigned trailingOnes = RHS.countTrailingOnes();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3804' href='#L_COMPARES_3804'><pre>3804</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> APInt lowBitsSet = APInt::getLowBitsSet(BitWidth, trailingOnes);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3805' href='#L_COMPARES_3805'><pre>3805</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> return ~lowBitsSet;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3806' href='#L_COMPARES_3806'><pre>3806</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3807' href='#L_COMPARES_3807'><pre>3807</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3808' href='#L_COMPARES_3808'><pre>3808</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> // Similarly, for a ULT comparison, we don't care about the trailing zeros.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3809' href='#L_COMPARES_3809'><pre>3809</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> // Any value less than the RHS must differ in a higher bit because of carries.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3810' href='#L_COMPARES_3810'><pre>3810</pre></a></td><td class='covered-line'><pre>31.1k</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3811' href='#L_COMPARES_3811'><pre>3811</pre></a></td><td class='covered-line'><pre>31.1k</pre></td><td class='code'><pre> unsigned trailingZeros = RHS.countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3812' href='#L_COMPARES_3812'><pre>3812</pre></a></td><td class='covered-line'><pre>31.1k</pre></td><td class='code'><pre> APInt lowBitsSet = APInt::getLowBitsSet(BitWidth, trailingZeros);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3813' href='#L_COMPARES_3813'><pre>3813</pre></a></td><td class='covered-line'><pre>31.1k</pre></td><td class='code'><pre> return ~lowBitsSet;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3814' href='#L_COMPARES_3814'><pre>3814</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3815' href='#L_COMPARES_3815'><pre>3815</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3816' href='#L_COMPARES_3816'><pre>3816</pre></a></td><td class='covered-line'><pre>642k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3817' href='#L_COMPARES_3817'><pre>3817</pre></a></td><td class='covered-line'><pre>642k</pre></td><td class='code'><pre> return APInt::getAllOnesValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3818' href='#L_COMPARES_3818'><pre>3818</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3819' href='#L_COMPARES_3819'><pre>3819</pre></a></td><td class='covered-line'><pre>692k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3820' href='#L_COMPARES_3820'><pre>3820</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3821' href='#L_COMPARES_3821'><pre>3821</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Check if the order of \p Op0 and \p Op1 as operand in an ICmpInst</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3822' href='#L_COMPARES_3822'><pre>3822</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// should be swapped.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3823' href='#L_COMPARES_3823'><pre>3823</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The decision is based on how many times these two operands are reused</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3824' href='#L_COMPARES_3824'><pre>3824</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// as subtract operands and their positions in those instructions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3825' href='#L_COMPARES_3825'><pre>3825</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The rational is that several architectures use the same instruction for</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3826' href='#L_COMPARES_3826'><pre>3826</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// both subtract and cmp, thus it is better if the order of those operands</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3827' href='#L_COMPARES_3827'><pre>3827</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// match.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3828' href='#L_COMPARES_3828'><pre>3828</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \return true if Op0 and Op1 should be swapped.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3829' href='#L_COMPARES_3829'><pre>3829</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool swapMayExposeCSEOpportunities(const Value * Op0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3830' href='#L_COMPARES_3830'><pre>3830</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> const Value * Op1) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3831' href='#L_COMPARES_3831'><pre>3831</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // Filter out pointer value as those cannot appears directly in subtract.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3832' href='#L_COMPARES_3832'><pre>3832</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // FIXME: we may want to go through inttoptrs or bitcasts.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3833' href='#L_COMPARES_3833'><pre>3833</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> if (Op0->getType()->isPointerTy())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3834' href='#L_COMPARES_3834'><pre>3834</pre></a></td><td class='covered-line'><pre>75.8k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3835' href='#L_COMPARES_3835'><pre>3835</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // Count every uses of both Op0 and Op1 in a subtract.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3836' href='#L_COMPARES_3836'><pre>3836</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // Each time Op0 is the first operand, count -1: swapping is bad, the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3837' href='#L_COMPARES_3837'><pre>3837</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // subtract has already the same layout as the compare.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3838' href='#L_COMPARES_3838'><pre>3838</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // Each time Op0 is the second operand, count +1: swapping is good, the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3839' href='#L_COMPARES_3839'><pre>3839</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // subtract has a different layout as the compare.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3840' href='#L_COMPARES_3840'><pre>3840</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // At the end, if the benefit is greater than 0, Op0 should come second to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3841' href='#L_COMPARES_3841'><pre>3841</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre> // expose more CSE opportunities.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3842' href='#L_COMPARES_3842'><pre>3842</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> int GlobalSwapBenefits = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3843' href='#L_COMPARES_3843'><pre>3843</pre></a></td><td class='covered-line'><pre>441k</pre></td><td class='code'><pre> for (const User *U : Op0->users()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3844' href='#L_COMPARES_3844'><pre>3844</pre></a></td><td class='covered-line'><pre>441k</pre></td><td class='code'><pre> const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(U);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3845' href='#L_COMPARES_3845'><pre>3845</pre></a></td><td class='covered-line'><pre>441k</pre></td><td class='code'><pre> if (<div class='tooltip'>!BinOp || <span class='tooltip-content'>441k</span></div><div class='tooltip'>BinOp->getOpcode() != Instruction::Sub<span class='tooltip-content'>64.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3846' href='#L_COMPARES_3846'><pre>3846</pre></a></td><td class='covered-line'><pre>429k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3847' href='#L_COMPARES_3847'><pre>3847</pre></a></td><td class='covered-line'><pre>441k</pre></td><td class='code'><pre> // If Op0 is the first argument, this is not beneficial to swap the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3848' href='#L_COMPARES_3848'><pre>3848</pre></a></td><td class='covered-line'><pre>441k</pre></td><td class='code'><pre> // arguments.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3849' href='#L_COMPARES_3849'><pre>3849</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> int LocalSwapBenefits = -1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3850' href='#L_COMPARES_3850'><pre>3850</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> unsigned Op1Idx = 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3851' href='#L_COMPARES_3851'><pre>3851</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>BinOp->getOperand(Op1Idx) == Op0<span class='tooltip-content'>12.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.55k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3852' href='#L_COMPARES_3852'><pre>3852</pre></a></td><td class='covered-line'><pre>4.55k</pre></td><td class='code'><pre> Op1Idx = 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3853' href='#L_COMPARES_3853'><pre>3853</pre></a></td><td class='covered-line'><pre>4.55k</pre></td><td class='code'><pre> LocalSwapBenefits = 1;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3854' href='#L_COMPARES_3854'><pre>3854</pre></a></td><td class='covered-line'><pre>4.55k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3855' href='#L_COMPARES_3855'><pre>3855</pre></a></td><td class='covered-line'><pre>12.5k</pre></td><td class='code'><pre> if (BinOp->getOperand(Op1Idx) != Op1)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3856' href='#L_COMPARES_3856'><pre>3856</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3857' href='#L_COMPARES_3857'><pre>3857</pre></a></td><td class='covered-line'><pre>4.63k</pre></td><td class='code'><pre> GlobalSwapBenefits += LocalSwapBenefits;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3858' href='#L_COMPARES_3858'><pre>3858</pre></a></td><td class='covered-line'><pre>4.63k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3859' href='#L_COMPARES_3859'><pre>3859</pre></a></td><td class='covered-line'><pre>154k</pre></td><td class='code'><pre> return GlobalSwapBenefits > 0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3860' href='#L_COMPARES_3860'><pre>3860</pre></a></td><td class='covered-line'><pre>230k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3861' href='#L_COMPARES_3861'><pre>3861</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3862' href='#L_COMPARES_3862'><pre>3862</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Check that one use is in the same block as the definition and all</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3863' href='#L_COMPARES_3863'><pre>3863</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// other uses are in blocks dominated by a given block.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3864' href='#L_COMPARES_3864'><pre>3864</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3865' href='#L_COMPARES_3865'><pre>3865</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param DI Definition</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3866' href='#L_COMPARES_3866'><pre>3866</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param UI Use</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3867' href='#L_COMPARES_3867'><pre>3867</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param DB Block that must dominate all uses of \p DI outside</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3868' href='#L_COMPARES_3868'><pre>3868</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the parent block</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3869' href='#L_COMPARES_3869'><pre>3869</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \return true when \p UI is the only use of \p DI in the parent block</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3870' href='#L_COMPARES_3870'><pre>3870</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and all other uses of \p DI are in blocks dominated by \p DB.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3871' href='#L_COMPARES_3871'><pre>3871</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3872' href='#L_COMPARES_3872'><pre>3872</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::dominatesAllUses(const Instruction *DI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3873' href='#L_COMPARES_3873'><pre>3873</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const Instruction *UI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3874' href='#L_COMPARES_3874'><pre>3874</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> const BasicBlock *DB) const {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3875' href='#L_COMPARES_3875'><pre>3875</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> assert(DI && UI && "Instruction not defined\n");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3876' href='#L_COMPARES_3876'><pre>3876</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> // Ignore incomplete definitions.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3877' href='#L_COMPARES_3877'><pre>3877</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> if (!DI->getParent())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3878' href='#L_COMPARES_3878'><pre>3878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3879' href='#L_COMPARES_3879'><pre>3879</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> // DI and UI must be in the same block.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3880' href='#L_COMPARES_3880'><pre>3880</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>61</span></div><div class='tooltip'>DI->getParent() != UI->getParent()<span class='tooltip-content'>61</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3881' href='#L_COMPARES_3881'><pre>3881</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3882' href='#L_COMPARES_3882'><pre>3882</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> // Protect from self-referencing blocks.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3883' href='#L_COMPARES_3883'><pre>3883</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>61</span></div><div class='tooltip'>DI->getParent() == DB<span class='tooltip-content'>61</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3884' href='#L_COMPARES_3884'><pre>3884</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3885' href='#L_COMPARES_3885'><pre>3885</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> <div class='tooltip'>for (const User *U : DI->users()) <span class='tooltip-content'>61</span></div><div class='tooltip'>{<span class='tooltip-content'>108</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3886' href='#L_COMPARES_3886'><pre>3886</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> auto *Usr = cast<Instruction>(U);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3887' href='#L_COMPARES_3887'><pre>3887</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> if (<div class='tooltip'>Usr != UI && <span class='tooltip-content'>108</span></div><div class='tooltip'>!DT.dominates(DB, Usr->getParent())<span class='tooltip-content'>79</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3888' href='#L_COMPARES_3888'><pre>3888</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3889' href='#L_COMPARES_3889'><pre>3889</pre></a></td><td class='covered-line'><pre>108</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3890' href='#L_COMPARES_3890'><pre>3890</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3891' href='#L_COMPARES_3891'><pre>3891</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3892' href='#L_COMPARES_3892'><pre>3892</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3893' href='#L_COMPARES_3893'><pre>3893</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true when the instruction sequence within a block is select-cmp-br.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3894' href='#L_COMPARES_3894'><pre>3894</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre>static bool isChainSelectCmpBranch(const SelectInst *SI) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3895' href='#L_COMPARES_3895'><pre>3895</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> const BasicBlock *BB = SI->getParent();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3896' href='#L_COMPARES_3896'><pre>3896</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> if (!BB)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3897' href='#L_COMPARES_3897'><pre>3897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3898' href='#L_COMPARES_3898'><pre>3898</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> auto *BI = dyn_cast_or_null<BranchInst>(BB->getTerminator());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3899' href='#L_COMPARES_3899'><pre>3899</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> if (<div class='tooltip'>!BI || <span class='tooltip-content'>1.17k</span></div><div class='tooltip'>BI->getNumSuccessors() != 2<span class='tooltip-content'>1.02k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3900' href='#L_COMPARES_3900'><pre>3900</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3901' href='#L_COMPARES_3901'><pre>3901</pre></a></td><td class='covered-line'><pre>939</pre></td><td class='code'><pre> auto *IC = dyn_cast<ICmpInst>(BI->getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3902' href='#L_COMPARES_3902'><pre>3902</pre></a></td><td class='covered-line'><pre>939</pre></td><td class='code'><pre> if (<div class='tooltip'>!IC || <span class='tooltip-content'>939</span></div><div class='tooltip'>(IC->getOperand(0) != SI && <span class='tooltip-content'>827</span></div><div class='tooltip'>IC->getOperand(1) != SI<span class='tooltip-content'>507</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3903' href='#L_COMPARES_3903'><pre>3903</pre></a></td><td class='covered-line'><pre>606</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3904' href='#L_COMPARES_3904'><pre>3904</pre></a></td><td class='covered-line'><pre>333</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3905' href='#L_COMPARES_3905'><pre>3905</pre></a></td><td class='covered-line'><pre>939</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3906' href='#L_COMPARES_3906'><pre>3906</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3907' href='#L_COMPARES_3907'><pre>3907</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief True when a select result is replaced by one of its operands</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3908' href='#L_COMPARES_3908'><pre>3908</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// in select-icmp sequence. This will eventually result in the elimination</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3909' href='#L_COMPARES_3909'><pre>3909</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// of the select.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3910' href='#L_COMPARES_3910'><pre>3910</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3911' href='#L_COMPARES_3911'><pre>3911</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param SI Select instruction</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3912' href='#L_COMPARES_3912'><pre>3912</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param Icmp Compare instruction</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3913' href='#L_COMPARES_3913'><pre>3913</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \param SIOpd Operand that replaces the select</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3914' href='#L_COMPARES_3914'><pre>3914</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3915' href='#L_COMPARES_3915'><pre>3915</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Notes:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3916' href='#L_COMPARES_3916'><pre>3916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// - The replacement is global and requires dominator information</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3917' href='#L_COMPARES_3917'><pre>3917</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// - The caller is responsible for the actual replacement</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3918' href='#L_COMPARES_3918'><pre>3918</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3919' href='#L_COMPARES_3919'><pre>3919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Example:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3920' href='#L_COMPARES_3920'><pre>3920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3921' href='#L_COMPARES_3921'><pre>3921</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// entry:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3922' href='#L_COMPARES_3922'><pre>3922</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %4 = select i1 %3, %C* %0, %C* null</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3923' href='#L_COMPARES_3923'><pre>3923</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %5 = icmp eq %C* %4, null</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3924' href='#L_COMPARES_3924'><pre>3924</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// br i1 %5, label %9, label %7</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3925' href='#L_COMPARES_3925'><pre>3925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ...</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3926' href='#L_COMPARES_3926'><pre>3926</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ; <label>:7 ; preds = %entry</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3927' href='#L_COMPARES_3927'><pre>3927</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %8 = getelementptr inbounds %C* %4, i64 0, i32 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3928' href='#L_COMPARES_3928'><pre>3928</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ...</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3929' href='#L_COMPARES_3929'><pre>3929</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3930' href='#L_COMPARES_3930'><pre>3930</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// can be transformed to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3931' href='#L_COMPARES_3931'><pre>3931</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3932' href='#L_COMPARES_3932'><pre>3932</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %5 = icmp eq %C* %0, null</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3933' href='#L_COMPARES_3933'><pre>3933</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %6 = select i1 %3, i1 %5, i1 true</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3934' href='#L_COMPARES_3934'><pre>3934</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// br i1 %6, label %9, label %7</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3935' href='#L_COMPARES_3935'><pre>3935</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ...</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3936' href='#L_COMPARES_3936'><pre>3936</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ; <label>:7 ; preds = %entry</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3937' href='#L_COMPARES_3937'><pre>3937</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %8 = getelementptr inbounds %C* %0, i64 0, i32 0 // replace by %0!</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3938' href='#L_COMPARES_3938'><pre>3938</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3939' href='#L_COMPARES_3939'><pre>3939</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Similar when the first operand of the select is a constant or/and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3940' href='#L_COMPARES_3940'><pre>3940</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the compare is for not equal rather than equal.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3941' href='#L_COMPARES_3941'><pre>3941</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3942' href='#L_COMPARES_3942'><pre>3942</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// NOTE: The function is only called when the select and compare constants</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3943' href='#L_COMPARES_3943'><pre>3943</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// are equal, the optimization can work only for EQ predicates. This is not a</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3944' href='#L_COMPARES_3944'><pre>3944</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// major restriction since a NE compare should be 'normalized' to an equal</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3945' href='#L_COMPARES_3945'><pre>3945</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// compare, which usually happens in the combiner and test case</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3946' href='#L_COMPARES_3946'><pre>3946</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// select-cmp-br.ll checks for it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3947' href='#L_COMPARES_3947'><pre>3947</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::replacedSelectWithOperand(SelectInst *SI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3948' href='#L_COMPARES_3948'><pre>3948</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const ICmpInst *Icmp,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3949' href='#L_COMPARES_3949'><pre>3949</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> const unsigned SIOpd) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3950' href='#L_COMPARES_3950'><pre>3950</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> assert((SIOpd == 1 || SIOpd == 2) && "Invalid select operand!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3951' href='#L_COMPARES_3951'><pre>3951</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> if (<div class='tooltip'>isChainSelectCmpBranch(SI) && <span class='tooltip-content'>1.17k</span></div><div class='tooltip'>Icmp->getPredicate() == ICmpInst::ICMP_EQ<span class='tooltip-content'>333</span></div>) <div class='tooltip'>{<span class='tooltip-content'>70</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3952' href='#L_COMPARES_3952'><pre>3952</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> BasicBlock *Succ = SI->getParent()->getTerminator()->getSuccessor(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3953' href='#L_COMPARES_3953'><pre>3953</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // The check for the single predecessor is not the best that can be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3954' href='#L_COMPARES_3954'><pre>3954</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // done. But it protects efficiently against cases like when SI's</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3955' href='#L_COMPARES_3955'><pre>3955</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // home block has two successors, Succ and Succ1, and Succ1 predecessor</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3956' href='#L_COMPARES_3956'><pre>3956</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // of Succ. Then SI can't be replaced by SIOpd because the use that gets</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3957' href='#L_COMPARES_3957'><pre>3957</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // replaced can be reached on either path. So the uniqueness check</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3958' href='#L_COMPARES_3958'><pre>3958</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // guarantees that the path all uses of SI (outside SI's parent) are on</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3959' href='#L_COMPARES_3959'><pre>3959</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // is disjoint from all other paths out of SI. But that information</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3960' href='#L_COMPARES_3960'><pre>3960</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // is more expensive to compute, and the trade-off here is in favor</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3961' href='#L_COMPARES_3961'><pre>3961</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // of compile-time. It should also be noticed that we check for a single</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3962' href='#L_COMPARES_3962'><pre>3962</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // predecessor and not only uniqueness. This to handle the situation when</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3963' href='#L_COMPARES_3963'><pre>3963</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // Succ and Succ1 points to the same basic block.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3964' href='#L_COMPARES_3964'><pre>3964</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (<div class='tooltip'>Succ->getSinglePredecessor() && <span class='tooltip-content'>70</span></div><div class='tooltip'>dominatesAllUses(SI, Icmp, Succ)<span class='tooltip-content'>61</span></div>) <div class='tooltip'>{<span class='tooltip-content'>21</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3965' href='#L_COMPARES_3965'><pre>3965</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> NumSel++;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3966' href='#L_COMPARES_3966'><pre>3966</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> SI->replaceUsesOutsideBlock(SI->getOperand(SIOpd), SI->getParent());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3967' href='#L_COMPARES_3967'><pre>3967</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3968' href='#L_COMPARES_3968'><pre>3968</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3969' href='#L_COMPARES_3969'><pre>3969</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3970' href='#L_COMPARES_3970'><pre>3970</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3971' href='#L_COMPARES_3971'><pre>3971</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3972' href='#L_COMPARES_3972'><pre>3972</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3973' href='#L_COMPARES_3973'><pre>3973</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold the comparison based on range information we can get by checking</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3974' href='#L_COMPARES_3974'><pre>3974</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// whether bits are known to be zero or one in the inputs.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3975' href='#L_COMPARES_3975'><pre>3975</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre>Instruction *InstCombiner::foldICmpUsingKnownBits(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3976' href='#L_COMPARES_3976'><pre>3976</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3977' href='#L_COMPARES_3977'><pre>3977</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Type *Ty = Op0->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3978' href='#L_COMPARES_3978'><pre>3978</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = I.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3979' href='#L_COMPARES_3979'><pre>3979</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3980' href='#L_COMPARES_3980'><pre>3980</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // Get scalar or pointer size.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3981' href='#L_COMPARES_3981'><pre>3981</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> unsigned BitWidth = Ty->isIntOrIntVectorTy()</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3982' href='#L_COMPARES_3982'><pre>3982</pre></a></td><td class='covered-line'><pre>966k</pre></td><td class='code'><pre> ? Ty->getScalarSizeInBits()</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3983' href='#L_COMPARES_3983'><pre>3983</pre></a></td><td class='covered-line'><pre>387k</pre></td><td class='code'><pre> : DL.getTypeSizeInBits(Ty->getScalarType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3984' href='#L_COMPARES_3984'><pre>3984</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3985' href='#L_COMPARES_3985'><pre>3985</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (!BitWidth)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3986' href='#L_COMPARES_3986'><pre>3986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3987' href='#L_COMPARES_3987'><pre>3987</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3988' href='#L_COMPARES_3988'><pre>3988</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // If this is a normal comparison, it demands all bits. If it is a sign bit</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3989' href='#L_COMPARES_3989'><pre>3989</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // comparison, it only demands the sign bit.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3990' href='#L_COMPARES_3990'><pre>3990</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> bool IsSignBit = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3991' href='#L_COMPARES_3991'><pre>3991</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> const APInt *CmpC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3992' href='#L_COMPARES_3992'><pre>3992</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(CmpC))<span class='tooltip-content'>1.35M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>722k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3993' href='#L_COMPARES_3993'><pre>3993</pre></a></td><td class='covered-line'><pre>722k</pre></td><td class='code'><pre> bool UnusedBit;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3994' href='#L_COMPARES_3994'><pre>3994</pre></a></td><td class='covered-line'><pre>722k</pre></td><td class='code'><pre> IsSignBit = isSignBitCheck(Pred, *CmpC, UnusedBit);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3995' href='#L_COMPARES_3995'><pre>3995</pre></a></td><td class='covered-line'><pre>722k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3996' href='#L_COMPARES_3996'><pre>3996</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3997' href='#L_COMPARES_3997'><pre>3997</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> APInt Op0KnownZero(BitWidth, 0), Op0KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3998' href='#L_COMPARES_3998'><pre>3998</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> APInt Op1KnownZero(BitWidth, 0), Op1KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_3999' href='#L_COMPARES_3999'><pre>3999</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4000' href='#L_COMPARES_4000'><pre>4000</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I.getOperandUse(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4001' href='#L_COMPARES_4001'><pre>4001</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> getDemandedBitsLHSMask(I, BitWidth, IsSignBit),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4002' href='#L_COMPARES_4002'><pre>4002</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Op0KnownZero, Op0KnownOne, 0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4003' href='#L_COMPARES_4003'><pre>4003</pre></a></td><td class='covered-line'><pre>1.62k</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4004' href='#L_COMPARES_4004'><pre>4004</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4005' href='#L_COMPARES_4005'><pre>4005</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>SimplifyDemandedBits(I.getOperandUse(1), APInt::getAllOnesValue(BitWidth),<span class='tooltip-content'>1.35M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4006' href='#L_COMPARES_4006'><pre>4006</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> Op1KnownZero, Op1KnownOne, 0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4007' href='#L_COMPARES_4007'><pre>4007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4008' href='#L_COMPARES_4008'><pre>4008</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4009' href='#L_COMPARES_4009'><pre>4009</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // Given the known and unknown bits, compute a range that the LHS could be</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4010' href='#L_COMPARES_4010'><pre>4010</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // in. Compute the Min, Max and RHS values based on the known bits. For the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4011' href='#L_COMPARES_4011'><pre>4011</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // EQ and NE we use unsigned values.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4012' href='#L_COMPARES_4012'><pre>4012</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> APInt Op0Min(BitWidth, 0), Op0Max(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4013' href='#L_COMPARES_4013'><pre>4013</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> APInt Op1Min(BitWidth, 0), Op1Max(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4014' href='#L_COMPARES_4014'><pre>4014</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (<div class='tooltip'>I.isSigned()<span class='tooltip-content'>1.35M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>261k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4015' href='#L_COMPARES_4015'><pre>4015</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> computeSignedMinMaxValuesFromKnownBits(Op0KnownZero, Op0KnownOne, Op0Min,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4016' href='#L_COMPARES_4016'><pre>4016</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> Op0Max);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4017' href='#L_COMPARES_4017'><pre>4017</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> computeSignedMinMaxValuesFromKnownBits(Op1KnownZero, Op1KnownOne, Op1Min,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4018' href='#L_COMPARES_4018'><pre>4018</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> Op1Max);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4019' href='#L_COMPARES_4019'><pre>4019</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4020' href='#L_COMPARES_4020'><pre>4020</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> computeUnsignedMinMaxValuesFromKnownBits(Op0KnownZero, Op0KnownOne, Op0Min,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4021' href='#L_COMPARES_4021'><pre>4021</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> Op0Max);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4022' href='#L_COMPARES_4022'><pre>4022</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> computeUnsignedMinMaxValuesFromKnownBits(Op1KnownZero, Op1KnownOne, Op1Min,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4023' href='#L_COMPARES_4023'><pre>4023</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> Op1Max);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4024' href='#L_COMPARES_4024'><pre>4024</pre></a></td><td class='covered-line'><pre>1.09M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4025' href='#L_COMPARES_4025'><pre>4025</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4026' href='#L_COMPARES_4026'><pre>4026</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // If Min and Max are known to be the same, then SimplifyDemandedBits</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4027' href='#L_COMPARES_4027'><pre>4027</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // figured out that the LHS is a constant. Constant fold this now, so that</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4028' href='#L_COMPARES_4028'><pre>4028</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // code below can assume that Min != Max.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4029' href='#L_COMPARES_4029'><pre>4029</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<Constant>(Op0) && <span class='tooltip-content'>1.35M</span></div><div class='tooltip'>Op0Min == Op0Max<span class='tooltip-content'>1.35M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4030' href='#L_COMPARES_4030'><pre>4030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, ConstantInt::get(Op0->getType(), Op0Min), Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4031' href='#L_COMPARES_4031'><pre>4031</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>!isa<Constant>(Op1) && <span class='tooltip-content'>1.35M</span></div><div class='tooltip'>Op1Min == Op1Max<span class='tooltip-content'>339k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4032' href='#L_COMPARES_4032'><pre>4032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(Pred, Op0, ConstantInt::get(Op1->getType(), Op1Min))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4033' href='#L_COMPARES_4033'><pre>4033</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4034' href='#L_COMPARES_4034'><pre>4034</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // Based on the range information we know about the LHS, see if we can</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4035' href='#L_COMPARES_4035'><pre>4035</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // simplify this comparison. For example, (x&4) < 8 is always true.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4036' href='#L_COMPARES_4036'><pre>4036</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> switch (Pred) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4037' href='#L_COMPARES_4037'><pre>4037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4038' href='#L_COMPARES_4038'><pre>4038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("Unknown icmp opcode!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4039' href='#L_COMPARES_4039'><pre>4039</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4040' href='#L_COMPARES_4040'><pre>4040</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> case ICmpInst::ICMP_NE: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4041' href='#L_COMPARES_4041'><pre>4041</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0Max.ult(Op1Min) || <span class='tooltip-content'>987k</span></div><div class='tooltip'>Op0Min.ugt(Op1Max)<span class='tooltip-content'>987k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4042' href='#L_COMPARES_4042'><pre>4042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Pred == CmpInst::ICMP_EQ</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4043' href='#L_COMPARES_4043'><pre>4043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4044' href='#L_COMPARES_4044'><pre>4044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4045' href='#L_COMPARES_4045'><pre>4045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4046' href='#L_COMPARES_4046'><pre>4046</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4047' href='#L_COMPARES_4047'><pre>4047</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> // If all bits are known zero except for one, then we know at most one bit</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4048' href='#L_COMPARES_4048'><pre>4048</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> // is set. If the comparison is against zero, then this is a check to see if</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4049' href='#L_COMPARES_4049'><pre>4049</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> // *that* bit is set.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4050' href='#L_COMPARES_4050'><pre>4050</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> APInt Op0KnownZeroInverted = ~Op0KnownZero;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4051' href='#L_COMPARES_4051'><pre>4051</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> if (<div class='tooltip'>~Op1KnownZero == 0<span class='tooltip-content'>987k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>661k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4052' href='#L_COMPARES_4052'><pre>4052</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> // If the LHS is an AND with the same constant, look through it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4053' href='#L_COMPARES_4053'><pre>4053</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> Value *LHS = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4054' href='#L_COMPARES_4054'><pre>4054</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> const APInt *LHSC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4055' href='#L_COMPARES_4055'><pre>4055</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> if (!match(Op0, m_And(m_Value(LHS), m_APInt(LHSC))) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4056' href='#L_COMPARES_4056'><pre>4056</pre></a></td><td class='covered-line'><pre>35.7k</pre></td><td class='code'><pre> *LHSC != Op0KnownZeroInverted)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4057' href='#L_COMPARES_4057'><pre>4057</pre></a></td><td class='covered-line'><pre>625k</pre></td><td class='code'><pre> LHS = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4058' href='#L_COMPARES_4058'><pre>4058</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4059' href='#L_COMPARES_4059'><pre>4059</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4060' href='#L_COMPARES_4060'><pre>4060</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(LHS, m_Shl(m_One(), m_Value(X)))<span class='tooltip-content'>661k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>88</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4061' href='#L_COMPARES_4061'><pre>4061</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> APInt ValToCheck = Op0KnownZeroInverted;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4062' href='#L_COMPARES_4062'><pre>4062</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> Type *XTy = X->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4063' href='#L_COMPARES_4063'><pre>4063</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> if (<div class='tooltip'>ValToCheck.isPowerOf2()<span class='tooltip-content'>88</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4064' href='#L_COMPARES_4064'><pre>4064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((1 << X) & 8) == 0 -> X != 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4065' href='#L_COMPARES_4065'><pre>4065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((1 << X) & 8) != 0 -> X == 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4066' href='#L_COMPARES_4066'><pre>4066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CmpC = ConstantInt::get(XTy, ValToCheck.countTrailingZeros());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4067' href='#L_COMPARES_4067'><pre>4067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NewPred = ICmpInst::getInversePredicate(Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4068' href='#L_COMPARES_4068'><pre>4068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(NewPred, X, CmpC);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4069' href='#L_COMPARES_4069'><pre>4069</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>88</span></div><div class='tooltip'>(++ValToCheck).isPowerOf2()<span class='tooltip-content'>88</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4070' href='#L_COMPARES_4070'><pre>4070</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((1 << X) & 7) == 0 -> X >= 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4071' href='#L_COMPARES_4071'><pre>4071</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((1 << X) & 7) != 0 -> X < 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4072' href='#L_COMPARES_4072'><pre>4072</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *CmpC = ConstantInt::get(XTy, ValToCheck.countTrailingZeros());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4073' href='#L_COMPARES_4073'><pre>4073</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NewPred =</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4074' href='#L_COMPARES_4074'><pre>4074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred == CmpInst::ICMP_EQ ? </span><div class='tooltip'><span class='red'>CmpInst::ICMP_UGE</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>CmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4075' href='#L_COMPARES_4075'><pre>4075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(NewPred, X, CmpC);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4076' href='#L_COMPARES_4076'><pre>4076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4077' href='#L_COMPARES_4077'><pre>4077</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4078' href='#L_COMPARES_4078'><pre>4078</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4079' href='#L_COMPARES_4079'><pre>4079</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> // Check if the LHS is 8 >>u x and the result is a power of 2 like 1.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4080' href='#L_COMPARES_4080'><pre>4080</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> const APInt *CI;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4081' href='#L_COMPARES_4081'><pre>4081</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> if (Op0KnownZeroInverted == 1 &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4082' href='#L_COMPARES_4082'><pre>4082</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> <div class='tooltip'>match(LHS, m_LShr(m_Power2(CI), m_Value(X)))<span class='tooltip-content'>47.7k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4083' href='#L_COMPARES_4083'><pre>4083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((8 >>u X) & 1) == 0 -> X != 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4084' href='#L_COMPARES_4084'><pre>4084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ((8 >>u X) & 1) != 0 -> X == 3</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4085' href='#L_COMPARES_4085'><pre>4085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned CmpVal = CI->countTrailingZeros();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4086' href='#L_COMPARES_4086'><pre>4086</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NewPred = ICmpInst::getInversePredicate(Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4087' href='#L_COMPARES_4087'><pre>4087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ICmpInst(NewPred, X, ConstantInt::get(X->getType(), CmpVal));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4088' href='#L_COMPARES_4088'><pre>4088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4089' href='#L_COMPARES_4089'><pre>4089</pre></a></td><td class='covered-line'><pre>661k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4090' href='#L_COMPARES_4090'><pre>4090</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4091' href='#L_COMPARES_4091'><pre>4091</pre></a></td><td class='covered-line'><pre>987k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4092' href='#L_COMPARES_4092'><pre>4092</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULT: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4093' href='#L_COMPARES_4093'><pre>4093</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> if (Op0Max.ult(Op1Min)) // A <u B -> true if max(A) < min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4094' href='#L_COMPARES_4094'><pre>4094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4095' href='#L_COMPARES_4095'><pre>4095</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>Op0Min.uge(Op1Max)<span class='tooltip-content'>63.2k</span></div>) // A <u B -> false if min(A) >= max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4096' href='#L_COMPARES_4096'><pre>4096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4097' href='#L_COMPARES_4097'><pre>4097</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>Op1Min == Op0Max<span class='tooltip-content'>63.2k</span></div>) // A <u B -> A != B if max(A) == min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4098' href='#L_COMPARES_4098'><pre>4098</pre></a></td><td class='covered-line'><pre>247</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4099' href='#L_COMPARES_4099'><pre>4099</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4100' href='#L_COMPARES_4100'><pre>4100</pre></a></td><td class='covered-line'><pre>62.9k</pre></td><td class='code'><pre> const APInt *CmpC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4101' href='#L_COMPARES_4101'><pre>4101</pre></a></td><td class='covered-line'><pre>62.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(CmpC))<span class='tooltip-content'>62.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>30.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4102' href='#L_COMPARES_4102'><pre>4102</pre></a></td><td class='covered-line'><pre>30.8k</pre></td><td class='code'><pre> // A <u C -> A == C-1 if min(A)+1 == C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4103' href='#L_COMPARES_4103'><pre>4103</pre></a></td><td class='covered-line'><pre>30.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op1Max == Op0Min + 1<span class='tooltip-content'>30.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>493</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4104' href='#L_COMPARES_4104'><pre>4104</pre></a></td><td class='covered-line'><pre>493</pre></td><td class='code'><pre> Constant *CMinus1 = ConstantInt::get(Op0->getType(), *CmpC - 1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4105' href='#L_COMPARES_4105'><pre>4105</pre></a></td><td class='covered-line'><pre>493</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Op0, CMinus1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4106' href='#L_COMPARES_4106'><pre>4106</pre></a></td><td class='covered-line'><pre>493</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4107' href='#L_COMPARES_4107'><pre>4107</pre></a></td><td class='covered-line'><pre>30.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4108' href='#L_COMPARES_4108'><pre>4108</pre></a></td><td class='covered-line'><pre>62.4k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4109' href='#L_COMPARES_4109'><pre>4109</pre></a></td><td class='covered-line'><pre>62.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4110' href='#L_COMPARES_4110'><pre>4110</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGT: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4111' href='#L_COMPARES_4111'><pre>4111</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre> if (Op0Min.ugt(Op1Max)) // A >u B -> true if min(A) > max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4112' href='#L_COMPARES_4112'><pre>4112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4113' href='#L_COMPARES_4113'><pre>4113</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4114' href='#L_COMPARES_4114'><pre>4114</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>35.2k</span></div><div class='tooltip'>Op0Max.ule(Op1Min)<span class='tooltip-content'>35.2k</span></div>) // A >u B -> false if max(A) <= max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4115' href='#L_COMPARES_4115'><pre>4115</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4116' href='#L_COMPARES_4116'><pre>4116</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4117' href='#L_COMPARES_4117'><pre>4117</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>35.2k</span></div><div class='tooltip'>Op1Max == Op0Min<span class='tooltip-content'>35.2k</span></div>) // A >u B -> A != B if min(A) == max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4118' href='#L_COMPARES_4118'><pre>4118</pre></a></td><td class='covered-line'><pre>874</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4119' href='#L_COMPARES_4119'><pre>4119</pre></a></td><td class='covered-line'><pre>35.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4120' href='#L_COMPARES_4120'><pre>4120</pre></a></td><td class='covered-line'><pre>34.3k</pre></td><td class='code'><pre> const APInt *CmpC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4121' href='#L_COMPARES_4121'><pre>4121</pre></a></td><td class='covered-line'><pre>34.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(CmpC))<span class='tooltip-content'>34.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4122' href='#L_COMPARES_4122'><pre>4122</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> // A >u C -> A == C+1 if max(a)-1 == C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4123' href='#L_COMPARES_4123'><pre>4123</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> if (*CmpC == Op0Max - 1)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4124' href='#L_COMPARES_4124'><pre>4124</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Op0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4125' href='#L_COMPARES_4125'><pre>4125</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ConstantInt::get(Op1->getType(), *CmpC + 1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4126' href='#L_COMPARES_4126'><pre>4126</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4127' href='#L_COMPARES_4127'><pre>4127</pre></a></td><td class='covered-line'><pre>34.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4128' href='#L_COMPARES_4128'><pre>4128</pre></a></td><td class='covered-line'><pre>34.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4129' href='#L_COMPARES_4129'><pre>4129</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4130' href='#L_COMPARES_4130'><pre>4130</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> if (Op0Max.slt(Op1Min)) // A <s B -> true if max(A) < min(C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4131' href='#L_COMPARES_4131'><pre>4131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4132' href='#L_COMPARES_4132'><pre>4132</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>133k</span></div><div class='tooltip'>Op0Min.sge(Op1Max)<span class='tooltip-content'>133k</span></div>) // A <s B -> false if min(A) >= max(C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4133' href='#L_COMPARES_4133'><pre>4133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4134' href='#L_COMPARES_4134'><pre>4134</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>133k</span></div><div class='tooltip'>Op1Min == Op0Max<span class='tooltip-content'>133k</span></div>) // A <s B -> A != B if max(A) == min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4135' href='#L_COMPARES_4135'><pre>4135</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4136' href='#L_COMPARES_4136'><pre>4136</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>133k</span></div><div class='tooltip'>CI<span class='tooltip-content'>133k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>51.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4137' href='#L_COMPARES_4137'><pre>4137</pre></a></td><td class='covered-line'><pre>51.1k</pre></td><td class='code'><pre> if (Op1Max == Op0Min + 1) // A <s C -> A == C-1 if min(A)+1 == C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4138' href='#L_COMPARES_4138'><pre>4138</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Op0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4139' href='#L_COMPARES_4139'><pre>4139</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Builder->getInt(CI->getValue() - 1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4140' href='#L_COMPARES_4140'><pre>4140</pre></a></td><td class='covered-line'><pre>51.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4141' href='#L_COMPARES_4141'><pre>4141</pre></a></td><td class='covered-line'><pre>133k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4142' href='#L_COMPARES_4142'><pre>4142</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4143' href='#L_COMPARES_4143'><pre>4143</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> if (Op0Min.sgt(Op1Max)) // A >s B -> true if min(A) > max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4144' href='#L_COMPARES_4144'><pre>4144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4145' href='#L_COMPARES_4145'><pre>4145</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>124k</span></div><div class='tooltip'>Op0Max.sle(Op1Min)<span class='tooltip-content'>124k</span></div>) // A >s B -> false if max(A) <= min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4146' href='#L_COMPARES_4146'><pre>4146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4147' href='#L_COMPARES_4147'><pre>4147</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4148' href='#L_COMPARES_4148'><pre>4148</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>124k</span></div><div class='tooltip'>Op1Max == Op0Min<span class='tooltip-content'>124k</span></div>) // A >s B -> A != B if min(A) == max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4149' href='#L_COMPARES_4149'><pre>4149</pre></a></td><td class='covered-line'><pre>131</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4150' href='#L_COMPARES_4150'><pre>4150</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>124k</span></div><div class='tooltip'>CI<span class='tooltip-content'>124k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>94.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4151' href='#L_COMPARES_4151'><pre>4151</pre></a></td><td class='covered-line'><pre>94.2k</pre></td><td class='code'><pre> if (Op1Min == Op0Max - 1) // A >s C -> A == C+1 if max(A)-1 == C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4152' href='#L_COMPARES_4152'><pre>4152</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_EQ, Op0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4153' href='#L_COMPARES_4153'><pre>4153</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Builder->getInt(CI->getValue() + 1));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4154' href='#L_COMPARES_4154'><pre>4154</pre></a></td><td class='covered-line'><pre>94.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4155' href='#L_COMPARES_4155'><pre>4155</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4156' href='#L_COMPARES_4156'><pre>4156</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SGE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4157' href='#L_COMPARES_4157'><pre>4157</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> assert(!isa<ConstantInt>(Op1) && "ICMP_SGE with ConstantInt not folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4158' href='#L_COMPARES_4158'><pre>4158</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> if (Op0Min.sge(Op1Max)) // A >=s B -> true if min(A) >= max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4159' href='#L_COMPARES_4159'><pre>4159</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4160' href='#L_COMPARES_4160'><pre>4160</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.20k</span></div><div class='tooltip'>Op0Max.slt(Op1Min)<span class='tooltip-content'>2.20k</span></div>) // A >=s B -> false if max(A) < min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4161' href='#L_COMPARES_4161'><pre>4161</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4162' href='#L_COMPARES_4162'><pre>4162</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4163' href='#L_COMPARES_4163'><pre>4163</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> case ICmpInst::ICMP_SLE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4164' href='#L_COMPARES_4164'><pre>4164</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> assert(!isa<ConstantInt>(Op1) && "ICMP_SLE with ConstantInt not folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4165' href='#L_COMPARES_4165'><pre>4165</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> if (Op0Max.sle(Op1Min)) // A <=s B -> true if max(A) <= min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4166' href='#L_COMPARES_4166'><pre>4166</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4167' href='#L_COMPARES_4167'><pre>4167</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.74k</span></div><div class='tooltip'>Op0Min.sgt(Op1Max)<span class='tooltip-content'>1.74k</span></div>) // A <=s B -> false if min(A) > max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4168' href='#L_COMPARES_4168'><pre>4168</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4169' href='#L_COMPARES_4169'><pre>4169</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4170' href='#L_COMPARES_4170'><pre>4170</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> case ICmpInst::ICMP_UGE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4171' href='#L_COMPARES_4171'><pre>4171</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> assert(!isa<ConstantInt>(Op1) && "ICMP_UGE with ConstantInt not folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4172' href='#L_COMPARES_4172'><pre>4172</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> if (Op0Min.uge(Op1Max)) // A >=u B -> true if min(A) >= max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4173' href='#L_COMPARES_4173'><pre>4173</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4174' href='#L_COMPARES_4174'><pre>4174</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.73k</span></div><div class='tooltip'>Op0Max.ult(Op1Min)<span class='tooltip-content'>1.73k</span></div>) // A >=u B -> false if max(A) < min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4175' href='#L_COMPARES_4175'><pre>4175</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4176' href='#L_COMPARES_4176'><pre>4176</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4177' href='#L_COMPARES_4177'><pre>4177</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> case ICmpInst::ICMP_ULE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4178' href='#L_COMPARES_4178'><pre>4178</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> assert(!isa<ConstantInt>(Op1) && "ICMP_ULE with ConstantInt not folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4179' href='#L_COMPARES_4179'><pre>4179</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> if (Op0Max.ule(Op1Min)) // A <=u B -> true if max(A) <= min(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4180' href='#L_COMPARES_4180'><pre>4180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getTrue(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4181' href='#L_COMPARES_4181'><pre>4181</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.11k</span></div><div class='tooltip'>Op0Min.ugt(Op1Max)<span class='tooltip-content'>3.11k</span></div>) // A <=u B -> false if min(A) > max(B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4182' href='#L_COMPARES_4182'><pre>4182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, ConstantInt::getFalse(I.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4183' href='#L_COMPARES_4183'><pre>4183</pre></a></td><td class='covered-line'><pre>3.11k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4184' href='#L_COMPARES_4184'><pre>4184</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4185' href='#L_COMPARES_4185'><pre>4185</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4186' href='#L_COMPARES_4186'><pre>4186</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // Turn a signed comparison into an unsigned one if both operands are known to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4187' href='#L_COMPARES_4187'><pre>4187</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // have the same sign.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4188' href='#L_COMPARES_4188'><pre>4188</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>I.isSigned() &&<span class='tooltip-content'>1.35M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4189' href='#L_COMPARES_4189'><pre>4189</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> <div class='tooltip'>((Op0KnownZero.isNegative() && <span class='tooltip-content'>261k</span></div><div class='tooltip'>Op1KnownZero.isNegative()<span class='tooltip-content'>1.21k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4190' href='#L_COMPARES_4190'><pre>4190</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> <div class='tooltip'>(Op0KnownOne.isNegative() && <span class='tooltip-content'>261k</span></div><div class='tooltip'>Op1KnownOne.isNegative()<span class='tooltip-content'>35</span></div>)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4191' href='#L_COMPARES_4191'><pre>4191</pre></a></td><td class='covered-line'><pre>707</pre></td><td class='code'><pre> return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4192' href='#L_COMPARES_4192'><pre>4192</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4193' href='#L_COMPARES_4193'><pre>4193</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4194' href='#L_COMPARES_4194'><pre>4194</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4195' href='#L_COMPARES_4195'><pre>4195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4196' href='#L_COMPARES_4196'><pre>4196</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If we have an icmp le or icmp ge instruction with a constant operand, turn</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4197' href='#L_COMPARES_4197'><pre>4197</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// it into the appropriate icmp lt or icmp gt instruction. This transform</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4198' href='#L_COMPARES_4198'><pre>4198</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// allows them to be folded in visitICmpInst.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4199' href='#L_COMPARES_4199'><pre>4199</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre>static ICmpInst *canonicalizeCmpWithConstant(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4200' href='#L_COMPARES_4200'><pre>4200</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = I.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4201' href='#L_COMPARES_4201'><pre>4201</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred != ICmpInst::ICMP_SLE && <span class='tooltip-content'>1.35M</span></div><div class='tooltip'>Pred != ICmpInst::ICMP_SGE<span class='tooltip-content'>1.35M</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4202' href='#L_COMPARES_4202'><pre>4202</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>Pred != ICmpInst::ICMP_ULE<span class='tooltip-content'>1.35M</span></div> && <div class='tooltip'>Pred != ICmpInst::ICMP_UGE<span class='tooltip-content'>1.34M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4203' href='#L_COMPARES_4203'><pre>4203</pre></a></td><td class='covered-line'><pre>1.34M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4204' href='#L_COMPARES_4204'><pre>4204</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4205' href='#L_COMPARES_4205'><pre>4205</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4206' href='#L_COMPARES_4206'><pre>4206</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> Value *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4207' href='#L_COMPARES_4207'><pre>4207</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> auto *Op1C = dyn_cast<Constant>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4208' href='#L_COMPARES_4208'><pre>4208</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> if (!Op1C)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4209' href='#L_COMPARES_4209'><pre>4209</pre></a></td><td class='covered-line'><pre>8.77k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4210' href='#L_COMPARES_4210'><pre>4210</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4211' href='#L_COMPARES_4211'><pre>4211</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // Check if the constant operand can be safely incremented/decremented without</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4212' href='#L_COMPARES_4212'><pre>4212</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // overflowing/underflowing. For scalars, SimplifyICmpInst has already handled</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4213' href='#L_COMPARES_4213'><pre>4213</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // the edge cases for us, so we just assert on them. For vectors, we must</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4214' href='#L_COMPARES_4214'><pre>4214</pre></a></td><td class='covered-line'><pre>11.2k</pre></td><td class='code'><pre> // handle the edge cases.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4215' href='#L_COMPARES_4215'><pre>4215</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> Type *Op1Type = Op1->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4216' href='#L_COMPARES_4216'><pre>4216</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> bool IsSigned = I.isSigned();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4217' href='#L_COMPARES_4217'><pre>4217</pre></a></td><td class='covered-line'><pre>1.91k</pre></td><td class='code'><pre> bool IsLE = (Pred == ICmpInst::ICMP_SLE || Pred == ICmpInst::ICMP_ULE);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4218' href='#L_COMPARES_4218'><pre>4218</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> auto *CI = dyn_cast<ConstantInt>(Op1C);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4219' href='#L_COMPARES_4219'><pre>4219</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> if (<div class='tooltip'>CI<span class='tooltip-content'>2.48k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.47k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4220' href='#L_COMPARES_4220'><pre>4220</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> // A <= MAX -> TRUE ; A >= MIN -> TRUE</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4221' href='#L_COMPARES_4221'><pre>4221</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> assert(IsLE ? !CI->isMaxValue(IsSigned) : !CI->isMinValue(IsSigned));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4222' href='#L_COMPARES_4222'><pre>4222</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>9</span></div><div class='tooltip'>Op1Type->isVectorTy()<span class='tooltip-content'>9</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4223' href='#L_COMPARES_4223'><pre>4223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO? If the edge cases for vectors were guaranteed to be handled as they</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4224' href='#L_COMPARES_4224'><pre>4224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // are for scalar, we could remove the min/max checks. However, to do that,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4225' href='#L_COMPARES_4225'><pre>4225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // we would have to use insertelement/shufflevector to replace edge values.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4226' href='#L_COMPARES_4226'><pre>4226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumElts = Op1Type->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4227' href='#L_COMPARES_4227'><pre>4227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4228' href='#L_COMPARES_4228'><pre>4228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = Op1C->getAggregateElement(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4229' href='#L_COMPARES_4229'><pre>4229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Elt</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4230' href='#L_COMPARES_4230'><pre>4230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4231' href='#L_COMPARES_4231'><pre>4231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4232' href='#L_COMPARES_4232'><pre>4232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Elt)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4233' href='#L_COMPARES_4233'><pre>4233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4234' href='#L_COMPARES_4234'><pre>4234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4235' href='#L_COMPARES_4235'><pre>4235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Bail out if we can't determine if this constant is min/max or if we</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4236' href='#L_COMPARES_4236'><pre>4236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // know that this constant is min/max.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4237' href='#L_COMPARES_4237'><pre>4237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *CI = dyn_cast<ConstantInt>(Elt);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4238' href='#L_COMPARES_4238'><pre>4238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CI || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(IsLE ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI->isMaxValue(IsSigned)</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>CI->isMinValue(IsSigned)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4239' href='#L_COMPARES_4239'><pre>4239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4240' href='#L_COMPARES_4240'><pre>4240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4241' href='#L_COMPARES_4241'><pre>4241</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4242' href='#L_COMPARES_4242'><pre>4242</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // ConstantExpr?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4243' href='#L_COMPARES_4243'><pre>4243</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4244' href='#L_COMPARES_4244'><pre>4244</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4245' href='#L_COMPARES_4245'><pre>4245</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4246' href='#L_COMPARES_4246'><pre>4246</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> // Increment or decrement the constant and set the new comparison predicate:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4247' href='#L_COMPARES_4247'><pre>4247</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre> // ULE -> ULT ; UGE -> UGT ; SLE -> SLT ; SGE -> SGT</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4248' href='#L_COMPARES_4248'><pre>4248</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> <div class='tooltip'>Constant *OneOrNegOne = ConstantInt::get(Op1Type, IsLE ? <span class='tooltip-content'>2.47k</span></div><div class='tooltip'>1<span class='tooltip-content'>2.47k</span></div> : <div class='tooltip'><span class='red'>-1</span><span class='tooltip-content'>0</span></div>, true);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4249' href='#L_COMPARES_4249'><pre>4249</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> CmpInst::Predicate NewPred = IsLE ? <div class='tooltip'>ICmpInst::ICMP_ULT<span class='tooltip-content'>2.47k</span></div>: <div class='tooltip'><span class='red'>ICmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4250' href='#L_COMPARES_4250'><pre>4250</pre></a></td><td class='covered-line'><pre>1.74k</pre></td><td class='code'><pre> NewPred = IsSigned ? <div class='tooltip'>ICmpInst::getSignedPredicate(NewPred)<span class='tooltip-content'>1.74k</span></div> : <div class='tooltip'>NewPred<span class='tooltip-content'>727</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4251' href='#L_COMPARES_4251'><pre>4251</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> return new ICmpInst(NewPred, Op0, ConstantExpr::getAdd(Op1C, OneOrNegOne));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4252' href='#L_COMPARES_4252'><pre>4252</pre></a></td><td class='covered-line'><pre>2.48k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4253' href='#L_COMPARES_4253'><pre>4253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4254' href='#L_COMPARES_4254'><pre>4254</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4255' href='#L_COMPARES_4255'><pre>4255</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> bool Changed = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4256' href='#L_COMPARES_4256'><pre>4256</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4257' href='#L_COMPARES_4257'><pre>4257</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> unsigned Op0Cplxity = getComplexity(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4258' href='#L_COMPARES_4258'><pre>4258</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> unsigned Op1Cplxity = getComplexity(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4259' href='#L_COMPARES_4259'><pre>4259</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4260' href='#L_COMPARES_4260'><pre>4260</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> /// Orders the operands of the compare so that they are listed from most</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4261' href='#L_COMPARES_4261'><pre>4261</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> /// complex to least complex. This puts constants before unary operators,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4262' href='#L_COMPARES_4262'><pre>4262</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> /// before binary operators.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4263' href='#L_COMPARES_4263'><pre>4263</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> if (Op0Cplxity < Op1Cplxity ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4264' href='#L_COMPARES_4264'><pre>4264</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>(Op0Cplxity == Op1Cplxity && <span class='tooltip-content'>1.35M</span></div><div class='tooltip'>swapMayExposeCSEOpportunities(Op0, Op1)<span class='tooltip-content'>230k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>6.89k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4265' href='#L_COMPARES_4265'><pre>4265</pre></a></td><td class='covered-line'><pre>6.89k</pre></td><td class='code'><pre> I.swapOperands();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4266' href='#L_COMPARES_4266'><pre>4266</pre></a></td><td class='covered-line'><pre>6.89k</pre></td><td class='code'><pre> std::swap(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4267' href='#L_COMPARES_4267'><pre>4267</pre></a></td><td class='covered-line'><pre>6.89k</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4268' href='#L_COMPARES_4268'><pre>4268</pre></a></td><td class='covered-line'><pre>6.89k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4269' href='#L_COMPARES_4269'><pre>4269</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4270' href='#L_COMPARES_4270'><pre>4270</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> if (Value *V =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4271' href='#L_COMPARES_4271'><pre>4271</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> SimplifyICmpInst(I.getPredicate(), Op0, Op1, DL, &TLI, &DT, &AC, &I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4272' href='#L_COMPARES_4272'><pre>4272</pre></a></td><td class='covered-line'><pre>656</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4273' href='#L_COMPARES_4273'><pre>4273</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4274' href='#L_COMPARES_4274'><pre>4274</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // comparing -val or val with non-zero is the same as just comparing val</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4275' href='#L_COMPARES_4275'><pre>4275</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // ie, abs(val) != 0 -> val != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4276' href='#L_COMPARES_4276'><pre>4276</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.36M</span></div><div class='tooltip'>I.getPredicate() == ICmpInst::ICMP_NE && <span class='tooltip-content'>1.36M</span></div><div class='tooltip'>match(Op1, m_Zero())<span class='tooltip-content'>83.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>67.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4277' href='#L_COMPARES_4277'><pre>4277</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> Value *Cond, *SelectTrue, *SelectFalse;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4278' href='#L_COMPARES_4278'><pre>4278</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> if (match(Op0, m_Select(m_Value(Cond), m_Value(SelectTrue),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4279' href='#L_COMPARES_4279'><pre>4279</pre></a></td><td class='covered-line'><pre>323</pre></td><td class='code'><pre> m_Value(SelectFalse)))) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4280' href='#L_COMPARES_4280'><pre>4280</pre></a></td><td class='covered-line'><pre>323</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>323</span></div> = dyn_castNegVal(SelectTrue)) <div class='tooltip'>{<span class='tooltip-content'>59</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4281' href='#L_COMPARES_4281'><pre>4281</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> if (V == SelectFalse)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4282' href='#L_COMPARES_4282'><pre>4282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4283' href='#L_COMPARES_4283'><pre>4283</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4284' href='#L_COMPARES_4284'><pre>4284</pre></a></td><td class='covered-line'><pre>264</pre></td><td class='code'><pre> else <div class='tooltip'>if (Value *<span class='tooltip-content'>264</span></div><div class='tooltip'>V<span class='tooltip-content'>264</span></div> = dyn_castNegVal(SelectFalse)) <div class='tooltip'>{<span class='tooltip-content'>39</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4285' href='#L_COMPARES_4285'><pre>4285</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> if (V == SelectTrue)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4286' href='#L_COMPARES_4286'><pre>4286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4287' href='#L_COMPARES_4287'><pre>4287</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4288' href='#L_COMPARES_4288'><pre>4288</pre></a></td><td class='covered-line'><pre>323</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4289' href='#L_COMPARES_4289'><pre>4289</pre></a></td><td class='covered-line'><pre>67.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4290' href='#L_COMPARES_4290'><pre>4290</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4291' href='#L_COMPARES_4291'><pre>4291</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> Type *Ty = Op0->getType();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4292' href='#L_COMPARES_4292'><pre>4292</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4293' href='#L_COMPARES_4293'><pre>4293</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> // icmp's with boolean values can always be turned into bitwise operations</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4294' href='#L_COMPARES_4294'><pre>4294</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre> if (<div class='tooltip'>Ty->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>1.36M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.36k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4295' href='#L_COMPARES_4295'><pre>4295</pre></a></td><td class='covered-line'><pre>3.36k</pre></td><td class='code'><pre> switch (I.getPredicate()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4296' href='#L_COMPARES_4296'><pre>4296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Invalid icmp instruction!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4297' href='#L_COMPARES_4297'><pre>4297</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4298' href='#L_COMPARES_4298'><pre>4298</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> Value *Xor = Builder->CreateXor(Op0, Op1, I.getName() + "tmp");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4299' href='#L_COMPARES_4299'><pre>4299</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> return BinaryOperator::CreateNot(Xor)<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4300' href='#L_COMPARES_4300'><pre>4300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4301' href='#L_COMPARES_4301'><pre>4301</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_NE: // icmp ne i1 A, B -> A^B</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4302' href='#L_COMPARES_4302'><pre>4302</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return BinaryOperator::CreateXor(Op0, Op1)<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4303' href='#L_COMPARES_4303'><pre>4303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4304' href='#L_COMPARES_4304'><pre>4304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4305' href='#L_COMPARES_4305'><pre>4305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, Op1); // Change icmp ugt -> icmp ult</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4306' href='#L_COMPARES_4306'><pre>4306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LLVM_FALLTHROUGH</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4307' href='#L_COMPARES_4307'><pre>4307</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_ULT:{ // icmp ult i1 A, B -> ~A & B</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4308' href='#L_COMPARES_4308'><pre>4308</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *Not = Builder->CreateNot(Op0, I.getName() + "tmp");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4309' href='#L_COMPARES_4309'><pre>4309</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Not, Op1)<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4310' href='#L_COMPARES_4310'><pre>4310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4311' href='#L_COMPARES_4311'><pre>4311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4312' href='#L_COMPARES_4312'><pre>4312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, Op1); // Change icmp sgt -> icmp slt</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4313' href='#L_COMPARES_4313'><pre>4313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LLVM_FALLTHROUGH</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4314' href='#L_COMPARES_4314'><pre>4314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT: { // icmp slt i1 A, B -> A & ~B</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4315' href='#L_COMPARES_4315'><pre>4315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(Op1, I.getName() + "tmp");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4316' href='#L_COMPARES_4316'><pre>4316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(Not, Op0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4317' href='#L_COMPARES_4317'><pre>4317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4318' href='#L_COMPARES_4318'><pre>4318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4319' href='#L_COMPARES_4319'><pre>4319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, Op1); // Change icmp uge -> icmp ule</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4320' href='#L_COMPARES_4320'><pre>4320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LLVM_FALLTHROUGH</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4321' href='#L_COMPARES_4321'><pre>4321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULE: { // icmp ule i1 A, B -> ~A | B</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4322' href='#L_COMPARES_4322'><pre>4322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(Op0, I.getName() + "tmp");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4323' href='#L_COMPARES_4323'><pre>4323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(Not, Op1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4324' href='#L_COMPARES_4324'><pre>4324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4325' href='#L_COMPARES_4325'><pre>4325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4326' href='#L_COMPARES_4326'><pre>4326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Op0, Op1); // Change icmp sge -> icmp sle</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4327' href='#L_COMPARES_4327'><pre>4327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LLVM_FALLTHROUGH</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4328' href='#L_COMPARES_4328'><pre>4328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLE: { // icmp sle i1 A, B -> A | ~B</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4329' href='#L_COMPARES_4329'><pre>4329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Not = Builder->CreateNot(Op1, I.getName() + "tmp");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4330' href='#L_COMPARES_4330'><pre>4330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateOr(Not, Op0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4331' href='#L_COMPARES_4331'><pre>4331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4332' href='#L_COMPARES_4332'><pre>4332</pre></a></td><td class='covered-line'><pre>3.36k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4333' href='#L_COMPARES_4333'><pre>4333</pre></a></td><td class='covered-line'><pre>3.36k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4334' href='#L_COMPARES_4334'><pre>4334</pre></a></td><td class='covered-line'><pre>1.36M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4335' href='#L_COMPARES_4335'><pre>4335</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>NewICmp<span class='tooltip-content'>1.35M</span></div> = canonicalizeCmpWithConstant(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4336' href='#L_COMPARES_4336'><pre>4336</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> return NewICmp;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4337' href='#L_COMPARES_4337'><pre>4337</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4338' href='#L_COMPARES_4338'><pre>4338</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.35M</span></div> = foldICmpWithConstant(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4339' href='#L_COMPARES_4339'><pre>4339</pre></a></td><td class='covered-line'><pre>238</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4340' href='#L_COMPARES_4340'><pre>4340</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4341' href='#L_COMPARES_4341'><pre>4341</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.35M</span></div> = foldICmpUsingKnownBits(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4342' href='#L_COMPARES_4342'><pre>4342</pre></a></td><td class='covered-line'><pre>4.09k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4343' href='#L_COMPARES_4343'><pre>4343</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4344' href='#L_COMPARES_4344'><pre>4344</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // Test if the ICmpInst instruction is used exclusively by a select as</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4345' href='#L_COMPARES_4345'><pre>4345</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // part of a minimum or maximum operation. If so, refrain from doing</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4346' href='#L_COMPARES_4346'><pre>4346</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // any other folding. This helps out other analyses which understand</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4347' href='#L_COMPARES_4347'><pre>4347</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // non-obfuscated minimum and maximum idioms, such as ScalarEvolution</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4348' href='#L_COMPARES_4348'><pre>4348</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // and CodeGen. And in this case, at least one of the comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4349' href='#L_COMPARES_4349'><pre>4349</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // operands has at least one user besides the compare (the select),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4350' href='#L_COMPARES_4350'><pre>4350</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // which would often largely negate the benefit of folding anyway.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4351' href='#L_COMPARES_4351'><pre>4351</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.35M</span></div><div class='tooltip'>I.hasOneUse()<span class='tooltip-content'>1.35M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4352' href='#L_COMPARES_4352'><pre>4352</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>1.31M</span></div><div class='tooltip'>SI<span class='tooltip-content'>1.31M</span></div> = dyn_cast<SelectInst>(*I.user_begin()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4353' href='#L_COMPARES_4353'><pre>4353</pre></a></td><td class='covered-line'><pre>66.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>66.8k</span></div><div class='tooltip'>(SI->getOperand(1) == Op0 && <span class='tooltip-content'>66.8k</span></div><div class='tooltip'>SI->getOperand(2) == Op1<span class='tooltip-content'>17.1k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4354' href='#L_COMPARES_4354'><pre>4354</pre></a></td><td class='covered-line'><pre>50.2k</pre></td><td class='code'><pre> <div class='tooltip'>(SI->getOperand(2) == Op0 && <span class='tooltip-content'>50.2k</span></div><div class='tooltip'>SI->getOperand(1) == Op1<span class='tooltip-content'>10.3k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4355' href='#L_COMPARES_4355'><pre>4355</pre></a></td><td class='covered-line'><pre>20.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4356' href='#L_COMPARES_4356'><pre>4356</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4357' href='#L_COMPARES_4357'><pre>4357</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // FIXME: We only do this after checking for min/max to prevent infinite</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4358' href='#L_COMPARES_4358'><pre>4358</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // looping caused by a reverse canonicalization of these patterns for min/max.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4359' href='#L_COMPARES_4359'><pre>4359</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // FIXME: The organization of folds is a mess. These would naturally go into</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4360' href='#L_COMPARES_4360'><pre>4360</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // canonicalizeCmpWithConstant(), but we can't move all of the above folds</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4361' href='#L_COMPARES_4361'><pre>4361</pre></a></td><td class='covered-line'><pre>1.35M</pre></td><td class='code'><pre> // down here after the min/max restriction.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4362' href='#L_COMPARES_4362'><pre>4362</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = I.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4363' href='#L_COMPARES_4363'><pre>4363</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4364' href='#L_COMPARES_4364'><pre>4364</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(C))<span class='tooltip-content'>1.33M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>710k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4365' href='#L_COMPARES_4365'><pre>4365</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> // For i32: x >u 2147483647 -> x <s 0 -> true if sign bit set</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4366' href='#L_COMPARES_4366'><pre>4366</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_UGT && <span class='tooltip-content'>710k</span></div><div class='tooltip'>C->isMaxSignedValue()<span class='tooltip-content'>18.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4367' href='#L_COMPARES_4367'><pre>4367</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> Constant *Zero = Constant::getNullValue(Op0->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4368' href='#L_COMPARES_4368'><pre>4368</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SLT, Op0, Zero);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4369' href='#L_COMPARES_4369'><pre>4369</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4370' href='#L_COMPARES_4370'><pre>4370</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4371' href='#L_COMPARES_4371'><pre>4371</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> // For i32: x <u 2147483648 -> x >s -1 -> true if sign bit clear</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4372' href='#L_COMPARES_4372'><pre>4372</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>710k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT && <span class='tooltip-content'>710k</span></div><div class='tooltip'>C->isMinSignedValue()<span class='tooltip-content'>29.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>66</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4373' href='#L_COMPARES_4373'><pre>4373</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> Constant *AllOnes = Constant::getAllOnesValue(Op0->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4374' href='#L_COMPARES_4374'><pre>4374</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> return new ICmpInst(ICmpInst::ICMP_SGT, Op0, AllOnes);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4375' href='#L_COMPARES_4375'><pre>4375</pre></a></td><td class='covered-line'><pre>66</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4376' href='#L_COMPARES_4376'><pre>4376</pre></a></td><td class='covered-line'><pre>710k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4377' href='#L_COMPARES_4377'><pre>4377</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4378' href='#L_COMPARES_4378'><pre>4378</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.33M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.33M</span></div> = foldICmpInstWithConstant(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4379' href='#L_COMPARES_4379'><pre>4379</pre></a></td><td class='covered-line'><pre>4.30k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4380' href='#L_COMPARES_4380'><pre>4380</pre></a></td><td class='covered-line'><pre>1.33M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4381' href='#L_COMPARES_4381'><pre>4381</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.32M</span></div> = foldICmpInstWithConstantNotInt(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4382' href='#L_COMPARES_4382'><pre>4382</pre></a></td><td class='covered-line'><pre>2.05k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4383' href='#L_COMPARES_4383'><pre>4383</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4384' href='#L_COMPARES_4384'><pre>4384</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4385' href='#L_COMPARES_4385'><pre>4385</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (GEPOperator *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>GEP<span class='tooltip-content'>1.32M</span></div> = dyn_cast<GEPOperator>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4386' href='#L_COMPARES_4386'><pre>4386</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>18.2k</span></div><div class='tooltip'>NI<span class='tooltip-content'>18.2k</span></div> = foldGEPICmp(GEP, Op1, I.getPredicate(), I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4387' href='#L_COMPARES_4387'><pre>4387</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> return NI;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4388' href='#L_COMPARES_4388'><pre>4388</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (GEPOperator *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>GEP<span class='tooltip-content'>1.32M</span></div> = dyn_cast<GEPOperator>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4389' href='#L_COMPARES_4389'><pre>4389</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>9.84k</span></div><div class='tooltip'>NI<span class='tooltip-content'>9.84k</span></div> = foldGEPICmp(GEP, Op0,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4390' href='#L_COMPARES_4390'><pre>4390</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> ICmpInst::getSwappedPredicate(I.getPredicate()), I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4391' href='#L_COMPARES_4391'><pre>4391</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> return NI;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4392' href='#L_COMPARES_4392'><pre>4392</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4393' href='#L_COMPARES_4393'><pre>4393</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // Try to optimize equality comparisons against alloca-based pointers.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4394' href='#L_COMPARES_4394'><pre>4394</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>Op0->getType()->isPointerTy() && <span class='tooltip-content'>1.32M</span></div><div class='tooltip'>I.isEquality()<span class='tooltip-content'>387k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>370k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4395' href='#L_COMPARES_4395'><pre>4395</pre></a></td><td class='covered-line'><pre>370k</pre></td><td class='code'><pre> assert(Op1->getType()->isPointerTy() && "Comparing pointer with non-pointer?");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4396' href='#L_COMPARES_4396'><pre>4396</pre></a></td><td class='covered-line'><pre>370k</pre></td><td class='code'><pre> if (auto *Alloca = dyn_cast<AllocaInst>(GetUnderlyingObject(Op0, DL)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4397' href='#L_COMPARES_4397'><pre>4397</pre></a></td><td class='covered-line'><pre>219</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>219</span></div><div class='tooltip'>New<span class='tooltip-content'>219</span></div> = foldAllocaCmp(I, Alloca, Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4398' href='#L_COMPARES_4398'><pre>4398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return New</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4399' href='#L_COMPARES_4399'><pre>4399</pre></a></td><td class='covered-line'><pre>370k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>370k</span></div><div class='tooltip'>Alloca<span class='tooltip-content'>370k</span></div> = dyn_cast<AllocaInst>(GetUnderlyingObject(Op1, DL)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4400' href='#L_COMPARES_4400'><pre>4400</pre></a></td><td class='covered-line'><pre>1.62k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.62k</span></div><div class='tooltip'>New<span class='tooltip-content'>1.62k</span></div> = foldAllocaCmp(I, Alloca, Op0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4401' href='#L_COMPARES_4401'><pre>4401</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return New;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4402' href='#L_COMPARES_4402'><pre>4402</pre></a></td><td class='covered-line'><pre>370k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4403' href='#L_COMPARES_4403'><pre>4403</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4404' href='#L_COMPARES_4404'><pre>4404</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // Test to see if the operands of the icmp are casted versions of other</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4405' href='#L_COMPARES_4405'><pre>4405</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // values. If the ptr->ptr cast can be stripped off both arguments, we do so</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4406' href='#L_COMPARES_4406'><pre>4406</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> // now.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4407' href='#L_COMPARES_4407'><pre>4407</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (BitCastInst *<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>CI<span class='tooltip-content'>1.32M</span></div> = dyn_cast<BitCastInst>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>2.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4408' href='#L_COMPARES_4408'><pre>4408</pre></a></td><td class='covered-line'><pre>2.03k</pre></td><td class='code'><pre> if (Op0->getType()->isPointerTy() &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4409' href='#L_COMPARES_4409'><pre>4409</pre></a></td><td class='covered-line'><pre>1.98k</pre></td><td class='code'><pre> <div class='tooltip'>(isa<Constant>(Op1) || <span class='tooltip-content'>1.98k</span></div><div class='tooltip'>isa<BitCastInst>(Op1)<span class='tooltip-content'>120</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>1.87k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4410' href='#L_COMPARES_4410'><pre>4410</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> // We keep moving the cast from the left operand over to the right</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4411' href='#L_COMPARES_4411'><pre>4411</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> // operand, where it can often be eliminated completely.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4412' href='#L_COMPARES_4412'><pre>4412</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> Op0 = CI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4413' href='#L_COMPARES_4413'><pre>4413</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4414' href='#L_COMPARES_4414'><pre>4414</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> // If operand #1 is a bitcast instruction, it must also be a ptr->ptr cast</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4415' href='#L_COMPARES_4415'><pre>4415</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> // so eliminate it as well.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4416' href='#L_COMPARES_4416'><pre>4416</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> if (BitCastInst *CI2 = dyn_cast<BitCastInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4417' href='#L_COMPARES_4417'><pre>4417</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Op1 = CI2->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4418' href='#L_COMPARES_4418'><pre>4418</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4419' href='#L_COMPARES_4419'><pre>4419</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> // If Op1 is a constant, we can fold the cast into the constant.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4420' href='#L_COMPARES_4420'><pre>4420</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0->getType() != Op1->getType()<span class='tooltip-content'>1.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.86k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4421' href='#L_COMPARES_4421'><pre>4421</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>Op1C<span class='tooltip-content'>1.86k</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1.86k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4422' href='#L_COMPARES_4422'><pre>4422</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4423' href='#L_COMPARES_4423'><pre>4423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4424' href='#L_COMPARES_4424'><pre>4424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, cast the RHS right before the icmp</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4425' href='#L_COMPARES_4425'><pre>4425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1 = Builder->CreateBitCast(Op1, Op0->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4426' href='#L_COMPARES_4426'><pre>4426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4427' href='#L_COMPARES_4427'><pre>4427</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4428' href='#L_COMPARES_4428'><pre>4428</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4429' href='#L_COMPARES_4429'><pre>4429</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4430' href='#L_COMPARES_4430'><pre>4430</pre></a></td><td class='covered-line'><pre>2.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4431' href='#L_COMPARES_4431'><pre>4431</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4432' href='#L_COMPARES_4432'><pre>4432</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.32M</span></div><div class='tooltip'>isa<CastInst>(Op0)<span class='tooltip-content'>1.32M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>29.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4433' href='#L_COMPARES_4433'><pre>4433</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // Handle the special case of: icmp (cast bool to X), <cst></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4434' href='#L_COMPARES_4434'><pre>4434</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // This comes up when you have code like</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4435' href='#L_COMPARES_4435'><pre>4435</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // int X = A < B;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4436' href='#L_COMPARES_4436'><pre>4436</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // if (X) ...</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4437' href='#L_COMPARES_4437'><pre>4437</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // For generality, we handle any zero-extension of any operand comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4438' href='#L_COMPARES_4438'><pre>4438</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> // with a constant or another cast from the same type.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4439' href='#L_COMPARES_4439'><pre>4439</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<Constant>(Op1) || <span class='tooltip-content'>29.4k</span></div><div class='tooltip'>isa<CastInst>(Op1)<span class='tooltip-content'>5.37k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4440' href='#L_COMPARES_4440'><pre>4440</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>27.2k</span></div><div class='tooltip'>R<span class='tooltip-content'>27.2k</span></div> = foldICmpWithCastAndCast(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4441' href='#L_COMPARES_4441'><pre>4441</pre></a></td><td class='covered-line'><pre>11.5k</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4442' href='#L_COMPARES_4442'><pre>4442</pre></a></td><td class='covered-line'><pre>29.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4443' href='#L_COMPARES_4443'><pre>4443</pre></a></td><td class='covered-line'><pre>1.32M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4444' href='#L_COMPARES_4444'><pre>4444</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.31M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.31M</span></div> = foldICmpBinOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4445' href='#L_COMPARES_4445'><pre>4445</pre></a></td><td class='covered-line'><pre>1.22k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4446' href='#L_COMPARES_4446'><pre>4446</pre></a></td><td class='covered-line'><pre>1.31M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4447' href='#L_COMPARES_4447'><pre>4447</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.30M</span></div> = foldICmpWithMinMax(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4448' href='#L_COMPARES_4448'><pre>4448</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4449' href='#L_COMPARES_4449'><pre>4449</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4450' href='#L_COMPARES_4450'><pre>4450</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4451' href='#L_COMPARES_4451'><pre>4451</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4452' href='#L_COMPARES_4452'><pre>4452</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // Transform (A & ~B) == 0 --> (A & B) != 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4453' href='#L_COMPARES_4453'><pre>4453</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // and (A & ~B) != 0 --> (A & B) == 0</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4454' href='#L_COMPARES_4454'><pre>4454</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // if A is a power of 2.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4455' href='#L_COMPARES_4455'><pre>4455</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4456' href='#L_COMPARES_4456'><pre>4456</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> match(Op1, m_Zero()) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4457' href='#L_COMPARES_4457'><pre>4457</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> <div class='tooltip'>isKnownToBeAPowerOfTwo(A, DL, false, 0, &AC, &I, &DT)<span class='tooltip-content'>3</span></div> && <div class='tooltip'><span class='red'>I.isEquality()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4458' href='#L_COMPARES_4458'><pre>4458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(I.getInversePredicate(),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4459' href='#L_COMPARES_4459'><pre>4459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateAnd(A, B),</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4460' href='#L_COMPARES_4460'><pre>4460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4461' href='#L_COMPARES_4461'><pre>4461</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4462' href='#L_COMPARES_4462'><pre>4462</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // ~x < ~y --> y < x</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4463' href='#L_COMPARES_4463'><pre>4463</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // ~x < cst --> ~cst < x</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4464' href='#L_COMPARES_4464'><pre>4464</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op0, m_Not(m_Value(A)))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>23</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4465' href='#L_COMPARES_4465'><pre>4465</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> if (match(Op1, m_Not(m_Value(B))))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4466' href='#L_COMPARES_4466'><pre>4466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ICmpInst(I.getPredicate(), B, A)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4467' href='#L_COMPARES_4467'><pre>4467</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>23</span></div><div class='tooltip'>RHSC<span class='tooltip-content'>23</span></div> = dyn_cast<ConstantInt>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4468' href='#L_COMPARES_4468'><pre>4468</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> return new ICmpInst(I.getPredicate(), ConstantExpr::getNot(RHSC), A);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4469' href='#L_COMPARES_4469'><pre>4469</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4470' href='#L_COMPARES_4470'><pre>4470</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4471' href='#L_COMPARES_4471'><pre>4471</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Instruction *AddI = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4472' href='#L_COMPARES_4472'><pre>4472</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (match(&I, m_UAddWithOverflow(m_Value(A), m_Value(B),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4473' href='#L_COMPARES_4473'><pre>4473</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> m_Instruction(AddI))) &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4474' href='#L_COMPARES_4474'><pre>4474</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> <div class='tooltip'>isa<IntegerType>(A->getType())<span class='tooltip-content'>139</span></div>) <div class='tooltip'>{<span class='tooltip-content'>139</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4475' href='#L_COMPARES_4475'><pre>4475</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> Value *Result;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4476' href='#L_COMPARES_4476'><pre>4476</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> Constant *Overflow;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4477' href='#L_COMPARES_4477'><pre>4477</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> if (OptimizeOverflowCheck(OCF_UNSIGNED_ADD, A, B, *AddI, Result,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4478' href='#L_COMPARES_4478'><pre>4478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Overflow)) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4479' href='#L_COMPARES_4479'><pre>4479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replaceInstUsesWith(*AddI, Result);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4480' href='#L_COMPARES_4480'><pre>4480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Overflow);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4481' href='#L_COMPARES_4481'><pre>4481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4482' href='#L_COMPARES_4482'><pre>4482</pre></a></td><td class='covered-line'><pre>139</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4483' href='#L_COMPARES_4483'><pre>4483</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4484' href='#L_COMPARES_4484'><pre>4484</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // (zext a) * (zext b) --> llvm.umul.with.overflow.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4485' href='#L_COMPARES_4485'><pre>4485</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op0, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4486' href='#L_COMPARES_4486'><pre>4486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>R</span><span class='red'> = processUMulZExtIdiom(I, Op0, Op1, *this))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4487' href='#L_COMPARES_4487'><pre>4487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return R</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4488' href='#L_COMPARES_4488'><pre>4488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4489' href='#L_COMPARES_4489'><pre>4489</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op1, m_Mul(m_ZExt(m_Value(A)), m_ZExt(m_Value(B))))<span class='tooltip-content'>1.30M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4490' href='#L_COMPARES_4490'><pre>4490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>R</span><span class='red'> = processUMulZExtIdiom(I, Op1, Op0, *this))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4491' href='#L_COMPARES_4491'><pre>4491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return R</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4492' href='#L_COMPARES_4492'><pre>4492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4493' href='#L_COMPARES_4493'><pre>4493</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4494' href='#L_COMPARES_4494'><pre>4494</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4495' href='#L_COMPARES_4495'><pre>4495</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>Res<span class='tooltip-content'>1.30M</span></div> = foldICmpEquality(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4496' href='#L_COMPARES_4496'><pre>4496</pre></a></td><td class='covered-line'><pre>31</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4497' href='#L_COMPARES_4497'><pre>4497</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4498' href='#L_COMPARES_4498'><pre>4498</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // The 'cmpxchg' instruction returns an aggregate containing the old value and</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4499' href='#L_COMPARES_4499'><pre>4499</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // an i1 which indicates whether or not we successfully did the swap.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4500' href='#L_COMPARES_4500'><pre>4500</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4501' href='#L_COMPARES_4501'><pre>4501</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // Replace comparisons between the old value and the expected value with the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4502' href='#L_COMPARES_4502'><pre>4502</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // indicator that 'cmpxchg' returns.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4503' href='#L_COMPARES_4503'><pre>4503</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4504' href='#L_COMPARES_4504'><pre>4504</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // N.B. This transform is only valid when the 'cmpxchg' is not permitted to</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4505' href='#L_COMPARES_4505'><pre>4505</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // spuriously fail. In those cases, the old value may equal the expected</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4506' href='#L_COMPARES_4506'><pre>4506</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // value but it is possible for the swap to not occur.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4507' href='#L_COMPARES_4507'><pre>4507</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>I.getPredicate() == ICmpInst::ICMP_EQ<span class='tooltip-content'>1.30M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4508' href='#L_COMPARES_4508'><pre>4508</pre></a></td><td class='covered-line'><pre>893k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>893k</span></div><div class='tooltip'>EVI<span class='tooltip-content'>893k</span></div> = dyn_cast<ExtractValueInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4509' href='#L_COMPARES_4509'><pre>4509</pre></a></td><td class='covered-line'><pre>559</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>559</span></div><div class='tooltip'>ACXI<span class='tooltip-content'>559</span></div> = dyn_cast<AtomicCmpXchgInst>(EVI->getAggregateOperand()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4510' href='#L_COMPARES_4510'><pre>4510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>EVI->getIndices()[0] == 0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>ACXI->getCompareOperand() == Op1</span><span class='tooltip-content'>0</span></div><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4511' href='#L_COMPARES_4511'><pre>4511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!ACXI->isWeak()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4512' href='#L_COMPARES_4512'><pre>4512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ExtractValueInst::Create(ACXI, 1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4513' href='#L_COMPARES_4513'><pre>4513</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4514' href='#L_COMPARES_4514'><pre>4514</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4515' href='#L_COMPARES_4515'><pre>4515</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> Value *X; ConstantInt *Cst;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4516' href='#L_COMPARES_4516'><pre>4516</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // icmp X+Cst, X</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4517' href='#L_COMPARES_4517'><pre>4517</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Add(m_Value(X), m_ConstantInt(Cst))) && <span class='tooltip-content'>1.30M</span></div><div class='tooltip'>Op1 == X<span class='tooltip-content'>135k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4518' href='#L_COMPARES_4518'><pre>4518</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return foldICmpAddOpConst(I, X, Cst, I.getPredicate());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4519' href='#L_COMPARES_4519'><pre>4519</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4520' href='#L_COMPARES_4520'><pre>4520</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> // icmp X, X+Cst</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4521' href='#L_COMPARES_4521'><pre>4521</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.30M</span></div><div class='tooltip'>match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && <span class='tooltip-content'>1.30M</span></div><div class='tooltip'>Op0 == X<span class='tooltip-content'>7.90k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4522' href='#L_COMPARES_4522'><pre>4522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return foldICmpAddOpConst(I, X, Cst, I.getSwappedPredicate())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4523' href='#L_COMPARES_4523'><pre>4523</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4524' href='#L_COMPARES_4524'><pre>4524</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>1.30M</span></div><div class='tooltip'>&I<span class='tooltip-content'>5.57k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>1.30M</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4525' href='#L_COMPARES_4525'><pre>4525</pre></a></td><td class='covered-line'><pre>1.30M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4526' href='#L_COMPARES_4526'><pre>4526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4527' href='#L_COMPARES_4527'><pre>4527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold fcmp ([us]itofp x, cst) if possible.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4528' href='#L_COMPARES_4528'><pre>4528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4529' href='#L_COMPARES_4529'><pre>4529</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Constant *RHSC) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4530' href='#L_COMPARES_4530'><pre>4530</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<ConstantFP>(RHSC)<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4531' href='#L_COMPARES_4531'><pre>4531</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> const APFloat &RHS = cast<ConstantFP>(RHSC)->getValueAPF();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4532' href='#L_COMPARES_4532'><pre>4532</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4533' href='#L_COMPARES_4533'><pre>4533</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Get the width of the mantissa. We don't want to hack on conversions that</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4534' href='#L_COMPARES_4534'><pre>4534</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // might lose information from the integer, e.g. "i64 -> float"</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4535' href='#L_COMPARES_4535'><pre>4535</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> int MantissaWidth = LHSI->getType()->getFPMantissaWidth();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4536' href='#L_COMPARES_4536'><pre>4536</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>MantissaWidth == -1<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>; // Unknown.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4537' href='#L_COMPARES_4537'><pre>4537</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4538' href='#L_COMPARES_4538'><pre>4538</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> IntegerType *IntTy = cast<IntegerType>(LHSI->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4539' href='#L_COMPARES_4539'><pre>4539</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4540' href='#L_COMPARES_4540'><pre>4540</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> bool LHSUnsigned = isa<UIToFPInst>(LHSI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4541' href='#L_COMPARES_4541'><pre>4541</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4542' href='#L_COMPARES_4542'><pre>4542</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>I.isEquality()<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4543' href='#L_COMPARES_4543'><pre>4543</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> FCmpInst::Predicate P = I.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4544' href='#L_COMPARES_4544'><pre>4544</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> bool IsExact = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4545' href='#L_COMPARES_4545'><pre>4545</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APSInt RHSCvt(IntTy->getBitWidth(), LHSUnsigned);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4546' href='#L_COMPARES_4546'><pre>4546</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> RHS.convertToInteger(RHSCvt, APFloat::rmNearestTiesToEven, &IsExact);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4547' href='#L_COMPARES_4547'><pre>4547</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4548' href='#L_COMPARES_4548'><pre>4548</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // If the floating point constant isn't an integer value, we know if we will</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4549' href='#L_COMPARES_4549'><pre>4549</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // ever compare equal / not equal to it.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4550' href='#L_COMPARES_4550'><pre>4550</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>!IsExact<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4551' href='#L_COMPARES_4551'><pre>4551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Can never be -0.0 and other non-representable values</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4552' href='#L_COMPARES_4552'><pre>4552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat RHSRoundInt(RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4553' href='#L_COMPARES_4553'><pre>4553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHSRoundInt.roundToIntegral(APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4554' href='#L_COMPARES_4554'><pre>4554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>RHS.compare(RHSRoundInt) != APFloat::cmpEqual</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4555' href='#L_COMPARES_4555'><pre>4555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>P == FCmpInst::FCMP_OEQ || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>P == FCmpInst::FCMP_UEQ</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4556' href='#L_COMPARES_4556'><pre>4556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4557' href='#L_COMPARES_4557'><pre>4557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4558' href='#L_COMPARES_4558'><pre>4558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert</span><span class='red'>(P == FCmpInst::FCMP_ONE || P == FCmpInst::FCMP_UNE);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4559' href='#L_COMPARES_4559'><pre>4559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4560' href='#L_COMPARES_4560'><pre>4560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4561' href='#L_COMPARES_4561'><pre>4561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4562' href='#L_COMPARES_4562'><pre>4562</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4563' href='#L_COMPARES_4563'><pre>4563</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // TODO: If the constant is exactly representable, is it always OK to do</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4564' href='#L_COMPARES_4564'><pre>4564</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // equality compares as integer?</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4565' href='#L_COMPARES_4565'><pre>4565</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4566' href='#L_COMPARES_4566'><pre>4566</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4567' href='#L_COMPARES_4567'><pre>4567</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Check to see that the input is converted from an integer type that is small</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4568' href='#L_COMPARES_4568'><pre>4568</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // enough that preserves all bits. TODO: check here for "known" sign bits.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4569' href='#L_COMPARES_4569'><pre>4569</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // This would allow us to handle (fptosi (x >>s 62) to float) if x is i64 f.e.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4570' href='#L_COMPARES_4570'><pre>4570</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned InputSize = IntTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4571' href='#L_COMPARES_4571'><pre>4571</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4572' href='#L_COMPARES_4572'><pre>4572</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Following test does NOT adjust InputSize downwards for signed inputs,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4573' href='#L_COMPARES_4573'><pre>4573</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // because the most negative value still requires all the mantissa bits</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4574' href='#L_COMPARES_4574'><pre>4574</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // to distinguish it from one less than that value.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4575' href='#L_COMPARES_4575'><pre>4575</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>(int)InputSize > MantissaWidth<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4576' href='#L_COMPARES_4576'><pre>4576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Conversion would lose accuracy. Check if loss can impact comparison.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4577' href='#L_COMPARES_4577'><pre>4577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Exp = ilogb(RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4578' href='#L_COMPARES_4578'><pre>4578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Exp == APFloat::IEK_Inf</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4579' href='#L_COMPARES_4579'><pre>4579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int MaxExponent = ilogb(APFloat::getLargest(RHS.getSemantics()));</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4580' href='#L_COMPARES_4580'><pre>4580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaxExponent < (int)InputSize - !LHSUnsigned</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4581' href='#L_COMPARES_4581'><pre>4581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Conversion could create infinity.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4582' href='#L_COMPARES_4582'><pre>4582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4583' href='#L_COMPARES_4583'><pre>4583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4584' href='#L_COMPARES_4584'><pre>4584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that if RHS is zero or NaN, then Exp is negative</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4585' href='#L_COMPARES_4585'><pre>4585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // and first condition is trivially false.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4586' href='#L_COMPARES_4586'><pre>4586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>MantissaWidth <= Exp && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Exp <= (int)InputSize - !LHSUnsigned</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4587' href='#L_COMPARES_4587'><pre>4587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Conversion could affect comparison.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4588' href='#L_COMPARES_4588'><pre>4588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4589' href='#L_COMPARES_4589'><pre>4589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4590' href='#L_COMPARES_4590'><pre>4590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4591' href='#L_COMPARES_4591'><pre>4591</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4592' href='#L_COMPARES_4592'><pre>4592</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Otherwise, we can potentially simplify the comparison. We know that it</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4593' href='#L_COMPARES_4593'><pre>4593</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // will always come through as an integer value and we know the constant is</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4594' href='#L_COMPARES_4594'><pre>4594</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // not a NAN (it would have been previously simplified).</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4595' href='#L_COMPARES_4595'><pre>4595</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> assert(!RHS.isNaN() && "NaN comparison not already folded!");</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4596' href='#L_COMPARES_4596'><pre>4596</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4597' href='#L_COMPARES_4597'><pre>4597</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> ICmpInst::Predicate Pred;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4598' href='#L_COMPARES_4598'><pre>4598</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> switch (I.getPredicate()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4599' href='#L_COMPARES_4599'><pre>4599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unexpected predicate!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4600' href='#L_COMPARES_4600'><pre>4600</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case FCmpInst::FCMP_UEQ:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4601' href='#L_COMPARES_4601'><pre>4601</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case FCmpInst::FCMP_OEQ:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4602' href='#L_COMPARES_4602'><pre>4602</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Pred = ICmpInst::ICMP_EQ;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4603' href='#L_COMPARES_4603'><pre>4603</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4604' href='#L_COMPARES_4604'><pre>4604</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> case FCmpInst::FCMP_UGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4605' href='#L_COMPARES_4605'><pre>4605</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> case FCmpInst::FCMP_OGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4606' href='#L_COMPARES_4606'><pre>4606</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> Pred = LHSUnsigned ? <div class='tooltip'>ICmpInst::ICMP_UGT<span class='tooltip-content'>5</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4607' href='#L_COMPARES_4607'><pre>4607</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4608' href='#L_COMPARES_4608'><pre>4608</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case FCmpInst::FCMP_UGE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4609' href='#L_COMPARES_4609'><pre>4609</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case FCmpInst::FCMP_OGE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4610' href='#L_COMPARES_4610'><pre>4610</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Pred = LHSUnsigned ? <div class='tooltip'>ICmpInst::ICMP_UGE<span class='tooltip-content'>1</span></div> : <div class='tooltip'><span class='red'>ICmpInst::ICMP_SGE</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4611' href='#L_COMPARES_4611'><pre>4611</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4612' href='#L_COMPARES_4612'><pre>4612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case FCmpInst::FCMP_ULT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4613' href='#L_COMPARES_4613'><pre>4613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OLT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4614' href='#L_COMPARES_4614'><pre>4614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = LHSUnsigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4615' href='#L_COMPARES_4615'><pre>4615</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4616' href='#L_COMPARES_4616'><pre>4616</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_ULE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4617' href='#L_COMPARES_4617'><pre>4617</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OLE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4618' href='#L_COMPARES_4618'><pre>4618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = LHSUnsigned ? </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_ULE</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>ICmpInst::ICMP_SLE</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4619' href='#L_COMPARES_4619'><pre>4619</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4620' href='#L_COMPARES_4620'><pre>4620</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_UNE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4621' href='#L_COMPARES_4621'><pre>4621</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_ONE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4622' href='#L_COMPARES_4622'><pre>4622</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Pred = ICmpInst::ICMP_NE;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4623' href='#L_COMPARES_4623'><pre>4623</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4624' href='#L_COMPARES_4624'><pre>4624</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_ORD:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4625' href='#L_COMPARES_4625'><pre>4625</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4626' href='#L_COMPARES_4626'><pre>4626</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_UNO:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4627' href='#L_COMPARES_4627'><pre>4627</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Builder->getFalse())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4628' href='#L_COMPARES_4628'><pre>4628</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4629' href='#L_COMPARES_4629'><pre>4629</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4630' href='#L_COMPARES_4630'><pre>4630</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Now we know that the APFloat is a normal number, zero or inf.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4631' href='#L_COMPARES_4631'><pre>4631</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4632' href='#L_COMPARES_4632'><pre>4632</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // See if the FP constant is too large for the integer. For example,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4633' href='#L_COMPARES_4633'><pre>4633</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // comparing an i8 to 300.0.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4634' href='#L_COMPARES_4634'><pre>4634</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned IntWidth = IntTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4635' href='#L_COMPARES_4635'><pre>4635</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4636' href='#L_COMPARES_4636'><pre>4636</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHSUnsigned<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4637' href='#L_COMPARES_4637'><pre>4637</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If the RHS value is > SignedMax, fold the comparison. This handles +INF</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4638' href='#L_COMPARES_4638'><pre>4638</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // and large values.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4639' href='#L_COMPARES_4639'><pre>4639</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> APFloat SMax(RHS.getSemantics());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4640' href='#L_COMPARES_4640'><pre>4640</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> SMax.convertFromAPInt(APInt::getSignedMaxValue(IntWidth), true,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4641' href='#L_COMPARES_4641'><pre>4641</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> APFloat::rmNearestTiesToEven);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4642' href='#L_COMPARES_4642'><pre>4642</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>SMax.compare(RHS) == APFloat::cmpLessThan<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>{ // smax < 13123.0</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4643' href='#L_COMPARES_4643'><pre>4643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SLT</span><span class='tooltip-content'>0</span></div><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4644' href='#L_COMPARES_4644'><pre>4644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred == ICmpInst::ICMP_SLE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4645' href='#L_COMPARES_4645'><pre>4645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4646' href='#L_COMPARES_4646'><pre>4646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4647' href='#L_COMPARES_4647'><pre>4647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4648' href='#L_COMPARES_4648'><pre>4648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4649' href='#L_COMPARES_4649'><pre>4649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the RHS value is > UnsignedMax, fold the comparison. This handles</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4650' href='#L_COMPARES_4650'><pre>4650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // +INF and large values.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4651' href='#L_COMPARES_4651'><pre>4651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat UMax(RHS.getSemantics());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4652' href='#L_COMPARES_4652'><pre>4652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UMax.convertFromAPInt(APInt::getMaxValue(IntWidth), false,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4653' href='#L_COMPARES_4653'><pre>4653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4654' href='#L_COMPARES_4654'><pre>4654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>UMax.compare(RHS) == APFloat::cmpLessThan</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // umax < 13123.0</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4655' href='#L_COMPARES_4655'><pre>4655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4656' href='#L_COMPARES_4656'><pre>4656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred == ICmpInst::ICMP_ULE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4657' href='#L_COMPARES_4657'><pre>4657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4658' href='#L_COMPARES_4658'><pre>4658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4659' href='#L_COMPARES_4659'><pre>4659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4660' href='#L_COMPARES_4660'><pre>4660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4661' href='#L_COMPARES_4661'><pre>4661</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4662' href='#L_COMPARES_4662'><pre>4662</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7</span></div><div class='tooltip'>!LHSUnsigned<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4663' href='#L_COMPARES_4663'><pre>4663</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // See if the RHS value is < SignedMin.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4664' href='#L_COMPARES_4664'><pre>4664</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> APFloat SMin(RHS.getSemantics());</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4665' href='#L_COMPARES_4665'><pre>4665</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> SMin.convertFromAPInt(APInt::getSignedMinValue(IntWidth), true,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4666' href='#L_COMPARES_4666'><pre>4666</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> APFloat::rmNearestTiesToEven);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4667' href='#L_COMPARES_4667'><pre>4667</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>SMin.compare(RHS) == APFloat::cmpGreaterThan<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>{ // smin > 12312.0</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4668' href='#L_COMPARES_4668'><pre>4668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_SGT</span><span class='tooltip-content'>0</span></div><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4669' href='#L_COMPARES_4669'><pre>4669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred == ICmpInst::ICMP_SGE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4670' href='#L_COMPARES_4670'><pre>4670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4671' href='#L_COMPARES_4671'><pre>4671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4672' href='#L_COMPARES_4672'><pre>4672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4673' href='#L_COMPARES_4673'><pre>4673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4674' href='#L_COMPARES_4674'><pre>4674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // See if the RHS value is < UnsignedMin.</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4675' href='#L_COMPARES_4675'><pre>4675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat SMin(RHS.getSemantics());</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4676' href='#L_COMPARES_4676'><pre>4676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SMin.convertFromAPInt(APInt::getMinValue(IntWidth), true,</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4677' href='#L_COMPARES_4677'><pre>4677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4678' href='#L_COMPARES_4678'><pre>4678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SMin.compare(RHS) == APFloat::cmpGreaterThan</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // umin > 12312.0</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4679' href='#L_COMPARES_4679'><pre>4679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_NE || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Pred == ICmpInst::ICMP_UGT</span><span class='tooltip-content'>0</span></div><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4680' href='#L_COMPARES_4680'><pre>4680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred == ICmpInst::ICMP_UGE</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4681' href='#L_COMPARES_4681'><pre>4681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4682' href='#L_COMPARES_4682'><pre>4682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4683' href='#L_COMPARES_4683'><pre>4683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4684' href='#L_COMPARES_4684'><pre>4684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4685' href='#L_COMPARES_4685'><pre>4685</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4686' href='#L_COMPARES_4686'><pre>4686</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Okay, now we know that the FP constant fits in the range [SMIN, SMAX] or</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4687' href='#L_COMPARES_4687'><pre>4687</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // [0, UMAX], but it may still be fractional. See if it is fractional by</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4688' href='#L_COMPARES_4688'><pre>4688</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // casting the FP value to the integer value and back, checking for equality.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4689' href='#L_COMPARES_4689'><pre>4689</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Don't do this for zero, because -0.0 is not fractional.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4690' href='#L_COMPARES_4690'><pre>4690</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Constant *RHSInt = LHSUnsigned</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4691' href='#L_COMPARES_4691'><pre>4691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> ? <span class='red'>ConstantExpr::getFPToUI(RHSC, IntTy)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4692' href='#L_COMPARES_4692'><pre>4692</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> : ConstantExpr::getFPToSI(RHSC, IntTy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4693' href='#L_COMPARES_4693'><pre>4693</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>!RHS.isZero()<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4694' href='#L_COMPARES_4694'><pre>4694</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> bool Equal = LHSUnsigned</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4695' href='#L_COMPARES_4695'><pre>4695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> ? <span class='red'>ConstantExpr::getUIToFP(RHSInt, RHSC->getType()) == RHSC</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4696' href='#L_COMPARES_4696'><pre>4696</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> : ConstantExpr::getSIToFP(RHSInt, RHSC->getType()) == RHSC;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4697' href='#L_COMPARES_4697'><pre>4697</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (<div class='tooltip'>!Equal<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4698' href='#L_COMPARES_4698'><pre>4698</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // If we had a comparison against a fractional value, we have to adjust</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4699' href='#L_COMPARES_4699'><pre>4699</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // the compare predicate and sometimes the value. RHSC is rounded towards</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4700' href='#L_COMPARES_4700'><pre>4700</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // zero at this point.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4701' href='#L_COMPARES_4701'><pre>4701</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> switch (Pred) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4702' href='#L_COMPARES_4702'><pre>4702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unexpected integer comparison!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4703' href='#L_COMPARES_4703'><pre>4703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_NE: // (float)int != 4.4 --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4704' href='#L_COMPARES_4704'><pre>4704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4705' href='#L_COMPARES_4705'><pre>4705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_EQ: // (float)int == 4.4 --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4706' href='#L_COMPARES_4706'><pre>4706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4707' href='#L_COMPARES_4707'><pre>4707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4708' href='#L_COMPARES_4708'><pre>4708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int <= 4.4 --> int <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4709' href='#L_COMPARES_4709'><pre>4709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int <= -4.4 --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4710' href='#L_COMPARES_4710'><pre>4710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4711' href='#L_COMPARES_4711'><pre>4711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4712' href='#L_COMPARES_4712'><pre>4712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4713' href='#L_COMPARES_4713'><pre>4713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4714' href='#L_COMPARES_4714'><pre>4714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int <= 4.4 --> int <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4715' href='#L_COMPARES_4715'><pre>4715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int <= -4.4 --> int < -4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4716' href='#L_COMPARES_4716'><pre>4716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4717' href='#L_COMPARES_4717'><pre>4717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_SLT</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4718' href='#L_COMPARES_4718'><pre>4718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4719' href='#L_COMPARES_4719'><pre>4719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_ULT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4720' href='#L_COMPARES_4720'><pre>4720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int < -4.4 --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4721' href='#L_COMPARES_4721'><pre>4721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int < 4.4 --> int <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4722' href='#L_COMPARES_4722'><pre>4722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4723' href='#L_COMPARES_4723'><pre>4723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getFalse())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4724' href='#L_COMPARES_4724'><pre>4724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_ULE;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4725' href='#L_COMPARES_4725'><pre>4725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4726' href='#L_COMPARES_4726'><pre>4726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SLT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4727' href='#L_COMPARES_4727'><pre>4727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int < -4.4 --> int < -4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4728' href='#L_COMPARES_4728'><pre>4728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int < 4.4 --> int <= 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4729' href='#L_COMPARES_4729'><pre>4729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4730' href='#L_COMPARES_4730'><pre>4730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_SLE</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4731' href='#L_COMPARES_4731'><pre>4731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4732' href='#L_COMPARES_4732'><pre>4732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4733' href='#L_COMPARES_4733'><pre>4733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int > 4.4 --> int > 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4734' href='#L_COMPARES_4734'><pre>4734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int > -4.4 --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4735' href='#L_COMPARES_4735'><pre>4735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4736' href='#L_COMPARES_4736'><pre>4736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4737' href='#L_COMPARES_4737'><pre>4737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4738' href='#L_COMPARES_4738'><pre>4738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_SGT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4739' href='#L_COMPARES_4739'><pre>4739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int > 4.4 --> int > 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4740' href='#L_COMPARES_4740'><pre>4740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int > -4.4 --> int >= -4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4741' href='#L_COMPARES_4741'><pre>4741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4742' href='#L_COMPARES_4742'><pre>4742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_SGE</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4743' href='#L_COMPARES_4743'><pre>4743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4744' href='#L_COMPARES_4744'><pre>4744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case ICmpInst::ICMP_UGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4745' href='#L_COMPARES_4745'><pre>4745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int >= -4.4 --> true</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4746' href='#L_COMPARES_4746'><pre>4746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (float)int >= 4.4 --> int > 4</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4747' href='#L_COMPARES_4747'><pre>4747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS.isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4748' href='#L_COMPARES_4748'><pre>4748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, Builder->getTrue())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4749' href='#L_COMPARES_4749'><pre>4749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Pred = ICmpInst::ICMP_UGT;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4750' href='#L_COMPARES_4750'><pre>4750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4751' href='#L_COMPARES_4751'><pre>4751</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case ICmpInst::ICMP_SGE:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4752' href='#L_COMPARES_4752'><pre>4752</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (float)int >= -4.4 --> int >= -4</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4753' href='#L_COMPARES_4753'><pre>4753</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (float)int >= 4.4 --> int > 4</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4754' href='#L_COMPARES_4754'><pre>4754</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (!RHS.isNegative())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4755' href='#L_COMPARES_4755'><pre>4755</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Pred = ICmpInst::ICMP_SGT;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4756' href='#L_COMPARES_4756'><pre>4756</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4757' href='#L_COMPARES_4757'><pre>4757</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4758' href='#L_COMPARES_4758'><pre>4758</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4759' href='#L_COMPARES_4759'><pre>4759</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4760' href='#L_COMPARES_4760'><pre>4760</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4761' href='#L_COMPARES_4761'><pre>4761</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Lower this FP comparison into an appropriate integer version of the</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4762' href='#L_COMPARES_4762'><pre>4762</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // comparison.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4763' href='#L_COMPARES_4763'><pre>4763</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return new ICmpInst(Pred, LHSI->getOperand(0), RHSInt);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4764' href='#L_COMPARES_4764'><pre>4764</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4765' href='#L_COMPARES_4765'><pre>4765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4766' href='#L_COMPARES_4766'><pre>4766</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4767' href='#L_COMPARES_4767'><pre>4767</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> bool Changed = false;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4768' href='#L_COMPARES_4768'><pre>4768</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4769' href='#L_COMPARES_4769'><pre>4769</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> /// Orders the operands of the compare so that they are listed from most</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4770' href='#L_COMPARES_4770'><pre>4770</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> /// complex to least complex. This puts constants before unary operators,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4771' href='#L_COMPARES_4771'><pre>4771</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> /// before binary operators.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4772' href='#L_COMPARES_4772'><pre>4772</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>getComplexity(I.getOperand(0)) < getComplexity(I.getOperand(1))<span class='tooltip-content'>35.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>144</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4773' href='#L_COMPARES_4773'><pre>4773</pre></a></td><td class='covered-line'><pre>144</pre></td><td class='code'><pre> I.swapOperands();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4774' href='#L_COMPARES_4774'><pre>4774</pre></a></td><td class='covered-line'><pre>144</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4775' href='#L_COMPARES_4775'><pre>4775</pre></a></td><td class='covered-line'><pre>144</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4776' href='#L_COMPARES_4776'><pre>4776</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4777' href='#L_COMPARES_4777'><pre>4777</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4778' href='#L_COMPARES_4778'><pre>4778</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4779' href='#L_COMPARES_4779'><pre>4779</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> if (Value *V = SimplifyFCmpInst(I.getPredicate(), Op0, Op1,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4780' href='#L_COMPARES_4780'><pre>4780</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> I.getFastMathFlags(), DL, &TLI, &DT, &AC, &I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4781' href='#L_COMPARES_4781'><pre>4781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4782' href='#L_COMPARES_4782'><pre>4782</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4783' href='#L_COMPARES_4783'><pre>4783</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // Simplify 'fcmp pred X, X'</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4784' href='#L_COMPARES_4784'><pre>4784</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>35.9k</span></div><div class='tooltip'>Op0 == Op1<span class='tooltip-content'>35.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4785' href='#L_COMPARES_4785'><pre>4785</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> switch (I.getPredicate()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4786' href='#L_COMPARES_4786'><pre>4786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Unknown predicate!");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4787' href='#L_COMPARES_4787'><pre>4787</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre><span class='red'> </span>case FCmpInst::FCMP_UNO: // True if unordered: isnan(X) | isnan(Y)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4788' href='#L_COMPARES_4788'><pre>4788</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> case FCmpInst::FCMP_ULT: // True if unordered or less than</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4789' href='#L_COMPARES_4789'><pre>4789</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> case FCmpInst::FCMP_UGT: // True if unordered or greater than</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4790' href='#L_COMPARES_4790'><pre>4790</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> case FCmpInst::FCMP_UNE: // True if unordered or not equal</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4791' href='#L_COMPARES_4791'><pre>4791</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> // Canonicalize these to be 'fcmp uno %X, 0.0'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4792' href='#L_COMPARES_4792'><pre>4792</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> I.setPredicate(FCmpInst::FCMP_UNO);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4793' href='#L_COMPARES_4793'><pre>4793</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> I.setOperand(1, Constant::getNullValue(Op0->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4794' href='#L_COMPARES_4794'><pre>4794</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4795' href='#L_COMPARES_4795'><pre>4795</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4796' href='#L_COMPARES_4796'><pre>4796</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case FCmpInst::FCMP_ORD: // True if ordered (no nans)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4797' href='#L_COMPARES_4797'><pre>4797</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case FCmpInst::FCMP_OEQ: // True if ordered and equal</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4798' href='#L_COMPARES_4798'><pre>4798</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case FCmpInst::FCMP_OGE: // True if ordered and greater than or equal</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4799' href='#L_COMPARES_4799'><pre>4799</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> case FCmpInst::FCMP_OLE: // True if ordered and less than or equal</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4800' href='#L_COMPARES_4800'><pre>4800</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Canonicalize these to be 'fcmp ord %X, 0.0'.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4801' href='#L_COMPARES_4801'><pre>4801</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> I.setPredicate(FCmpInst::FCMP_ORD);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4802' href='#L_COMPARES_4802'><pre>4802</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> I.setOperand(1, Constant::getNullValue(Op0->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4803' href='#L_COMPARES_4803'><pre>4803</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4804' href='#L_COMPARES_4804'><pre>4804</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4805' href='#L_COMPARES_4805'><pre>4805</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4806' href='#L_COMPARES_4806'><pre>4806</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4807' href='#L_COMPARES_4807'><pre>4807</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // Test if the FCmpInst instruction is used exclusively by a select as</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4808' href='#L_COMPARES_4808'><pre>4808</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // part of a minimum or maximum operation. If so, refrain from doing</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4809' href='#L_COMPARES_4809'><pre>4809</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // any other folding. This helps out other analyses which understand</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4810' href='#L_COMPARES_4810'><pre>4810</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // non-obfuscated minimum and maximum idioms, such as ScalarEvolution</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4811' href='#L_COMPARES_4811'><pre>4811</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // and CodeGen. And in this case, at least one of the comparison</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4812' href='#L_COMPARES_4812'><pre>4812</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // operands has at least one user besides the compare (the select),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4813' href='#L_COMPARES_4813'><pre>4813</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // which would often largely negate the benefit of folding anyway.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4814' href='#L_COMPARES_4814'><pre>4814</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>35.9k</span></div><div class='tooltip'>I.hasOneUse()<span class='tooltip-content'>35.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4815' href='#L_COMPARES_4815'><pre>4815</pre></a></td><td class='covered-line'><pre>33.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>33.6k</span></div><div class='tooltip'>SI<span class='tooltip-content'>33.6k</span></div> = dyn_cast<SelectInst>(*I.user_begin()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4816' href='#L_COMPARES_4816'><pre>4816</pre></a></td><td class='covered-line'><pre>8.23k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8.23k</span></div><div class='tooltip'>(SI->getOperand(1) == Op0 && <span class='tooltip-content'>8.23k</span></div><div class='tooltip'>SI->getOperand(2) == Op1<span class='tooltip-content'>1.93k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4817' href='#L_COMPARES_4817'><pre>4817</pre></a></td><td class='covered-line'><pre>6.34k</pre></td><td class='code'><pre> <div class='tooltip'>(SI->getOperand(2) == Op0 && <span class='tooltip-content'>6.34k</span></div><div class='tooltip'>SI->getOperand(1) == Op1<span class='tooltip-content'>1.49k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4818' href='#L_COMPARES_4818'><pre>4818</pre></a></td><td class='covered-line'><pre>3.34k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4819' href='#L_COMPARES_4819'><pre>4819</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4820' href='#L_COMPARES_4820'><pre>4820</pre></a></td><td class='covered-line'><pre>35.9k</pre></td><td class='code'><pre> // Handle fcmp with constant RHS</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4821' href='#L_COMPARES_4821'><pre>4821</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>32.6k</span></div><div class='tooltip'>RHSC<span class='tooltip-content'>32.6k</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>14.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4822' href='#L_COMPARES_4822'><pre>4822</pre></a></td><td class='covered-line'><pre>14.2k</pre></td><td class='code'><pre> if (Instruction *LHSI = dyn_cast<Instruction>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4823' href='#L_COMPARES_4823'><pre>4823</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> switch (LHSI->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4824' href='#L_COMPARES_4824'><pre>4824</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> case Instruction::FPExt: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4825' href='#L_COMPARES_4825'><pre>4825</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> // fcmp (fpext x), C -> fcmp x, (fptrunc C) if fptrunc is lossless</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4826' href='#L_COMPARES_4826'><pre>4826</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> FPExtInst *LHSExt = cast<FPExtInst>(LHSI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4827' href='#L_COMPARES_4827'><pre>4827</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> ConstantFP *RHSF = dyn_cast<ConstantFP>(RHSC);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4828' href='#L_COMPARES_4828'><pre>4828</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> if (!RHSF)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4829' href='#L_COMPARES_4829'><pre>4829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4830' href='#L_COMPARES_4830'><pre>4830</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4831' href='#L_COMPARES_4831'><pre>4831</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> const fltSemantics *Sem;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4832' href='#L_COMPARES_4832'><pre>4832</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> // FIXME: This shouldn't be here.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4833' href='#L_COMPARES_4833'><pre>4833</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> if (LHSExt->getSrcTy()->isHalfTy())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4834' href='#L_COMPARES_4834'><pre>4834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Sem = &APFloat::IEEEhalf()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4835' href='#L_COMPARES_4835'><pre>4835</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>224</span></div><div class='tooltip'>LHSExt->getSrcTy()->isFloatTy()<span class='tooltip-content'>224</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4836' href='#L_COMPARES_4836'><pre>4836</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> Sem = &APFloat::IEEEsingle();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4837' href='#L_COMPARES_4837'><pre>4837</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>LHSExt->getSrcTy()->isDoubleTy()<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4838' href='#L_COMPARES_4838'><pre>4838</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Sem = &APFloat::IEEEdouble();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4839' href='#L_COMPARES_4839'><pre>4839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> else <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LHSExt->getSrcTy()->isFP128Ty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4840' href='#L_COMPARES_4840'><pre>4840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Sem = &APFloat::IEEEquad()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4841' href='#L_COMPARES_4841'><pre>4841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LHSExt->getSrcTy()->isX86_FP80Ty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4842' href='#L_COMPARES_4842'><pre>4842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Sem = &APFloat::x87DoubleExtended()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4843' href='#L_COMPARES_4843'><pre>4843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LHSExt->getSrcTy()->isPPC_FP128Ty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4844' href='#L_COMPARES_4844'><pre>4844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Sem = &APFloat::PPCDoubleDouble()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4845' href='#L_COMPARES_4845'><pre>4845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4846' href='#L_COMPARES_4846'><pre>4846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4847' href='#L_COMPARES_4847'><pre>4847</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4848' href='#L_COMPARES_4848'><pre>4848</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> bool Lossy;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4849' href='#L_COMPARES_4849'><pre>4849</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> APFloat F = RHSF->getValueAPF();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4850' href='#L_COMPARES_4850'><pre>4850</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> F.convert(*Sem, APFloat::rmNearestTiesToEven, &Lossy);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4851' href='#L_COMPARES_4851'><pre>4851</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4852' href='#L_COMPARES_4852'><pre>4852</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> // Avoid lossy conversions and denormals. Zero is a special case</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4853' href='#L_COMPARES_4853'><pre>4853</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> // that's OK to convert.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4854' href='#L_COMPARES_4854'><pre>4854</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> APFloat Fabs = F;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4855' href='#L_COMPARES_4855'><pre>4855</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> Fabs.clearSign();</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4856' href='#L_COMPARES_4856'><pre>4856</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> if (!Lossy &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4857' href='#L_COMPARES_4857'><pre>4857</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> ((Fabs.compare(APFloat::getSmallestNormalized(*Sem)) !=</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4858' href='#L_COMPARES_4858'><pre>4858</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> APFloat::cmpLessThan) || Fabs.isZero()))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4859' href='#L_COMPARES_4859'><pre>4859</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4860' href='#L_COMPARES_4860'><pre>4860</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4861' href='#L_COMPARES_4861'><pre>4861</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> ConstantFP::get(RHSC->getContext(), F));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4862' href='#L_COMPARES_4862'><pre>4862</pre></a></td><td class='covered-line'><pre>156</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4863' href='#L_COMPARES_4863'><pre>4863</pre></a></td><td class='covered-line'><pre>224</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4864' href='#L_COMPARES_4864'><pre>4864</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> case Instruction::PHI:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4865' href='#L_COMPARES_4865'><pre>4865</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> // Only fold fcmp into the PHI if the phi and fcmp are in the same</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4866' href='#L_COMPARES_4866'><pre>4866</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> // block. If in the same block, we're encouraging jump threading. If</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4867' href='#L_COMPARES_4867'><pre>4867</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> // not, we are just pessimizing the code by making an i1 phi.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4868' href='#L_COMPARES_4868'><pre>4868</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> if (LHSI->getParent() == I.getParent())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4869' href='#L_COMPARES_4869'><pre>4869</pre></a></td><td class='covered-line'><pre>390</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>390</span></div><div class='tooltip'>NV<span class='tooltip-content'>390</span></div> = FoldOpIntoPhi(I))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4870' href='#L_COMPARES_4870'><pre>4870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return NV</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4871' href='#L_COMPARES_4871'><pre>4871</pre></a></td><td class='covered-line'><pre>772</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4872' href='#L_COMPARES_4872'><pre>4872</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> case Instruction::SIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4873' href='#L_COMPARES_4873'><pre>4873</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> case Instruction::UIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4874' href='#L_COMPARES_4874'><pre>4874</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (Instruction *NV = foldFCmpIntToFPConst(I, LHSI, RHSC))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4875' href='#L_COMPARES_4875'><pre>4875</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4876' href='#L_COMPARES_4876'><pre>4876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4877' href='#L_COMPARES_4877'><pre>4877</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> case Instruction::FSub: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4878' href='#L_COMPARES_4878'><pre>4878</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> // fcmp pred (fneg x), C -> fcmp swap(pred) x, -C</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4879' href='#L_COMPARES_4879'><pre>4879</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> Value *Op;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4880' href='#L_COMPARES_4880'><pre>4880</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> if (match(LHSI, m_FNeg(m_Value(Op))))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4881' href='#L_COMPARES_4881'><pre>4881</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new FCmpInst(I.getSwappedPredicate(), Op,</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4882' href='#L_COMPARES_4882'><pre>4882</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ConstantExpr::getFNeg(RHSC));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4883' href='#L_COMPARES_4883'><pre>4883</pre></a></td><td class='covered-line'><pre>1.66k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4884' href='#L_COMPARES_4884'><pre>4884</pre></a></td><td class='covered-line'><pre>1.67k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4885' href='#L_COMPARES_4885'><pre>4885</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> case Instruction::Load:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4886' href='#L_COMPARES_4886'><pre>4886</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> if (GetElementPtrInst *GEP =</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4887' href='#L_COMPARES_4887'><pre>4887</pre></a></td><td class='covered-line'><pre>3.72k</pre></td><td class='code'><pre> dyn_cast<GetElementPtrInst>(LHSI->getOperand(0))) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4888' href='#L_COMPARES_4888'><pre>4888</pre></a></td><td class='covered-line'><pre>3.72k</pre></td><td class='code'><pre> if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GEP->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4889' href='#L_COMPARES_4889'><pre>4889</pre></a></td><td class='covered-line'><pre>82</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>82</span></div><div class='tooltip'>GV->isConstant() && <span class='tooltip-content'>82</span></div><div class='tooltip'><span class='red'>GV->hasDefinitiveInitializer()</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4890' href='#L_COMPARES_4890'><pre>4890</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!cast<LoadInst>(LHSI)->isVolatile()</span>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4891' href='#L_COMPARES_4891'><pre>4891</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (Instruction *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Res</span><span class='tooltip-content'>0</span></div><span class='red'> = foldCmpLoadFromIndexedGlobal(GEP, GV, I))</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4892' href='#L_COMPARES_4892'><pre>4892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Res</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4893' href='#L_COMPARES_4893'><pre>4893</pre></a></td><td class='covered-line'><pre>3.72k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4894' href='#L_COMPARES_4894'><pre>4894</pre></a></td><td class='covered-line'><pre>4.15k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4895' href='#L_COMPARES_4895'><pre>4895</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> case Instruction::Call: {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4896' href='#L_COMPARES_4896'><pre>4896</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre> if (!RHSC->isNullValue())</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4897' href='#L_COMPARES_4897'><pre>4897</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4898' href='#L_COMPARES_4898'><pre>4898</pre></a></td><td class='covered-line'><pre>2.28k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4899' href='#L_COMPARES_4899'><pre>4899</pre></a></td><td class='covered-line'><pre>769</pre></td><td class='code'><pre> CallInst *CI = cast<CallInst>(LHSI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4900' href='#L_COMPARES_4900'><pre>4900</pre></a></td><td class='covered-line'><pre>769</pre></td><td class='code'><pre> Intrinsic::ID IID = getIntrinsicForCallSite(CI, &TLI);</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4901' href='#L_COMPARES_4901'><pre>4901</pre></a></td><td class='covered-line'><pre>769</pre></td><td class='code'><pre> if (IID != Intrinsic::fabs)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4902' href='#L_COMPARES_4902'><pre>4902</pre></a></td><td class='covered-line'><pre>765</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4903' href='#L_COMPARES_4903'><pre>4903</pre></a></td><td class='covered-line'><pre>769</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4904' href='#L_COMPARES_4904'><pre>4904</pre></a></td><td class='covered-line'><pre>769</pre></td><td class='code'><pre> // Various optimization for fabs compared with zero.</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4905' href='#L_COMPARES_4905'><pre>4905</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> switch (I.getPredicate()) {</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4906' href='#L_COMPARES_4906'><pre>4906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4907' href='#L_COMPARES_4907'><pre>4907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4908' href='#L_COMPARES_4908'><pre>4908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) < 0 --> false</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4909' href='#L_COMPARES_4909'><pre>4909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OLT:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4910' href='#L_COMPARES_4910'><pre>4910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("handled by SimplifyFCmpInst");</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4911' href='#L_COMPARES_4911'><pre>4911</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) > 0 --> x != 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4912' href='#L_COMPARES_4912'><pre>4912</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre><span class='red'> </span>case FCmpInst::FCMP_OGT:</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4913' href='#L_COMPARES_4913'><pre>4913</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return new FCmpInst(FCmpInst::FCMP_ONE, CI->getArgOperand(0), RHSC)<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4914' href='#L_COMPARES_4914'><pre>4914</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) <= 0 --> x == 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4915' href='#L_COMPARES_4915'><pre>4915</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OLE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4916' href='#L_COMPARES_4916'><pre>4916</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new FCmpInst(FCmpInst::FCMP_OEQ, CI->getArgOperand(0), RHSC)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4917' href='#L_COMPARES_4917'><pre>4917</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) >= 0 --> !isnan(x)</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4918' href='#L_COMPARES_4918'><pre>4918</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OGE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4919' href='#L_COMPARES_4919'><pre>4919</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new FCmpInst(FCmpInst::FCMP_ORD, CI->getArgOperand(0), RHSC)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4920' href='#L_COMPARES_4920'><pre>4920</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) == 0 --> x == 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4921' href='#L_COMPARES_4921'><pre>4921</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(x) != 0 --> x != 0</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4922' href='#L_COMPARES_4922'><pre>4922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_OEQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4923' href='#L_COMPARES_4923'><pre>4923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_UEQ:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4924' href='#L_COMPARES_4924'><pre>4924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_ONE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4925' href='#L_COMPARES_4925'><pre>4925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case FCmpInst::FCMP_UNE:</span></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4926' href='#L_COMPARES_4926'><pre>4926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new FCmpInst(I.getPredicate(), CI->getArgOperand(0), RHSC)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4927' href='#L_COMPARES_4927'><pre>4927</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4928' href='#L_COMPARES_4928'><pre>4928</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4929' href='#L_COMPARES_4929'><pre>4929</pre></a></td><td class='covered-line'><pre>13.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4930' href='#L_COMPARES_4930'><pre>4930</pre></a></td><td class='covered-line'><pre>14.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4931' href='#L_COMPARES_4931'><pre>4931</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4932' href='#L_COMPARES_4932'><pre>4932</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> // fcmp pred (fneg x), (fneg y) -> fcmp swap(pred) x, y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4933' href='#L_COMPARES_4933'><pre>4933</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre> Value *X, *Y;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4934' href='#L_COMPARES_4934'><pre>4934</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_FNeg(m_Value(X))) && <span class='tooltip-content'>32.5k</span></div><div class='tooltip'><span class='red'>match(Op1, m_FNeg(m_Value(Y)))</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4935' href='#L_COMPARES_4935'><pre>4935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new FCmpInst(I.getSwappedPredicate(), X, Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4936' href='#L_COMPARES_4936'><pre>4936</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4937' href='#L_COMPARES_4937'><pre>4937</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre> // fcmp (fpext x), (fpext y) -> fcmp x, y</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4938' href='#L_COMPARES_4938'><pre>4938</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (FPExtInst *<span class='tooltip-content'>32.5k</span></div><div class='tooltip'>LHSExt<span class='tooltip-content'>32.5k</span></div> = dyn_cast<FPExtInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4939' href='#L_COMPARES_4939'><pre>4939</pre></a></td><td class='covered-line'><pre>157</pre></td><td class='code'><pre> <div class='tooltip'>if (FPExtInst *<span class='tooltip-content'>157</span></div><div class='tooltip'>RHSExt<span class='tooltip-content'>157</span></div> = dyn_cast<FPExtInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4940' href='#L_COMPARES_4940'><pre>4940</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>LHSExt->getSrcTy() == RHSExt->getSrcTy()<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4941' href='#L_COMPARES_4941'><pre>4941</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4942' href='#L_COMPARES_4942'><pre>4942</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> RHSExt->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4943' href='#L_COMPARES_4943'><pre>4943</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4944' href='#L_COMPARES_4944'><pre>4944</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>32.5k</span></div><div class='tooltip'>&I<span class='tooltip-content'>135</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>32.4k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_COMPARES_4945' href='#L_COMPARES_4945'><pre>4945</pre></a></td><td class='covered-line'><pre>32.5k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='ALLOCA' href='#ALLOCA'>lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_ALLOCA_74'>jump to first uncovered line</a>)</pre></td></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1' href='#L_ALLOCA_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineLoadStoreAlloca.cpp -------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_2' href='#L_ALLOCA_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_3' href='#L_ALLOCA_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_4' href='#L_ALLOCA_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_5' href='#L_ALLOCA_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_6' href='#L_ALLOCA_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_7' href='#L_ALLOCA_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_8' href='#L_ALLOCA_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_9' href='#L_ALLOCA_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_10' href='#L_ALLOCA_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visit functions for load, store and alloca.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_11' href='#L_ALLOCA_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_12' href='#L_ALLOCA_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_13' href='#L_ALLOCA_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_14' href='#L_ALLOCA_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_15' href='#L_ALLOCA_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/MapVector.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_16' href='#L_ALLOCA_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/SmallString.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_17' href='#L_ALLOCA_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/Statistic.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_18' href='#L_ALLOCA_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/Loads.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_19' href='#L_ALLOCA_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/ConstantRange.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_20' href='#L_ALLOCA_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DataLayout.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_21' href='#L_ALLOCA_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DebugInfo.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_22' href='#L_ALLOCA_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_23' href='#L_ALLOCA_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/LLVMContext.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_24' href='#L_ALLOCA_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/MDBuilder.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_25' href='#L_ALLOCA_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/BasicBlockUtils.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_26' href='#L_ALLOCA_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/Local.h"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_27' href='#L_ALLOCA_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_28' href='#L_ALLOCA_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_29' href='#L_ALLOCA_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_30' href='#L_ALLOCA_30'><pre>30</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_31' href='#L_ALLOCA_31'><pre>31</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>STATISTIC(NumDeadStore, "Number of dead stores eliminated");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_32' href='#L_ALLOCA_32'><pre>32</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>STATISTIC(NumGlobalCopies, "Number of allocas copied from constant global");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_33' href='#L_ALLOCA_33'><pre>33</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_34' href='#L_ALLOCA_34'><pre>34</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// pointsToConstantGlobal - Return true if V (possibly indirectly) points to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_35' href='#L_ALLOCA_35'><pre>35</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// some part of a constant global variable. This intentionally only accepts</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_36' href='#L_ALLOCA_36'><pre>36</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant expressions because we can't rewrite arbitrary instructions.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_37' href='#L_ALLOCA_37'><pre>37</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre>static bool pointsToConstantGlobal(Value *V) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_38' href='#L_ALLOCA_38'><pre>38</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_39' href='#L_ALLOCA_39'><pre>39</pre></a></td><td class='covered-line'><pre>660</pre></td><td class='code'><pre> return GV->isConstant();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_40' href='#L_ALLOCA_40'><pre>40</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_41' href='#L_ALLOCA_41'><pre>41</pre></a></td><td class='covered-line'><pre>976</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantExpr *<span class='tooltip-content'>976</span></div><div class='tooltip'>CE<span class='tooltip-content'>976</span></div> = dyn_cast<ConstantExpr>(V)) <div class='tooltip'>{<span class='tooltip-content'>28</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_42' href='#L_ALLOCA_42'><pre>42</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> if (CE->getOpcode() == Instruction::BitCast ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_43' href='#L_ALLOCA_43'><pre>43</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> CE->getOpcode() == Instruction::AddrSpaceCast ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_44' href='#L_ALLOCA_44'><pre>44</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> CE->getOpcode() == Instruction::GetElementPtr)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_45' href='#L_ALLOCA_45'><pre>45</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return pointsToConstantGlobal(CE->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_46' href='#L_ALLOCA_46'><pre>46</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_47' href='#L_ALLOCA_47'><pre>47</pre></a></td><td class='covered-line'><pre>948</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_48' href='#L_ALLOCA_48'><pre>48</pre></a></td><td class='covered-line'><pre>976</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_49' href='#L_ALLOCA_49'><pre>49</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_50' href='#L_ALLOCA_50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// isOnlyCopiedFromConstantGlobal - Recursively walk the uses of a (derived)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_51' href='#L_ALLOCA_51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// pointer to an alloca. Ignore any reads of the pointer, return false if we</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_52' href='#L_ALLOCA_52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// see any stores or other unknown uses. If we see pointer arithmetic, keep</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_53' href='#L_ALLOCA_53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// track of whether it moves the pointer (with IsOffset) but otherwise traverse</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_54' href='#L_ALLOCA_54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the uses. If we see a memcpy/memmove that targets an unoffseted pointer to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_55' href='#L_ALLOCA_55'><pre>55</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the alloca, and if the source pointer is a pointer to a constant global, we</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_56' href='#L_ALLOCA_56'><pre>56</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// can optimize this.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_57' href='#L_ALLOCA_57'><pre>57</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_58' href='#L_ALLOCA_58'><pre>58</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>isOnlyCopiedFromConstantGlobal(Value *V, MemTransferInst *&TheCopy,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_59' href='#L_ALLOCA_59'><pre>59</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> SmallVectorImpl<Instruction *> &ToDelete) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_60' href='#L_ALLOCA_60'><pre>60</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // We track lifetime intrinsics as we encounter them. If we decide to go</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_61' href='#L_ALLOCA_61'><pre>61</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // ahead and replace the value with the global, this lets the caller quickly</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_62' href='#L_ALLOCA_62'><pre>62</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // eliminate the markers.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_63' href='#L_ALLOCA_63'><pre>63</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_64' href='#L_ALLOCA_64'><pre>64</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> SmallVector<std::pair<Value *, bool>, 35> ValuesToInspect;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_65' href='#L_ALLOCA_65'><pre>65</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> ValuesToInspect.emplace_back(V, false);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_66' href='#L_ALLOCA_66'><pre>66</pre></a></td><td class='covered-line'><pre>244k</pre></td><td class='code'><pre> while (<div class='tooltip'>!ValuesToInspect.empty()<span class='tooltip-content'>244k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>243k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_67' href='#L_ALLOCA_67'><pre>67</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> auto ValuePair = ValuesToInspect.pop_back_val();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_68' href='#L_ALLOCA_68'><pre>68</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> const bool IsOffset = ValuePair.second;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_69' href='#L_ALLOCA_69'><pre>69</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> for (auto &U : ValuePair.first->uses()) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_70' href='#L_ALLOCA_70'><pre>70</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> auto *I = cast<Instruction>(U.getUser());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_71' href='#L_ALLOCA_71'><pre>71</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_72' href='#L_ALLOCA_72'><pre>72</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>LI<span class='tooltip-content'>670k</span></div> = dyn_cast<LoadInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>42.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_73' href='#L_ALLOCA_73'><pre>73</pre></a></td><td class='covered-line'><pre>42.8k</pre></td><td class='code'><pre> // Ignore non-volatile loads, they are always ok.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_74' href='#L_ALLOCA_74'><pre>74</pre></a></td><td class='covered-line'><pre>42.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LI->isSimple()<span class='tooltip-content'>42.8k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_75' href='#L_ALLOCA_75'><pre>75</pre></a></td><td class='covered-line'><pre>42.8k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_76' href='#L_ALLOCA_76'><pre>76</pre></a></td><td class='covered-line'><pre>42.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_77' href='#L_ALLOCA_77'><pre>77</pre></a></td><td class='covered-line'><pre>670k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_78' href='#L_ALLOCA_78'><pre>78</pre></a></td><td class='covered-line'><pre>627k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>627k</span></div><div class='tooltip'>isa<BitCastInst>(I) || <span class='tooltip-content'>627k</span></div><div class='tooltip'>isa<AddrSpaceCastInst>(I)<span class='tooltip-content'>549k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>77.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_79' href='#L_ALLOCA_79'><pre>79</pre></a></td><td class='covered-line'><pre>77.5k</pre></td><td class='code'><pre> // If uses of the bitcast are ok, we are ok.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_80' href='#L_ALLOCA_80'><pre>80</pre></a></td><td class='covered-line'><pre>77.5k</pre></td><td class='code'><pre> ValuesToInspect.emplace_back(I, IsOffset);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_81' href='#L_ALLOCA_81'><pre>81</pre></a></td><td class='covered-line'><pre>77.5k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_82' href='#L_ALLOCA_82'><pre>82</pre></a></td><td class='covered-line'><pre>77.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_83' href='#L_ALLOCA_83'><pre>83</pre></a></td><td class='covered-line'><pre>549k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>549k</span></div><div class='tooltip'>GEP<span class='tooltip-content'>549k</span></div> = dyn_cast<GetElementPtrInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>324k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_84' href='#L_ALLOCA_84'><pre>84</pre></a></td><td class='covered-line'><pre>324k</pre></td><td class='code'><pre> // If the GEP has all zero indices, it doesn't offset the pointer. If it</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_85' href='#L_ALLOCA_85'><pre>85</pre></a></td><td class='covered-line'><pre>324k</pre></td><td class='code'><pre> // doesn't, it does.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_86' href='#L_ALLOCA_86'><pre>86</pre></a></td><td class='covered-line'><pre>323k</pre></td><td class='code'><pre> ValuesToInspect.emplace_back(I, IsOffset || !GEP->hasAllZeroIndices());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_87' href='#L_ALLOCA_87'><pre>87</pre></a></td><td class='covered-line'><pre>324k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_88' href='#L_ALLOCA_88'><pre>88</pre></a></td><td class='covered-line'><pre>324k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_89' href='#L_ALLOCA_89'><pre>89</pre></a></td><td class='covered-line'><pre>549k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_90' href='#L_ALLOCA_90'><pre>90</pre></a></td><td class='covered-line'><pre>225k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto <span class='tooltip-content'>225k</span></div><div class='tooltip'>CS<span class='tooltip-content'>225k</span></div> = CallSite(I)) <div class='tooltip'>{<span class='tooltip-content'>202k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_91' href='#L_ALLOCA_91'><pre>91</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // If this is the function being called then we treat it like a load and</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_92' href='#L_ALLOCA_92'><pre>92</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // ignore it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_93' href='#L_ALLOCA_93'><pre>93</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> if (CS.isCallee(&U))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_94' href='#L_ALLOCA_94'><pre>94</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>continue</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_95' href='#L_ALLOCA_95'><pre>95</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_96' href='#L_ALLOCA_96'><pre>96</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> unsigned DataOpNo = CS.getDataOperandNo(&U);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_97' href='#L_ALLOCA_97'><pre>97</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> bool IsArgOperand = CS.isArgOperand(&U);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_98' href='#L_ALLOCA_98'><pre>98</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_99' href='#L_ALLOCA_99'><pre>99</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // Inalloca arguments are clobbered by the call.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_100' href='#L_ALLOCA_100'><pre>100</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> if (<div class='tooltip'>IsArgOperand && <span class='tooltip-content'>202k</span></div><div class='tooltip'>CS.isInAllocaArgument(DataOpNo)<span class='tooltip-content'>202k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_101' href='#L_ALLOCA_101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_102' href='#L_ALLOCA_102'><pre>102</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_103' href='#L_ALLOCA_103'><pre>103</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // If this is a readonly/readnone call site, then we know it is just a</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_104' href='#L_ALLOCA_104'><pre>104</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // load (but one that potentially returns the value itself), so we can</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_105' href='#L_ALLOCA_105'><pre>105</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // ignore it if we know that the value isn't captured.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_106' href='#L_ALLOCA_106'><pre>106</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>202k</span></div><div class='tooltip'>CS.onlyReadsMemory() &&<span class='tooltip-content'>202k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_107' href='#L_ALLOCA_107'><pre>107</pre></a></td><td class='covered-line'><pre>915</pre></td><td class='code'><pre> <div class='tooltip'>(CS.getInstruction()->use_empty() || <span class='tooltip-content'>915</span></div><div class='tooltip'>CS.doesNotCapture(DataOpNo)<span class='tooltip-content'>915</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_108' href='#L_ALLOCA_108'><pre>108</pre></a></td><td class='covered-line'><pre>845</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_109' href='#L_ALLOCA_109'><pre>109</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_110' href='#L_ALLOCA_110'><pre>110</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // If this is being passed as a byval argument, the caller is making a</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_111' href='#L_ALLOCA_111'><pre>111</pre></a></td><td class='covered-line'><pre>202k</pre></td><td class='code'><pre> // copy, so it is only a read of the alloca.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_112' href='#L_ALLOCA_112'><pre>112</pre></a></td><td class='covered-line'><pre>201k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>201k</span></div><div class='tooltip'>IsArgOperand && <span class='tooltip-content'>201k</span></div><div class='tooltip'>CS.isByValArgument(DataOpNo)<span class='tooltip-content'>201k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_113' href='#L_ALLOCA_113'><pre>113</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_114' href='#L_ALLOCA_114'><pre>114</pre></a></td><td class='covered-line'><pre>201k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_115' href='#L_ALLOCA_115'><pre>115</pre></a></td><td class='covered-line'><pre>225k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_116' href='#L_ALLOCA_116'><pre>116</pre></a></td><td class='covered-line'><pre>225k</pre></td><td class='code'><pre> // Lifetime intrinsics can be handled by the caller.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_117' href='#L_ALLOCA_117'><pre>117</pre></a></td><td class='covered-line'><pre>223k</pre></td><td class='code'><pre> <div class='tooltip'>if (IntrinsicInst *<span class='tooltip-content'>223k</span></div><div class='tooltip'>II<span class='tooltip-content'>223k</span></div> = dyn_cast<IntrinsicInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>51.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_118' href='#L_ALLOCA_118'><pre>118</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> if (II->getIntrinsicID() == Intrinsic::lifetime_start ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_119' href='#L_ALLOCA_119'><pre>119</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>II->getIntrinsicID() == Intrinsic::lifetime_end<span class='tooltip-content'>32.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>45.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_120' href='#L_ALLOCA_120'><pre>120</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> assert(II->use_empty() && "Lifetime markers have no result to use!");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_121' href='#L_ALLOCA_121'><pre>121</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> ToDelete.push_back(II);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_122' href='#L_ALLOCA_122'><pre>122</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_123' href='#L_ALLOCA_123'><pre>123</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_124' href='#L_ALLOCA_124'><pre>124</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_125' href='#L_ALLOCA_125'><pre>125</pre></a></td><td class='covered-line'><pre>223k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_126' href='#L_ALLOCA_126'><pre>126</pre></a></td><td class='covered-line'><pre>223k</pre></td><td class='code'><pre> // If this is isn't our memcpy/memmove, reject it as something we can't</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_127' href='#L_ALLOCA_127'><pre>127</pre></a></td><td class='covered-line'><pre>223k</pre></td><td class='code'><pre> // handle.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_128' href='#L_ALLOCA_128'><pre>128</pre></a></td><td class='covered-line'><pre>177k</pre></td><td class='code'><pre> MemTransferInst *MI = dyn_cast<MemTransferInst>(I);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_129' href='#L_ALLOCA_129'><pre>129</pre></a></td><td class='covered-line'><pre>177k</pre></td><td class='code'><pre> if (!MI)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_130' href='#L_ALLOCA_130'><pre>130</pre></a></td><td class='covered-line'><pre>173k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_131' href='#L_ALLOCA_131'><pre>131</pre></a></td><td class='covered-line'><pre>177k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_132' href='#L_ALLOCA_132'><pre>132</pre></a></td><td class='covered-line'><pre>177k</pre></td><td class='code'><pre> // If the transfer is using the alloca as a source of the transfer, then</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_133' href='#L_ALLOCA_133'><pre>133</pre></a></td><td class='covered-line'><pre>177k</pre></td><td class='code'><pre> // ignore it since it is a load (unless the transfer is volatile).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_134' href='#L_ALLOCA_134'><pre>134</pre></a></td><td class='covered-line'><pre>3.75k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.75k</span></div><div class='tooltip'>U.getOperandNo() == 1<span class='tooltip-content'>3.75k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.99k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_135' href='#L_ALLOCA_135'><pre>135</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> if (<div class='tooltip'>MI->isVolatile()<span class='tooltip-content'>1.99k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_136' href='#L_ALLOCA_136'><pre>136</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_137' href='#L_ALLOCA_137'><pre>137</pre></a></td><td class='covered-line'><pre>1.99k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_138' href='#L_ALLOCA_138'><pre>138</pre></a></td><td class='covered-line'><pre>3.75k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_139' href='#L_ALLOCA_139'><pre>139</pre></a></td><td class='covered-line'><pre>3.75k</pre></td><td class='code'><pre> // If we already have seen a copy, reject the second one.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_140' href='#L_ALLOCA_140'><pre>140</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.75k</span></div><div class='tooltip'>TheCopy<span class='tooltip-content'>1.75k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_141' href='#L_ALLOCA_141'><pre>141</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_142' href='#L_ALLOCA_142'><pre>142</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> // If the pointer has been offset from the start of the alloca, we can't</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_143' href='#L_ALLOCA_143'><pre>143</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> // safely handle this.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_144' href='#L_ALLOCA_144'><pre>144</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.75k</span></div><div class='tooltip'>IsOffset<span class='tooltip-content'>1.75k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>143</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_145' href='#L_ALLOCA_145'><pre>145</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_146' href='#L_ALLOCA_146'><pre>146</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> // If the memintrinsic isn't using the alloca as the dest, reject it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_147' href='#L_ALLOCA_147'><pre>147</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.60k</span></div><div class='tooltip'>U.getOperandNo() != 0<span class='tooltip-content'>1.60k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_148' href='#L_ALLOCA_148'><pre>148</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_149' href='#L_ALLOCA_149'><pre>149</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> // If the source of the memcpy/move is not a constant global, reject it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_150' href='#L_ALLOCA_150'><pre>150</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.60k</span></div><div class='tooltip'>!pointsToConstantGlobal(MI->getSource())<span class='tooltip-content'>1.60k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_151' href='#L_ALLOCA_151'><pre>151</pre></a></td><td class='covered-line'><pre>1.00k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_152' href='#L_ALLOCA_152'><pre>152</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_153' href='#L_ALLOCA_153'><pre>153</pre></a></td><td class='covered-line'><pre>1.60k</pre></td><td class='code'><pre> // Otherwise, the transform is safe. Remember the copy instruction.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_154' href='#L_ALLOCA_154'><pre>154</pre></a></td><td class='covered-line'><pre>601</pre></td><td class='code'><pre> TheCopy = MI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_155' href='#L_ALLOCA_155'><pre>155</pre></a></td><td class='covered-line'><pre>601</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_156' href='#L_ALLOCA_156'><pre>156</pre></a></td><td class='covered-line'><pre>243k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_157' href='#L_ALLOCA_157'><pre>157</pre></a></td><td class='covered-line'><pre>406</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_158' href='#L_ALLOCA_158'><pre>158</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_159' href='#L_ALLOCA_159'><pre>159</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_160' href='#L_ALLOCA_160'><pre>160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// isOnlyCopiedFromConstantGlobal - Return true if the specified alloca is only</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_161' href='#L_ALLOCA_161'><pre>161</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// modified by a copy from a constant global. If we can prove this, we can</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_162' href='#L_ALLOCA_162'><pre>162</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// replace any uses of the alloca with uses of the global directly.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_163' href='#L_ALLOCA_163'><pre>163</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static MemTransferInst *</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_164' href='#L_ALLOCA_164'><pre>164</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>isOnlyCopiedFromConstantGlobal(AllocaInst *AI,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_165' href='#L_ALLOCA_165'><pre>165</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> SmallVectorImpl<Instruction *> &ToDelete) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_166' href='#L_ALLOCA_166'><pre>166</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> MemTransferInst *TheCopy = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_167' href='#L_ALLOCA_167'><pre>167</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (isOnlyCopiedFromConstantGlobal(AI, TheCopy, ToDelete))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_168' href='#L_ALLOCA_168'><pre>168</pre></a></td><td class='covered-line'><pre>406</pre></td><td class='code'><pre> return TheCopy;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_169' href='#L_ALLOCA_169'><pre>169</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_170' href='#L_ALLOCA_170'><pre>170</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_171' href='#L_ALLOCA_171'><pre>171</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_172' href='#L_ALLOCA_172'><pre>172</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre>static Instruction *simplifyAllocaArraySize(InstCombiner &IC, AllocaInst &AI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_173' href='#L_ALLOCA_173'><pre>173</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // Check for array size of 1 (scalar allocation).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_174' href='#L_ALLOCA_174'><pre>174</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (<div class='tooltip'>!AI.isArrayAllocation()<span class='tooltip-content'>175k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>174k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_175' href='#L_ALLOCA_175'><pre>175</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> // i32 1 is the canonical array size for scalar allocations.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_176' href='#L_ALLOCA_176'><pre>176</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> if (AI.getArraySize()->getType()->isIntegerTy(32))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_177' href='#L_ALLOCA_177'><pre>177</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_178' href='#L_ALLOCA_178'><pre>178</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_179' href='#L_ALLOCA_179'><pre>179</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> // Canonicalize it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_180' href='#L_ALLOCA_180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *V = IC.Builder->getInt32(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_181' href='#L_ALLOCA_181'><pre>181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AI.setOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_182' href='#L_ALLOCA_182'><pre>182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &AI</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_183' href='#L_ALLOCA_183'><pre>183</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_184' href='#L_ALLOCA_184'><pre>184</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_185' href='#L_ALLOCA_185'><pre>185</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // Convert: alloca Ty, C - where C is a constant != 1 into: alloca [C x Ty], 1</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_186' href='#L_ALLOCA_186'><pre>186</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre> <div class='tooltip'>if (const ConstantInt *<span class='tooltip-content'>78</span></div><div class='tooltip'>C<span class='tooltip-content'>78</span></div> = dyn_cast<ConstantInt>(AI.getArraySize())) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_187' href='#L_ALLOCA_187'><pre>187</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getZExtValue());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_188' href='#L_ALLOCA_188'><pre>188</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> AllocaInst *New = IC.Builder->CreateAlloca(NewTy, nullptr, AI.getName());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_189' href='#L_ALLOCA_189'><pre>189</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> New->setAlignment(AI.getAlignment());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_190' href='#L_ALLOCA_190'><pre>190</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_191' href='#L_ALLOCA_191'><pre>191</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Scan to the end of the allocation instructions, to skip over a block of</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_192' href='#L_ALLOCA_192'><pre>192</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // allocas if possible...also skip interleaved debug info</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_193' href='#L_ALLOCA_193'><pre>193</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_194' href='#L_ALLOCA_194'><pre>194</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> BasicBlock::iterator It(New);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_195' href='#L_ALLOCA_195'><pre>195</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> while (<div class='tooltip'>isa<AllocaInst>(*It) || <span class='tooltip-content'>28</span></div><div class='tooltip'>isa<DbgInfoIntrinsic>(*It)<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_196' href='#L_ALLOCA_196'><pre>196</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ++It;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_197' href='#L_ALLOCA_197'><pre>197</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_198' href='#L_ALLOCA_198'><pre>198</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Now that I is pointing to the first non-allocation-inst in the block,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_199' href='#L_ALLOCA_199'><pre>199</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // insert our getelementptr instruction...</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_200' href='#L_ALLOCA_200'><pre>200</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_201' href='#L_ALLOCA_201'><pre>201</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Type *IdxTy = IC.getDataLayout().getIntPtrType(AI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_202' href='#L_ALLOCA_202'><pre>202</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *NullIdx = Constant::getNullValue(IdxTy);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_203' href='#L_ALLOCA_203'><pre>203</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Value *Idx[2] = {NullIdx, NullIdx};</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_204' href='#L_ALLOCA_204'><pre>204</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> Instruction *GEP =</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_205' href='#L_ALLOCA_205'><pre>205</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> GetElementPtrInst::CreateInBounds(New, Idx, New->getName() + ".sub");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_206' href='#L_ALLOCA_206'><pre>206</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> IC.InsertNewInstBefore(GEP, *It);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_207' href='#L_ALLOCA_207'><pre>207</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_208' href='#L_ALLOCA_208'><pre>208</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // Now make everything use the getelementptr instead of the original</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_209' href='#L_ALLOCA_209'><pre>209</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // allocation.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_210' href='#L_ALLOCA_210'><pre>210</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return IC.replaceInstUsesWith(AI, GEP);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_211' href='#L_ALLOCA_211'><pre>211</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_212' href='#L_ALLOCA_212'><pre>212</pre></a></td><td class='covered-line'><pre>78</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_213' href='#L_ALLOCA_213'><pre>213</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>70</span></div><div class='tooltip'>isa<UndefValue>(AI.getArraySize())<span class='tooltip-content'>70</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_214' href='#L_ALLOCA_214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return IC.replaceInstUsesWith(AI, Constant::getNullValue(AI.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_215' href='#L_ALLOCA_215'><pre>215</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_216' href='#L_ALLOCA_216'><pre>216</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // Ensure that the alloca array size argument has type intptr_t, so that</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_217' href='#L_ALLOCA_217'><pre>217</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // any casting is exposed early.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_218' href='#L_ALLOCA_218'><pre>218</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Type *IntPtrTy = IC.getDataLayout().getIntPtrType(AI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_219' href='#L_ALLOCA_219'><pre>219</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (<div class='tooltip'>AI.getArraySize()->getType() != IntPtrTy<span class='tooltip-content'>70</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_220' href='#L_ALLOCA_220'><pre>220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = IC.Builder->CreateIntCast(AI.getArraySize(), IntPtrTy, false);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_221' href='#L_ALLOCA_221'><pre>221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AI.setOperand(0, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_222' href='#L_ALLOCA_222'><pre>222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &AI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_223' href='#L_ALLOCA_223'><pre>223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_224' href='#L_ALLOCA_224'><pre>224</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_225' href='#L_ALLOCA_225'><pre>225</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_226' href='#L_ALLOCA_226'><pre>226</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_227' href='#L_ALLOCA_227'><pre>227</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_228' href='#L_ALLOCA_228'><pre>228</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>namespace {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_229' href='#L_ALLOCA_229'><pre>229</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If I and V are pointers in different address space, it is not allowed to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_230' href='#L_ALLOCA_230'><pre>230</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// use replaceAllUsesWith since I and V have different types. A</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_231' href='#L_ALLOCA_231'><pre>231</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// non-target-specific transformation should not use addrspacecast on V since</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_232' href='#L_ALLOCA_232'><pre>232</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// the two address space may be disjoint depending on target.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_233' href='#L_ALLOCA_233'><pre>233</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_234' href='#L_ALLOCA_234'><pre>234</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This class chases down uses of the old pointer until reaching the load</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_235' href='#L_ALLOCA_235'><pre>235</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// instructions, then replaces the old pointer in the load instructions with</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_236' href='#L_ALLOCA_236'><pre>236</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// the new pointer. If during the chasing it sees bitcast or GEP, it will</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_237' href='#L_ALLOCA_237'><pre>237</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// create new bitcast or GEP with the new pointer and use them in the load</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_238' href='#L_ALLOCA_238'><pre>238</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// instruction.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_239' href='#L_ALLOCA_239'><pre>239</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>class PointerReplacer {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_240' href='#L_ALLOCA_240'><pre>240</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>public:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_241' href='#L_ALLOCA_241'><pre>241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> PointerReplacer(InstCombiner &IC) : IC(IC) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_242' href='#L_ALLOCA_242'><pre>242</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void replacePointer(Instruction &I, Value *V);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_243' href='#L_ALLOCA_243'><pre>243</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_244' href='#L_ALLOCA_244'><pre>244</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>private:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_245' href='#L_ALLOCA_245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void findLoadAndReplace(Instruction &I);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_246' href='#L_ALLOCA_246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> void replace(Instruction *I);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_247' href='#L_ALLOCA_247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *getReplacement(Value *I);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_248' href='#L_ALLOCA_248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_249' href='#L_ALLOCA_249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SmallVector<Instruction *, 4> Path;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_250' href='#L_ALLOCA_250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> MapVector<Value *, Value *> WorkMap;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_251' href='#L_ALLOCA_251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InstCombiner &IC;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_252' href='#L_ALLOCA_252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_253' href='#L_ALLOCA_253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>} // end anonymous namespace</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_254' href='#L_ALLOCA_254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_255' href='#L_ALLOCA_255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void PointerReplacer::findLoadAndReplace(Instruction &I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_256' href='#L_ALLOCA_256'><pre>256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (auto U : I.users()) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_257' href='#L_ALLOCA_257'><pre>257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Inst = dyn_cast<Instruction>(&*U);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_258' href='#L_ALLOCA_258'><pre>258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Inst</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_259' href='#L_ALLOCA_259'><pre>259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_260' href='#L_ALLOCA_260'><pre>260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>DEBUG</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(dbgs() << "Found pointer user: " << *U << '\n');</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_261' href='#L_ALLOCA_261'><pre>261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<LoadInst>(Inst)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_262' href='#L_ALLOCA_262'><pre>262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (auto P : Path)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_263' href='#L_ALLOCA_263'><pre>263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>replace(P)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_264' href='#L_ALLOCA_264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replace(Inst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_265' href='#L_ALLOCA_265'><pre>265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<GetElementPtrInst>(Inst) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<BitCastInst>(Inst)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_266' href='#L_ALLOCA_266'><pre>266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Path.push_back(Inst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_267' href='#L_ALLOCA_267'><pre>267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> findLoadAndReplace(*Inst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_268' href='#L_ALLOCA_268'><pre>268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Path.pop_back();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_269' href='#L_ALLOCA_269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_270' href='#L_ALLOCA_270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_271' href='#L_ALLOCA_271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_272' href='#L_ALLOCA_272'><pre>272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_273' href='#L_ALLOCA_273'><pre>273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_274' href='#L_ALLOCA_274'><pre>274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_275' href='#L_ALLOCA_275'><pre>275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Value *PointerReplacer::getReplacement(Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_276' href='#L_ALLOCA_276'><pre>276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Loc = WorkMap.find(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_277' href='#L_ALLOCA_277'><pre>277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Loc != WorkMap.end()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_278' href='#L_ALLOCA_278'><pre>278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Loc->second</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_279' href='#L_ALLOCA_279'><pre>279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_280' href='#L_ALLOCA_280'><pre>280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_281' href='#L_ALLOCA_281'><pre>281</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_282' href='#L_ALLOCA_282'><pre>282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void PointerReplacer::replace(Instruction *I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_283' href='#L_ALLOCA_283'><pre>283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>getReplacement(I)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_284' href='#L_ALLOCA_284'><pre>284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_285' href='#L_ALLOCA_285'><pre>285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_286' href='#L_ALLOCA_286'><pre>286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>LT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<LoadInst>(I)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_287' href='#L_ALLOCA_287'><pre>287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *V = getReplacement(LT->getPointerOperand());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_288' href='#L_ALLOCA_288'><pre>288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(V && "Operand not replaced");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_289' href='#L_ALLOCA_289'><pre>289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewI = new LoadInst(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_290' href='#L_ALLOCA_290'><pre>290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->takeName(LT);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_291' href='#L_ALLOCA_291'><pre>291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.InsertNewInstWith(NewI, *LT);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_292' href='#L_ALLOCA_292'><pre>292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.replaceInstUsesWith(*LT, NewI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_293' href='#L_ALLOCA_293'><pre>293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> WorkMap[LT] = NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_294' href='#L_ALLOCA_294'><pre>294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>GEP</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<GetElementPtrInst>(I)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_295' href='#L_ALLOCA_295'><pre>295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *V = getReplacement(GEP->getPointerOperand());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_296' href='#L_ALLOCA_296'><pre>296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(V && "Operand not replaced");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_297' href='#L_ALLOCA_297'><pre>297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Value *, 8> Indices;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_298' href='#L_ALLOCA_298'><pre>298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Indices.append(GEP->idx_begin(), GEP->idx_end());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_299' href='#L_ALLOCA_299'><pre>299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewI = GetElementPtrInst::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_300' href='#L_ALLOCA_300'><pre>300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V->getType()->getPointerElementType(), V, Indices);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_301' href='#L_ALLOCA_301'><pre>301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.InsertNewInstWith(NewI, *GEP);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_302' href='#L_ALLOCA_302'><pre>302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->takeName(GEP);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_303' href='#L_ALLOCA_303'><pre>303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> WorkMap[GEP] = NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_304' href='#L_ALLOCA_304'><pre>304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>BC</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<BitCastInst>(I)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_305' href='#L_ALLOCA_305'><pre>305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *V = getReplacement(BC->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_306' href='#L_ALLOCA_306'><pre>306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(V && "Operand not replaced");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_307' href='#L_ALLOCA_307'><pre>307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewT = PointerType::get(BC->getType()->getPointerElementType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_308' href='#L_ALLOCA_308'><pre>308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V->getType()->getPointerAddressSpace());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_309' href='#L_ALLOCA_309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewI = new BitCastInst(V, NewT);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_310' href='#L_ALLOCA_310'><pre>310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.InsertNewInstWith(NewI, *BC);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_311' href='#L_ALLOCA_311'><pre>311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->takeName(BC);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_312' href='#L_ALLOCA_312'><pre>312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> WorkMap[BC] = NewI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_313' href='#L_ALLOCA_313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_314' href='#L_ALLOCA_314'><pre>314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("should never reach here");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_315' href='#L_ALLOCA_315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_316' href='#L_ALLOCA_316'><pre>316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_317' href='#L_ALLOCA_317'><pre>317</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_318' href='#L_ALLOCA_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>void PointerReplacer::replacePointer(Instruction &I, Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_319' href='#L_ALLOCA_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>#ifndef NDEBUG</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_320' href='#L_ALLOCA_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *PT = cast<PointerType>(I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_321' href='#L_ALLOCA_321'><pre>321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NT = cast<PointerType>(V->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_322' href='#L_ALLOCA_322'><pre>322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(PT != NT && PT->getElementType() == NT->getElementType() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_323' href='#L_ALLOCA_323'><pre>323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Invalid usage");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_324' href='#L_ALLOCA_324'><pre>324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>#endif</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_325' href='#L_ALLOCA_325'><pre>325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> WorkMap[&I] = V;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_326' href='#L_ALLOCA_326'><pre>326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> findLoadAndReplace(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_327' href='#L_ALLOCA_327'><pre>327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_328' href='#L_ALLOCA_328'><pre>328</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_329' href='#L_ALLOCA_329'><pre>329</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_330' href='#L_ALLOCA_330'><pre>330</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (auto *I = simplifyAllocaArraySize(*this, AI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_331' href='#L_ALLOCA_331'><pre>331</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_332' href='#L_ALLOCA_332'><pre>332</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_333' href='#L_ALLOCA_333'><pre>333</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>175k</span></div><div class='tooltip'>AI.getAllocatedType()->isSized()<span class='tooltip-content'>175k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>175k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_334' href='#L_ALLOCA_334'><pre>334</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // If the alignment is 0 (unspecified), assign it the preferred alignment.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_335' href='#L_ALLOCA_335'><pre>335</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (AI.getAlignment() == 0)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_336' href='#L_ALLOCA_336'><pre>336</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre> AI.setAlignment(DL.getPrefTypeAlignment(AI.getAllocatedType()));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_337' href='#L_ALLOCA_337'><pre>337</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_338' href='#L_ALLOCA_338'><pre>338</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // Move all alloca's of zero byte objects to the entry block and merge them</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_339' href='#L_ALLOCA_339'><pre>339</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // together. Note that we only do this for alloca's, because malloc should</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_340' href='#L_ALLOCA_340'><pre>340</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // allocate and return a unique pointer, even for a zero byte allocation.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_341' href='#L_ALLOCA_341'><pre>341</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (<div class='tooltip'>DL.getTypeAllocSize(AI.getAllocatedType()) == 0<span class='tooltip-content'>175k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_342' href='#L_ALLOCA_342'><pre>342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // For a zero sized alloca there is no point in doing an array allocation.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_343' href='#L_ALLOCA_343'><pre>343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is helpful if the array size is a complicated expression not used</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_344' href='#L_ALLOCA_344'><pre>344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elsewhere.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_345' href='#L_ALLOCA_345'><pre>345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>AI.isArrayAllocation()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_346' href='#L_ALLOCA_346'><pre>346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AI.setOperand(0, ConstantInt::get(AI.getArraySize()->getType(), 1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_347' href='#L_ALLOCA_347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &AI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_348' href='#L_ALLOCA_348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_349' href='#L_ALLOCA_349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_350' href='#L_ALLOCA_350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Get the first instruction in the entry block.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_351' href='#L_ALLOCA_351'><pre>351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>BasicBlock &EntryBlock = AI.getParent()->getParent()->getEntryBlock();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_352' href='#L_ALLOCA_352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *FirstInst = EntryBlock.getFirstNonPHIOrDbg();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_353' href='#L_ALLOCA_353'><pre>353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>FirstInst != &AI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_354' href='#L_ALLOCA_354'><pre>354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the entry block doesn't start with a zero-size alloca then move</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_355' href='#L_ALLOCA_355'><pre>355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // this one to the start of the entry block. There is no problem with</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_356' href='#L_ALLOCA_356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // dominance as the array size was forced to a constant earlier already.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_357' href='#L_ALLOCA_357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AllocaInst *EntryAI = dyn_cast<AllocaInst>(FirstInst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_358' href='#L_ALLOCA_358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!EntryAI || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!EntryAI->getAllocatedType()->isSized()</span><span class='tooltip-content'>0</span></div><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_359' href='#L_ALLOCA_359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>DL.getTypeAllocSize(EntryAI->getAllocatedType()) != 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_360' href='#L_ALLOCA_360'><pre>360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AI.moveBefore(FirstInst);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_361' href='#L_ALLOCA_361'><pre>361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &AI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_362' href='#L_ALLOCA_362'><pre>362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_363' href='#L_ALLOCA_363'><pre>363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_364' href='#L_ALLOCA_364'><pre>364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the alignment of the entry block alloca is 0 (unspecified),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_365' href='#L_ALLOCA_365'><pre>365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // assign it the preferred alignment.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_366' href='#L_ALLOCA_366'><pre>366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>EntryAI->getAlignment() == 0</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_367' href='#L_ALLOCA_367'><pre>367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>EntryAI->setAlignment(</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_368' href='#L_ALLOCA_368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DL.getPrefTypeAlignment(EntryAI->getAllocatedType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_369' href='#L_ALLOCA_369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace this zero-sized alloca with the one at the start of the entry</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_370' href='#L_ALLOCA_370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // block after ensuring that the address will be aligned enough for both</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_371' href='#L_ALLOCA_371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // types.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_372' href='#L_ALLOCA_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned MaxAlign = std::max(EntryAI->getAlignment(),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_373' href='#L_ALLOCA_373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AI.getAlignment());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_374' href='#L_ALLOCA_374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EntryAI->setAlignment(MaxAlign);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_375' href='#L_ALLOCA_375'><pre>375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>AI.getType() != EntryAI->getType()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_376' href='#L_ALLOCA_376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new BitCastInst(EntryAI, AI.getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_377' href='#L_ALLOCA_377'><pre>377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(AI, EntryAI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_378' href='#L_ALLOCA_378'><pre>378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_379' href='#L_ALLOCA_379'><pre>379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_380' href='#L_ALLOCA_380'><pre>380</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_381' href='#L_ALLOCA_381'><pre>381</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_382' href='#L_ALLOCA_382'><pre>382</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>175k</span></div><div class='tooltip'>AI.getAlignment()<span class='tooltip-content'>175k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>175k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_383' href='#L_ALLOCA_383'><pre>383</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // Check to see if this allocation is only modified by a memcpy/memmove from</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_384' href='#L_ALLOCA_384'><pre>384</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // a constant global whose alignment is equal to or exceeds that of the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_385' href='#L_ALLOCA_385'><pre>385</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // allocation. If this is the case, we can change all users to use</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_386' href='#L_ALLOCA_386'><pre>386</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // the constant global instead. This is commonly produced by the CFE by</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_387' href='#L_ALLOCA_387'><pre>387</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // constructs like "void foo() { int A[] = {1,2,3,4,5,6,7,8,9...}; }" if 'A'</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_388' href='#L_ALLOCA_388'><pre>388</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // is only subsequently read.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_389' href='#L_ALLOCA_389'><pre>389</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> SmallVector<Instruction *, 4> ToDelete;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_390' href='#L_ALLOCA_390'><pre>390</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> if (MemTransferInst *<div class='tooltip'>Copy<span class='tooltip-content'>175k</span></div> = isOnlyCopiedFromConstantGlobal(&AI, ToDelete)) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_391' href='#L_ALLOCA_391'><pre>391</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> unsigned SourceAlign = getOrEnforceKnownAlignment(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_392' href='#L_ALLOCA_392'><pre>392</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Copy->getSource(), AI.getAlignment(), DL, &AI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_393' href='#L_ALLOCA_393'><pre>393</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (<div class='tooltip'>AI.getAlignment() <= SourceAlign<span class='tooltip-content'>16</span></div>) <div class='tooltip'>{<span class='tooltip-content'>16</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_394' href='#L_ALLOCA_394'><pre>394</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> DEBUG(dbgs() << "Found alloca equal to global: " << AI << '\n');</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_395' href='#L_ALLOCA_395'><pre>395</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> DEBUG(dbgs() << " memcpy = " << *Copy << '\n');</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_396' href='#L_ALLOCA_396'><pre>396</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre> for (unsigned i = 0, e = ToDelete.size(); <div class='tooltip'>i != e<span class='tooltip-content'>50</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>34</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_397' href='#L_ALLOCA_397'><pre>397</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> eraseInstFromFunction(*ToDelete[i]);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_398' href='#L_ALLOCA_398'><pre>398</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Constant *TheSrc = cast<Constant>(Copy->getSource());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_399' href='#L_ALLOCA_399'><pre>399</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> auto *SrcTy = TheSrc->getType();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_400' href='#L_ALLOCA_400'><pre>400</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> auto *DestTy = PointerType::get(AI.getType()->getPointerElementType(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_401' href='#L_ALLOCA_401'><pre>401</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> SrcTy->getPointerAddressSpace());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_402' href='#L_ALLOCA_402'><pre>402</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Constant *Cast =</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_403' href='#L_ALLOCA_403'><pre>403</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> ConstantExpr::getPointerBitCastOrAddrSpaceCast(TheSrc, DestTy);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_404' href='#L_ALLOCA_404'><pre>404</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (AI.getType()->getPointerAddressSpace() ==</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_405' href='#L_ALLOCA_405'><pre>405</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> SrcTy->getPointerAddressSpace()) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_406' href='#L_ALLOCA_406'><pre>406</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> Instruction *NewI = replaceInstUsesWith(AI, Cast);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_407' href='#L_ALLOCA_407'><pre>407</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> eraseInstFromFunction(*Copy);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_408' href='#L_ALLOCA_408'><pre>408</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> ++NumGlobalCopies;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_409' href='#L_ALLOCA_409'><pre>409</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return NewI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_410' href='#L_ALLOCA_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_411' href='#L_ALLOCA_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PointerReplacer PtrReplacer(*this);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_412' href='#L_ALLOCA_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PtrReplacer.replacePointer(AI, Cast);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_413' href='#L_ALLOCA_413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++NumGlobalCopies;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_414' href='#L_ALLOCA_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_415' href='#L_ALLOCA_415'><pre>415</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_416' href='#L_ALLOCA_416'><pre>416</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_417' href='#L_ALLOCA_417'><pre>417</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_418' href='#L_ALLOCA_418'><pre>418</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_419' href='#L_ALLOCA_419'><pre>419</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // At last, use the generic allocation site handler to aggressively remove</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_420' href='#L_ALLOCA_420'><pre>420</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> // unused allocas.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_421' href='#L_ALLOCA_421'><pre>421</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre> return visitAllocSite(AI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_422' href='#L_ALLOCA_422'><pre>422</pre></a></td><td class='covered-line'><pre>175k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_423' href='#L_ALLOCA_423'><pre>423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_424' href='#L_ALLOCA_424'><pre>424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Are we allowed to form a atomic load or store of this type?</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_425' href='#L_ALLOCA_425'><pre>425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isSupportedAtomicType(Type *Ty) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_426' href='#L_ALLOCA_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Ty->isIntegerTy() || </span><div class='tooltip'><span class='red'>Ty->isPointerTy()</span><span class='tooltip-content'>0</span></div><span class='red'> || </span><div class='tooltip'><span class='red'>Ty->isFloatingPointTy()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_427' href='#L_ALLOCA_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_428' href='#L_ALLOCA_428'><pre>428</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_429' href='#L_ALLOCA_429'><pre>429</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Helper to combine a load to a new type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_430' href='#L_ALLOCA_430'><pre>430</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_431' href='#L_ALLOCA_431'><pre>431</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This just does the work of combining a load to a new type. It handles</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_432' href='#L_ALLOCA_432'><pre>432</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// metadata, etc., and returns the new instruction. The \c NewTy should be the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_433' href='#L_ALLOCA_433'><pre>433</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// loaded *value* type. This will convert it to a pointer, cast the operand to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_434' href='#L_ALLOCA_434'><pre>434</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that pointer type, load it, etc.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_435' href='#L_ALLOCA_435'><pre>435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_436' href='#L_ALLOCA_436'><pre>436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Note that this will create all of the instructions with whatever insert</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_437' href='#L_ALLOCA_437'><pre>437</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// point the \c InstCombiner currently is using.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_438' href='#L_ALLOCA_438'><pre>438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_439' href='#L_ALLOCA_439'><pre>439</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> const Twine &Suffix = "") {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_440' href='#L_ALLOCA_440'><pre>440</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> assert((!LI.isAtomic() || isSupportedAtomicType(NewTy)) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_441' href='#L_ALLOCA_441'><pre>441</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> "can't fold an atomic load to requested type");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_442' href='#L_ALLOCA_442'><pre>442</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> </pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_443' href='#L_ALLOCA_443'><pre>443</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> Value *Ptr = LI.getPointerOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_444' href='#L_ALLOCA_444'><pre>444</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> unsigned AS = LI.getPointerAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_445' href='#L_ALLOCA_445'><pre>445</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> SmallVector<std::pair<unsigned, MDNode *>, 8> MD;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_446' href='#L_ALLOCA_446'><pre>446</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> LI.getAllMetadata(MD);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_447' href='#L_ALLOCA_447'><pre>447</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_448' href='#L_ALLOCA_448'><pre>448</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> LoadInst *NewLoad = IC.Builder->CreateAlignedLoad(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_449' href='#L_ALLOCA_449'><pre>449</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> IC.Builder->CreateBitCast(Ptr, NewTy->getPointerTo(AS)),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_450' href='#L_ALLOCA_450'><pre>450</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> LI.getAlignment(), LI.isVolatile(), LI.getName() + Suffix);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_451' href='#L_ALLOCA_451'><pre>451</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> NewLoad->setAtomic(LI.getOrdering(), LI.getSynchScope());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_452' href='#L_ALLOCA_452'><pre>452</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> MDBuilder MDB(NewLoad->getContext());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_453' href='#L_ALLOCA_453'><pre>453</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> for (const auto &MDPair : MD) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_454' href='#L_ALLOCA_454'><pre>454</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> unsigned ID = MDPair.first;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_455' href='#L_ALLOCA_455'><pre>455</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> MDNode *N = MDPair.second;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_456' href='#L_ALLOCA_456'><pre>456</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // Note, essentially every kind of metadata should be preserved here! This</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_457' href='#L_ALLOCA_457'><pre>457</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // routine is supposed to clone a load instruction changing *only its type*.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_458' href='#L_ALLOCA_458'><pre>458</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // The only metadata it makes sense to drop is metadata which is invalidated</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_459' href='#L_ALLOCA_459'><pre>459</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // when the pointer type changes. This should essentially never be the case</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_460' href='#L_ALLOCA_460'><pre>460</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // in LLVM, but we explicitly switch over only known metadata to be</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_461' href='#L_ALLOCA_461'><pre>461</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // conservatively correct. If you are adding metadata to LLVM which pertains</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_462' href='#L_ALLOCA_462'><pre>462</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // to loads, you almost certainly want to add it here.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_463' href='#L_ALLOCA_463'><pre>463</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> switch (ID) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_464' href='#L_ALLOCA_464'><pre>464</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_dbg:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_465' href='#L_ALLOCA_465'><pre>465</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_tbaa:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_466' href='#L_ALLOCA_466'><pre>466</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_prof:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_467' href='#L_ALLOCA_467'><pre>467</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_fpmath:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_468' href='#L_ALLOCA_468'><pre>468</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_tbaa_struct:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_469' href='#L_ALLOCA_469'><pre>469</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_invariant_load:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_470' href='#L_ALLOCA_470'><pre>470</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_alias_scope:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_471' href='#L_ALLOCA_471'><pre>471</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_noalias:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_472' href='#L_ALLOCA_472'><pre>472</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_nontemporal:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_473' href='#L_ALLOCA_473'><pre>473</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> case LLVMContext::MD_mem_parallel_loop_access:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_474' href='#L_ALLOCA_474'><pre>474</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> // All of these directly apply.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_475' href='#L_ALLOCA_475'><pre>475</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> NewLoad->setMetadata(ID, N);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_476' href='#L_ALLOCA_476'><pre>476</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_477' href='#L_ALLOCA_477'><pre>477</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_478' href='#L_ALLOCA_478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case LLVMContext::MD_nonnull:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_479' href='#L_ALLOCA_479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This only directly applies if the new type is also a pointer.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_480' href='#L_ALLOCA_480'><pre>480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewTy->isPointerTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_481' href='#L_ALLOCA_481'><pre>481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewLoad->setMetadata(ID, N);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_482' href='#L_ALLOCA_482'><pre>482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_483' href='#L_ALLOCA_483'><pre>483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_484' href='#L_ALLOCA_484'><pre>484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If it's integral now, translate it to !range metadata.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_485' href='#L_ALLOCA_485'><pre>485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>NewTy->isIntegerTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_486' href='#L_ALLOCA_486'><pre>486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ITy = cast<IntegerType>(NewTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_487' href='#L_ALLOCA_487'><pre>487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NullInt = ConstantExpr::getPtrToInt(</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_488' href='#L_ALLOCA_488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantPointerNull::get(cast<PointerType>(Ptr->getType())), ITy);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_489' href='#L_ALLOCA_489'><pre>489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NonNullInt =</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_490' href='#L_ALLOCA_490'><pre>490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantExpr::getAdd(NullInt, ConstantInt::get(ITy, 1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_491' href='#L_ALLOCA_491'><pre>491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewLoad->setMetadata(LLVMContext::MD_range,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_492' href='#L_ALLOCA_492'><pre>492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MDB.createRange(NonNullInt, NullInt));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_493' href='#L_ALLOCA_493'><pre>493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_494' href='#L_ALLOCA_494'><pre>494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_495' href='#L_ALLOCA_495'><pre>495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_align:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_496' href='#L_ALLOCA_496'><pre>496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_dereferenceable:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_497' href='#L_ALLOCA_497'><pre>497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_dereferenceable_or_null:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_498' href='#L_ALLOCA_498'><pre>498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These only directly apply if the new type is also a pointer.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_499' href='#L_ALLOCA_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NewTy->isPointerTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_500' href='#L_ALLOCA_500'><pre>500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewLoad->setMetadata(ID, N)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_501' href='#L_ALLOCA_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_502' href='#L_ALLOCA_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_range:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_503' href='#L_ALLOCA_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // FIXME: It would be nice to propagate this in some way, but the type</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_504' href='#L_ALLOCA_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // conversions make it hard.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_505' href='#L_ALLOCA_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_506' href='#L_ALLOCA_506'><pre>506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If it's a pointer now and the range does not contain 0, make it !nonnull.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_507' href='#L_ALLOCA_507'><pre>507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewTy->isPointerTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_508' href='#L_ALLOCA_508'><pre>508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned BitWidth = IC.getDataLayout().getTypeSizeInBits(NewTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_509' href='#L_ALLOCA_509'><pre>509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!getConstantRangeFromMetadata(*N).contains(APInt(BitWidth, 0))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_510' href='#L_ALLOCA_510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MDNode *NN = MDNode::get(LI.getContext(), None);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_511' href='#L_ALLOCA_511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewLoad->setMetadata(LLVMContext::MD_nonnull, NN);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_512' href='#L_ALLOCA_512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_513' href='#L_ALLOCA_513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_514' href='#L_ALLOCA_514'><pre>514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_515' href='#L_ALLOCA_515'><pre>515</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_516' href='#L_ALLOCA_516'><pre>516</pre></a></td><td class='covered-line'><pre>27.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_517' href='#L_ALLOCA_517'><pre>517</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> return NewLoad;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_518' href='#L_ALLOCA_518'><pre>518</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_519' href='#L_ALLOCA_519'><pre>519</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_520' href='#L_ALLOCA_520'><pre>520</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Combine a store to a new type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_521' href='#L_ALLOCA_521'><pre>521</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_522' href='#L_ALLOCA_522'><pre>522</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Returns the newly created store instruction.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_523' href='#L_ALLOCA_523'><pre>523</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre>static StoreInst *combineStoreToNewValue(InstCombiner &IC, StoreInst &SI, Value *V) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_524' href='#L_ALLOCA_524'><pre>524</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> assert((!SI.isAtomic() || isSupportedAtomicType(V->getType())) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_525' href='#L_ALLOCA_525'><pre>525</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> "can't fold an atomic store of requested type");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_526' href='#L_ALLOCA_526'><pre>526</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> </pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_527' href='#L_ALLOCA_527'><pre>527</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> Value *Ptr = SI.getPointerOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_528' href='#L_ALLOCA_528'><pre>528</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> unsigned AS = SI.getPointerAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_529' href='#L_ALLOCA_529'><pre>529</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> SmallVector<std::pair<unsigned, MDNode *>, 8> MD;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_530' href='#L_ALLOCA_530'><pre>530</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> SI.getAllMetadata(MD);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_531' href='#L_ALLOCA_531'><pre>531</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_532' href='#L_ALLOCA_532'><pre>532</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> StoreInst *NewStore = IC.Builder->CreateAlignedStore(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_533' href='#L_ALLOCA_533'><pre>533</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> V, IC.Builder->CreateBitCast(Ptr, V->getType()->getPointerTo(AS)),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_534' href='#L_ALLOCA_534'><pre>534</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> SI.getAlignment(), SI.isVolatile());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_535' href='#L_ALLOCA_535'><pre>535</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> NewStore->setAtomic(SI.getOrdering(), SI.getSynchScope());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_536' href='#L_ALLOCA_536'><pre>536</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> for (const auto &MDPair : MD) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_537' href='#L_ALLOCA_537'><pre>537</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> unsigned ID = MDPair.first;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_538' href='#L_ALLOCA_538'><pre>538</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> MDNode *N = MDPair.second;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_539' href='#L_ALLOCA_539'><pre>539</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // Note, essentially every kind of metadata should be preserved here! This</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_540' href='#L_ALLOCA_540'><pre>540</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // routine is supposed to clone a store instruction changing *only its</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_541' href='#L_ALLOCA_541'><pre>541</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // type*. The only metadata it makes sense to drop is metadata which is</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_542' href='#L_ALLOCA_542'><pre>542</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // invalidated when the pointer type changes. This should essentially</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_543' href='#L_ALLOCA_543'><pre>543</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // never be the case in LLVM, but we explicitly switch over only known</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_544' href='#L_ALLOCA_544'><pre>544</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // metadata to be conservatively correct. If you are adding metadata to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_545' href='#L_ALLOCA_545'><pre>545</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // LLVM which pertains to stores, you almost certainly want to add it</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_546' href='#L_ALLOCA_546'><pre>546</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // here.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_547' href='#L_ALLOCA_547'><pre>547</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> switch (ID) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_548' href='#L_ALLOCA_548'><pre>548</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_dbg:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_549' href='#L_ALLOCA_549'><pre>549</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_tbaa:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_550' href='#L_ALLOCA_550'><pre>550</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_prof:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_551' href='#L_ALLOCA_551'><pre>551</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_fpmath:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_552' href='#L_ALLOCA_552'><pre>552</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_tbaa_struct:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_553' href='#L_ALLOCA_553'><pre>553</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_alias_scope:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_554' href='#L_ALLOCA_554'><pre>554</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_noalias:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_555' href='#L_ALLOCA_555'><pre>555</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_nontemporal:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_556' href='#L_ALLOCA_556'><pre>556</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> case LLVMContext::MD_mem_parallel_loop_access:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_557' href='#L_ALLOCA_557'><pre>557</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> // All of these directly apply.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_558' href='#L_ALLOCA_558'><pre>558</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> NewStore->setMetadata(ID, N);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_559' href='#L_ALLOCA_559'><pre>559</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_560' href='#L_ALLOCA_560'><pre>560</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_561' href='#L_ALLOCA_561'><pre>561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case LLVMContext::MD_invariant_load:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_562' href='#L_ALLOCA_562'><pre>562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_nonnull:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_563' href='#L_ALLOCA_563'><pre>563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_range:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_564' href='#L_ALLOCA_564'><pre>564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_align:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_565' href='#L_ALLOCA_565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_dereferenceable:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_566' href='#L_ALLOCA_566'><pre>566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case LLVMContext::MD_dereferenceable_or_null:</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_567' href='#L_ALLOCA_567'><pre>567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These don't apply for stores.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_568' href='#L_ALLOCA_568'><pre>568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_569' href='#L_ALLOCA_569'><pre>569</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_570' href='#L_ALLOCA_570'><pre>570</pre></a></td><td class='covered-line'><pre>19.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_571' href='#L_ALLOCA_571'><pre>571</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_572' href='#L_ALLOCA_572'><pre>572</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre> return NewStore;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_573' href='#L_ALLOCA_573'><pre>573</pre></a></td><td class='covered-line'><pre>20.7k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_574' href='#L_ALLOCA_574'><pre>574</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_575' href='#L_ALLOCA_575'><pre>575</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Combine loads to match the type of their uses' value after looking</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_576' href='#L_ALLOCA_576'><pre>576</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// through intervening bitcasts.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_577' href='#L_ALLOCA_577'><pre>577</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_578' href='#L_ALLOCA_578'><pre>578</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The core idea here is that if the result of a load is used in an operation,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_579' href='#L_ALLOCA_579'><pre>579</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// we should load the type most conducive to that operation. For example, when</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_580' href='#L_ALLOCA_580'><pre>580</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// loading an integer and converting that immediately to a pointer, we should</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_581' href='#L_ALLOCA_581'><pre>581</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instead directly load a pointer.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_582' href='#L_ALLOCA_582'><pre>582</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_583' href='#L_ALLOCA_583'><pre>583</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// However, this routine must never change the width of a load or the number of</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_584' href='#L_ALLOCA_584'><pre>584</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// loads as that would introduce a semantic change. This combine is expected to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_585' href='#L_ALLOCA_585'><pre>585</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// be a semantic no-op which just allows loads to more closely model the types</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_586' href='#L_ALLOCA_586'><pre>586</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// of their consuming operations.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_587' href='#L_ALLOCA_587'><pre>587</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_588' href='#L_ALLOCA_588'><pre>588</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Currently, we also refuse to change the precise type used for an atomic load</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_589' href='#L_ALLOCA_589'><pre>589</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// or a volatile load. This is debatable, and might be reasonable to change</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_590' href='#L_ALLOCA_590'><pre>590</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// later. However, it is risky in case some backend or other part of LLVM is</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_591' href='#L_ALLOCA_591'><pre>591</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// relying on the exact type loaded to select appropriate atomic operations.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_592' href='#L_ALLOCA_592'><pre>592</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre>static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_593' href='#L_ALLOCA_593'><pre>593</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // FIXME: We could probably with some care handle both volatile and ordered</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_594' href='#L_ALLOCA_594'><pre>594</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // atomic loads here but it isn't clear that this is important.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_595' href='#L_ALLOCA_595'><pre>595</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> if (!LI.isUnordered())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_596' href='#L_ALLOCA_596'><pre>596</pre></a></td><td class='covered-line'><pre>480</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_597' href='#L_ALLOCA_597'><pre>597</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_598' href='#L_ALLOCA_598'><pre>598</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.14M</span></div><div class='tooltip'>LI.use_empty()<span class='tooltip-content'>3.14M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_599' href='#L_ALLOCA_599'><pre>599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_600' href='#L_ALLOCA_600'><pre>600</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_601' href='#L_ALLOCA_601'><pre>601</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // swifterror values can't be bitcasted.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_602' href='#L_ALLOCA_602'><pre>602</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.14M</span></div><div class='tooltip'>LI.getPointerOperand()->isSwiftError()<span class='tooltip-content'>3.14M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_603' href='#L_ALLOCA_603'><pre>603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_604' href='#L_ALLOCA_604'><pre>604</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_605' href='#L_ALLOCA_605'><pre>605</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> Type *Ty = LI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_606' href='#L_ALLOCA_606'><pre>606</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> const DataLayout &DL = IC.getDataLayout();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_607' href='#L_ALLOCA_607'><pre>607</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_608' href='#L_ALLOCA_608'><pre>608</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // Try to canonicalize loads which are only ever stored to operate over</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_609' href='#L_ALLOCA_609'><pre>609</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // integers instead of any other type. We only do this when the loaded type</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_610' href='#L_ALLOCA_610'><pre>610</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // is sized and has a size exactly the same as its store size and the store</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_611' href='#L_ALLOCA_611'><pre>611</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // size is a legal integer type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_612' href='#L_ALLOCA_612'><pre>612</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> if (<div class='tooltip'>!Ty->isIntegerTy() && <span class='tooltip-content'>3.14M</span></div><div class='tooltip'>Ty->isSized()<span class='tooltip-content'>1.82M</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_613' href='#L_ALLOCA_613'><pre>613</pre></a></td><td class='covered-line'><pre>1.82M</pre></td><td class='code'><pre> DL.isLegalInteger(DL.getTypeStoreSizeInBits(Ty)) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_614' href='#L_ALLOCA_614'><pre>614</pre></a></td><td class='covered-line'><pre>1.82M</pre></td><td class='code'><pre> DL.getTypeStoreSizeInBits(Ty) == DL.getTypeSizeInBits(Ty) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_615' href='#L_ALLOCA_615'><pre>615</pre></a></td><td class='covered-line'><pre>1.82M</pre></td><td class='code'><pre> <div class='tooltip'>!DL.isNonIntegralPointerType(Ty)<span class='tooltip-content'>1.82M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.82M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_616' href='#L_ALLOCA_616'><pre>616</pre></a></td><td class='covered-line'><pre>1.83M</pre></td><td class='code'><pre> if (<div class='tooltip'>all_of(LI.users(), [&LI](User *U) <span class='tooltip-content'>1.82M</span></div><div class='tooltip'>{<span class='tooltip-content'>1.83M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_617' href='#L_ALLOCA_617'><pre>617</pre></a></td><td class='covered-line'><pre>1.83M</pre></td><td class='code'><pre> auto *SI = dyn_cast<StoreInst>(U);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_618' href='#L_ALLOCA_618'><pre>618</pre></a></td><td class='covered-line'><pre>56.3k</pre></td><td class='code'><pre> return SI && SI->getPointerOperand() != &LI &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_619' href='#L_ALLOCA_619'><pre>619</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> !SI->getPointerOperand()->isSwiftError();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_620' href='#L_ALLOCA_620'><pre>620</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> })) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_621' href='#L_ALLOCA_621'><pre>621</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> LoadInst *NewLoad = combineLoadToNewType(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_622' href='#L_ALLOCA_622'><pre>622</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> IC, LI,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_623' href='#L_ALLOCA_623'><pre>623</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> Type::getIntNTy(LI.getContext(), DL.getTypeStoreSizeInBits(Ty)));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_624' href='#L_ALLOCA_624'><pre>624</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> // Replace all the stores with stores of the newly loaded value.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_625' href='#L_ALLOCA_625'><pre>625</pre></a></td><td class='covered-line'><pre>20.0k</pre></td><td class='code'><pre> for (auto UI = LI.user_begin(), UE = LI.user_end(); <div class='tooltip'>UI != UE<span class='tooltip-content'>20.0k</span></div>;) <div class='tooltip'>{<span class='tooltip-content'>10.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_626' href='#L_ALLOCA_626'><pre>626</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> auto *SI = cast<StoreInst>(*UI++);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_627' href='#L_ALLOCA_627'><pre>627</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> IC.Builder->SetInsertPoint(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_628' href='#L_ALLOCA_628'><pre>628</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> combineStoreToNewValue(IC, *SI, NewLoad);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_629' href='#L_ALLOCA_629'><pre>629</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> IC.eraseInstFromFunction(*SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_630' href='#L_ALLOCA_630'><pre>630</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_631' href='#L_ALLOCA_631'><pre>631</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> assert(LI.use_empty() && "Failed to remove all users of the load!");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_632' href='#L_ALLOCA_632'><pre>632</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> // Return the old load so the combiner can delete it safely.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_633' href='#L_ALLOCA_633'><pre>633</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> return &LI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_634' href='#L_ALLOCA_634'><pre>634</pre></a></td><td class='covered-line'><pre>10.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_635' href='#L_ALLOCA_635'><pre>635</pre></a></td><td class='covered-line'><pre>1.82M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_636' href='#L_ALLOCA_636'><pre>636</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_637' href='#L_ALLOCA_637'><pre>637</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // Fold away bit casts of the loaded value by loading the desired type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_638' href='#L_ALLOCA_638'><pre>638</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // We can do this for BitCastInsts as well as casts from and to pointer types,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_639' href='#L_ALLOCA_639'><pre>639</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // as long as those are noops (i.e., the source or dest type have the same</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_640' href='#L_ALLOCA_640'><pre>640</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // bitwidth as the target's pointers).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_641' href='#L_ALLOCA_641'><pre>641</pre></a></td><td class='covered-line'><pre>3.13M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.13M</span></div><div class='tooltip'>LI.hasOneUse()<span class='tooltip-content'>3.13M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_642' href='#L_ALLOCA_642'><pre>642</pre></a></td><td class='covered-line'><pre>2.32M</pre></td><td class='code'><pre> <div class='tooltip'>if (auto* <span class='tooltip-content'>2.32M</span></div><div class='tooltip'>CI<span class='tooltip-content'>2.32M</span></div> = dyn_cast<CastInst>(LI.user_back()))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_643' href='#L_ALLOCA_643'><pre>643</pre></a></td><td class='covered-line'><pre>178k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>178k</span></div><div class='tooltip'>CI->isNoopCast(DL)<span class='tooltip-content'>178k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_644' href='#L_ALLOCA_644'><pre>644</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>19.9k</span></div><div class='tooltip'>!LI.isAtomic() || <span class='tooltip-content'>19.9k</span></div><div class='tooltip'><span class='red'>isSupportedAtomicType(CI->getDestTy())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_645' href='#L_ALLOCA_645'><pre>645</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> LoadInst *NewLoad = combineLoadToNewType(IC, LI, CI->getDestTy());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_646' href='#L_ALLOCA_646'><pre>646</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> CI->replaceAllUsesWith(NewLoad);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_647' href='#L_ALLOCA_647'><pre>647</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> IC.eraseInstFromFunction(*CI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_648' href='#L_ALLOCA_648'><pre>648</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> return &LI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_649' href='#L_ALLOCA_649'><pre>649</pre></a></td><td class='covered-line'><pre>19.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_650' href='#L_ALLOCA_650'><pre>650</pre></a></td><td class='covered-line'><pre>3.13M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_651' href='#L_ALLOCA_651'><pre>651</pre></a></td><td class='covered-line'><pre>3.13M</pre></td><td class='code'><pre> // FIXME: We should also canonicalize loads of vectors when their elements are</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_652' href='#L_ALLOCA_652'><pre>652</pre></a></td><td class='covered-line'><pre>3.13M</pre></td><td class='code'><pre> // cast to other types.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_653' href='#L_ALLOCA_653'><pre>653</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_654' href='#L_ALLOCA_654'><pre>654</pre></a></td><td class='covered-line'><pre>3.13M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_655' href='#L_ALLOCA_655'><pre>655</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_656' href='#L_ALLOCA_656'><pre>656</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre>static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_657' href='#L_ALLOCA_657'><pre>657</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // FIXME: We could probably with some care handle both volatile and atomic</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_658' href='#L_ALLOCA_658'><pre>658</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // stores here but it isn't clear that this is important.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_659' href='#L_ALLOCA_659'><pre>659</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (!LI.isSimple())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_660' href='#L_ALLOCA_660'><pre>660</pre></a></td><td class='covered-line'><pre>480</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_661' href='#L_ALLOCA_661'><pre>661</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_662' href='#L_ALLOCA_662'><pre>662</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> Type *T = LI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_663' href='#L_ALLOCA_663'><pre>663</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (!T->isAggregateType())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_664' href='#L_ALLOCA_664'><pre>664</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_665' href='#L_ALLOCA_665'><pre>665</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_666' href='#L_ALLOCA_666'><pre>666</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> StringRef Name = LI.getName();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_667' href='#L_ALLOCA_667'><pre>667</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> assert(LI.getAlignment() && "Alignment must be set at this point");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_668' href='#L_ALLOCA_668'><pre>668</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_669' href='#L_ALLOCA_669'><pre>669</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>ST<span class='tooltip-content'>3</span></div> = dyn_cast<StructType>(T)) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_670' href='#L_ALLOCA_670'><pre>670</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // If the struct only have one element, we unpack.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_671' href='#L_ALLOCA_671'><pre>671</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto NumElements = ST->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_672' href='#L_ALLOCA_672'><pre>672</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (<div class='tooltip'>NumElements == 1<span class='tooltip-content'>3</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_673' href='#L_ALLOCA_673'><pre>673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoadInst *NewLoad = combineLoadToNewType(IC, LI, ST->getTypeAtIndex(0U),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_674' href='#L_ALLOCA_674'><pre>674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ".unpack");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_675' href='#L_ALLOCA_675'><pre>675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.replaceInstUsesWith(LI, IC.Builder->CreateInsertValue(</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_676' href='#L_ALLOCA_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(T), NewLoad, 0, Name));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_677' href='#L_ALLOCA_677'><pre>677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_678' href='#L_ALLOCA_678'><pre>678</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_679' href='#L_ALLOCA_679'><pre>679</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // We don't want to break loads with padding here as we'd loose</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_680' href='#L_ALLOCA_680'><pre>680</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // the knowledge that padding exists for the rest of the pipeline.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_681' href='#L_ALLOCA_681'><pre>681</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> const DataLayout &DL = IC.getDataLayout();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_682' href='#L_ALLOCA_682'><pre>682</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto *SL = DL.getStructLayout(ST);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_683' href='#L_ALLOCA_683'><pre>683</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (SL->hasPadding())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_684' href='#L_ALLOCA_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_685' href='#L_ALLOCA_685'><pre>685</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_686' href='#L_ALLOCA_686'><pre>686</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto Align = LI.getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_687' href='#L_ALLOCA_687'><pre>687</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (!Align)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_688' href='#L_ALLOCA_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Align = DL.getABITypeAlignment(ST)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_689' href='#L_ALLOCA_689'><pre>689</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_690' href='#L_ALLOCA_690'><pre>690</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto *Addr = LI.getPointerOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_691' href='#L_ALLOCA_691'><pre>691</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto *IdxType = Type::getInt32Ty(T->getContext());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_692' href='#L_ALLOCA_692'><pre>692</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto *Zero = ConstantInt::get(IdxType, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_693' href='#L_ALLOCA_693'><pre>693</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_694' href='#L_ALLOCA_694'><pre>694</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *V = UndefValue::get(T);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_695' href='#L_ALLOCA_695'><pre>695</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < NumElements<span class='tooltip-content'>9</span></div>; <div class='tooltip'>i++<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_696' href='#L_ALLOCA_696'><pre>696</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *Indices[2] = {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_697' href='#L_ALLOCA_697'><pre>697</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Zero,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_698' href='#L_ALLOCA_698'><pre>698</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> ConstantInt::get(IdxType, i),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_699' href='#L_ALLOCA_699'><pre>699</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_700' href='#L_ALLOCA_700'><pre>700</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_701' href='#L_ALLOCA_701'><pre>701</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Name + ".elt");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_702' href='#L_ALLOCA_702'><pre>702</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto EltAlign = MinAlign(Align, SL->getElementOffset(i));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_703' href='#L_ALLOCA_703'><pre>703</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> auto *L = IC.Builder->CreateAlignedLoad(Ptr, EltAlign, Name + ".unpack");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_704' href='#L_ALLOCA_704'><pre>704</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> V = IC.Builder->CreateInsertValue(V, L, i);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_705' href='#L_ALLOCA_705'><pre>705</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_706' href='#L_ALLOCA_706'><pre>706</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_707' href='#L_ALLOCA_707'><pre>707</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> V->setName(Name);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_708' href='#L_ALLOCA_708'><pre>708</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return IC.replaceInstUsesWith(LI, V);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_709' href='#L_ALLOCA_709'><pre>709</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_710' href='#L_ALLOCA_710'><pre>710</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_711' href='#L_ALLOCA_711'><pre>711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ArrayType>(T)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_712' href='#L_ALLOCA_712'><pre>712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ET = AT->getElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_713' href='#L_ALLOCA_713'><pre>713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NumElements = AT->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_714' href='#L_ALLOCA_714'><pre>714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NumElements == 1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_715' href='#L_ALLOCA_715'><pre>715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LoadInst *NewLoad = combineLoadToNewType(IC, LI, ET, ".unpack");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_716' href='#L_ALLOCA_716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.replaceInstUsesWith(LI, IC.Builder->CreateInsertValue(</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_717' href='#L_ALLOCA_717'><pre>717</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(T), NewLoad, 0, Name));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_718' href='#L_ALLOCA_718'><pre>718</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_719' href='#L_ALLOCA_719'><pre>719</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_720' href='#L_ALLOCA_720'><pre>720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Bail out if the array is too large. Ideally we would like to optimize</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_721' href='#L_ALLOCA_721'><pre>721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // arrays of arbitrary size but this has a terrible impact on compile time.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_722' href='#L_ALLOCA_722'><pre>722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The threshold here is chosen arbitrarily, maybe needs a little bit of</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_723' href='#L_ALLOCA_723'><pre>723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // tuning.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_724' href='#L_ALLOCA_724'><pre>724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>NumElements > IC.MaxArraySizeForCombine</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_725' href='#L_ALLOCA_725'><pre>725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_726' href='#L_ALLOCA_726'><pre>726</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_727' href='#L_ALLOCA_727'><pre>727</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const DataLayout &DL = IC.getDataLayout();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_728' href='#L_ALLOCA_728'><pre>728</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto EltSize = DL.getTypeAllocSize(ET);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_729' href='#L_ALLOCA_729'><pre>729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Align = LI.getAlignment();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_730' href='#L_ALLOCA_730'><pre>730</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Align</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_731' href='#L_ALLOCA_731'><pre>731</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Align = DL.getABITypeAlignment(T)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_732' href='#L_ALLOCA_732'><pre>732</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_733' href='#L_ALLOCA_733'><pre>733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Addr = LI.getPointerOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_734' href='#L_ALLOCA_734'><pre>734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *IdxType = Type::getInt64Ty(T->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_735' href='#L_ALLOCA_735'><pre>735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Zero = ConstantInt::get(IdxType, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_736' href='#L_ALLOCA_736'><pre>736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_737' href='#L_ALLOCA_737'><pre>737</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = UndefValue::get(T);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_738' href='#L_ALLOCA_738'><pre>738</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint64_t Offset = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_739' href='#L_ALLOCA_739'><pre>739</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (uint64_t i = 0; </span><div class='tooltip'><span class='red'>i < NumElements</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>i++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_740' href='#L_ALLOCA_740'><pre>740</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Indices[2] = {</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_741' href='#L_ALLOCA_741'><pre>741</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Zero,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_742' href='#L_ALLOCA_742'><pre>742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(IdxType, i),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_743' href='#L_ALLOCA_743'><pre>743</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> };</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_744' href='#L_ALLOCA_744'><pre>744</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_745' href='#L_ALLOCA_745'><pre>745</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Name + ".elt");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_746' href='#L_ALLOCA_746'><pre>746</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *L = IC.Builder->CreateAlignedLoad(Ptr, MinAlign(Align, Offset),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_747' href='#L_ALLOCA_747'><pre>747</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Name + ".unpack");</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_748' href='#L_ALLOCA_748'><pre>748</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = IC.Builder->CreateInsertValue(V, L, i);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_749' href='#L_ALLOCA_749'><pre>749</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += EltSize;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_750' href='#L_ALLOCA_750'><pre>750</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_751' href='#L_ALLOCA_751'><pre>751</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_752' href='#L_ALLOCA_752'><pre>752</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V->setName(Name);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_753' href='#L_ALLOCA_753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.replaceInstUsesWith(LI, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_754' href='#L_ALLOCA_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_755' href='#L_ALLOCA_755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_756' href='#L_ALLOCA_756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_757' href='#L_ALLOCA_757'><pre>757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_758' href='#L_ALLOCA_758'><pre>758</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_759' href='#L_ALLOCA_759'><pre>759</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If we can determine that all possible objects pointed to by the provided</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_760' href='#L_ALLOCA_760'><pre>760</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// pointer value are, not only dereferenceable, but also definitively less than</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_761' href='#L_ALLOCA_761'><pre>761</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// or equal to the provided maximum size, then return true. Otherwise, return</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_762' href='#L_ALLOCA_762'><pre>762</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// false (constant global values and allocas fall into this category).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_763' href='#L_ALLOCA_763'><pre>763</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_764' href='#L_ALLOCA_764'><pre>764</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// FIXME: This should probably live in ValueTracking (or similar).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_765' href='#L_ALLOCA_765'><pre>765</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool isObjectSizeLessThanOrEq(Value *V, uint64_t MaxSize,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_766' href='#L_ALLOCA_766'><pre>766</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_767' href='#L_ALLOCA_767'><pre>767</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> SmallPtrSet<Value *, 4> Visited;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_768' href='#L_ALLOCA_768'><pre>768</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> SmallVector<Value *, 4> Worklist(1, V);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_769' href='#L_ALLOCA_769'><pre>769</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_770' href='#L_ALLOCA_770'><pre>770</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre> do {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_771' href='#L_ALLOCA_771'><pre>771</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre> Value *P = Worklist.pop_back_val();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_772' href='#L_ALLOCA_772'><pre>772</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre> P = P->stripPointerCasts();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_773' href='#L_ALLOCA_773'><pre>773</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_774' href='#L_ALLOCA_774'><pre>774</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre> if (!Visited.insert(P).second)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_775' href='#L_ALLOCA_775'><pre>775</pre></a></td><td class='covered-line'><pre>3.34k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_776' href='#L_ALLOCA_776'><pre>776</pre></a></td><td class='covered-line'><pre>513k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_777' href='#L_ALLOCA_777'><pre>777</pre></a></td><td class='covered-line'><pre>510k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>510k</span></div><div class='tooltip'>SI<span class='tooltip-content'>510k</span></div> = dyn_cast<SelectInst>(P)) <div class='tooltip'>{<span class='tooltip-content'>1.37k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_778' href='#L_ALLOCA_778'><pre>778</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> Worklist.push_back(SI->getTrueValue());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_779' href='#L_ALLOCA_779'><pre>779</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> Worklist.push_back(SI->getFalseValue());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_780' href='#L_ALLOCA_780'><pre>780</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_781' href='#L_ALLOCA_781'><pre>781</pre></a></td><td class='covered-line'><pre>1.37k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_782' href='#L_ALLOCA_782'><pre>782</pre></a></td><td class='covered-line'><pre>510k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_783' href='#L_ALLOCA_783'><pre>783</pre></a></td><td class='covered-line'><pre>509k</pre></td><td class='code'><pre> <div class='tooltip'>if (PHINode *<span class='tooltip-content'>509k</span></div><div class='tooltip'>PN<span class='tooltip-content'>509k</span></div> = dyn_cast<PHINode>(P)) <div class='tooltip'>{<span class='tooltip-content'>23.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_784' href='#L_ALLOCA_784'><pre>784</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> for (Value *IncValue : PN->incoming_values())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_785' href='#L_ALLOCA_785'><pre>785</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> Worklist.push_back(IncValue);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_786' href='#L_ALLOCA_786'><pre>786</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_787' href='#L_ALLOCA_787'><pre>787</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_788' href='#L_ALLOCA_788'><pre>788</pre></a></td><td class='covered-line'><pre>509k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_789' href='#L_ALLOCA_789'><pre>789</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> <div class='tooltip'>if (GlobalAlias *<span class='tooltip-content'>485k</span></div><div class='tooltip'>GA<span class='tooltip-content'>485k</span></div> = dyn_cast<GlobalAlias>(P)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_790' href='#L_ALLOCA_790'><pre>790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>GA->isInterposable()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_791' href='#L_ALLOCA_791'><pre>791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_792' href='#L_ALLOCA_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Worklist.push_back(GA->getAliasee());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_793' href='#L_ALLOCA_793'><pre>793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_794' href='#L_ALLOCA_794'><pre>794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_795' href='#L_ALLOCA_795'><pre>795</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_796' href='#L_ALLOCA_796'><pre>796</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // If we know how big this object is, and it is less than MaxSize, continue</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_797' href='#L_ALLOCA_797'><pre>797</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // searching. Otherwise, return false.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_798' href='#L_ALLOCA_798'><pre>798</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> <div class='tooltip'>if (AllocaInst *<span class='tooltip-content'>485k</span></div><div class='tooltip'>AI<span class='tooltip-content'>485k</span></div> = dyn_cast<AllocaInst>(P)) <div class='tooltip'>{<span class='tooltip-content'>54.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_799' href='#L_ALLOCA_799'><pre>799</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> if (!AI->getAllocatedType()->isSized())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_800' href='#L_ALLOCA_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_801' href='#L_ALLOCA_801'><pre>801</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_802' href='#L_ALLOCA_802'><pre>802</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> ConstantInt *CS = dyn_cast<ConstantInt>(AI->getArraySize());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_803' href='#L_ALLOCA_803'><pre>803</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> if (!CS)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_804' href='#L_ALLOCA_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_805' href='#L_ALLOCA_805'><pre>805</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_806' href='#L_ALLOCA_806'><pre>806</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> uint64_t TypeSize = DL.getTypeAllocSize(AI->getAllocatedType());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_807' href='#L_ALLOCA_807'><pre>807</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // Make sure that, even if the multiplication below would wrap as an</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_808' href='#L_ALLOCA_808'><pre>808</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // uint64_t, we still do the right thing.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_809' href='#L_ALLOCA_809'><pre>809</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> if ((CS->getValue().zextOrSelf(128)*APInt(128, TypeSize)).ugt(MaxSize))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_810' href='#L_ALLOCA_810'><pre>810</pre></a></td><td class='covered-line'><pre>54.6k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_811' href='#L_ALLOCA_811'><pre>811</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_812' href='#L_ALLOCA_812'><pre>812</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_813' href='#L_ALLOCA_813'><pre>813</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_814' href='#L_ALLOCA_814'><pre>814</pre></a></td><td class='covered-line'><pre>431k</pre></td><td class='code'><pre> <div class='tooltip'>if (GlobalVariable *<span class='tooltip-content'>431k</span></div><div class='tooltip'>GV<span class='tooltip-content'>431k</span></div> = dyn_cast<GlobalVariable>(P)) <div class='tooltip'>{<span class='tooltip-content'>61.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_815' href='#L_ALLOCA_815'><pre>815</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!GV->hasDefinitiveInitializer() || <span class='tooltip-content'>61.1k</span></div><div class='tooltip'>!GV->isConstant()<span class='tooltip-content'>27.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_816' href='#L_ALLOCA_816'><pre>816</pre></a></td><td class='covered-line'><pre>48.9k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_817' href='#L_ALLOCA_817'><pre>817</pre></a></td><td class='covered-line'><pre>61.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_818' href='#L_ALLOCA_818'><pre>818</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> uint64_t InitSize = DL.getTypeAllocSize(GV->getValueType());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_819' href='#L_ALLOCA_819'><pre>819</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> if (InitSize > MaxSize)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_820' href='#L_ALLOCA_820'><pre>820</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_821' href='#L_ALLOCA_821'><pre>821</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_822' href='#L_ALLOCA_822'><pre>822</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_823' href='#L_ALLOCA_823'><pre>823</pre></a></td><td class='covered-line'><pre>431k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_824' href='#L_ALLOCA_824'><pre>824</pre></a></td><td class='covered-line'><pre>370k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_825' href='#L_ALLOCA_825'><pre>825</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> } while (!Worklist.empty());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_826' href='#L_ALLOCA_826'><pre>826</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_827' href='#L_ALLOCA_827'><pre>827</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_828' href='#L_ALLOCA_828'><pre>828</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_829' href='#L_ALLOCA_829'><pre>829</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_830' href='#L_ALLOCA_830'><pre>830</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If we're indexing into an object of a known size, and the outer index is</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_831' href='#L_ALLOCA_831'><pre>831</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// not a constant, but having any value but zero would lead to undefined</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_832' href='#L_ALLOCA_832'><pre>832</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// behavior, replace it with zero.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_833' href='#L_ALLOCA_833'><pre>833</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_834' href='#L_ALLOCA_834'><pre>834</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// For example, if we have:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_835' href='#L_ALLOCA_835'><pre>835</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// @f.a = private unnamed_addr constant [1 x i32] [i32 12], align 4</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_836' href='#L_ALLOCA_836'><pre>836</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ...</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_837' href='#L_ALLOCA_837'><pre>837</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// %arrayidx = getelementptr inbounds [1 x i32]* @f.a, i64 0, i64 %x</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_838' href='#L_ALLOCA_838'><pre>838</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ... = load i32* %arrayidx, align 4</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_839' href='#L_ALLOCA_839'><pre>839</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Then we know that we can replace %x in the GEP with i64 0.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_840' href='#L_ALLOCA_840'><pre>840</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_841' href='#L_ALLOCA_841'><pre>841</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// FIXME: We could fold any GEP index to zero that would cause UB if it were</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_842' href='#L_ALLOCA_842'><pre>842</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// not zero. Currently, we only handle the first such index. Also, we could</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_843' href='#L_ALLOCA_843'><pre>843</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// also search through non-zero constant indices if we kept track of the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_844' href='#L_ALLOCA_844'><pre>844</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// offsets those indices implied.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_845' href='#L_ALLOCA_845'><pre>845</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canReplaceGEPIdxWithZero(InstCombiner &IC, GetElementPtrInst *GEPI,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_846' href='#L_ALLOCA_846'><pre>846</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> Instruction *MemI, unsigned &Idx) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_847' href='#L_ALLOCA_847'><pre>847</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> if (GEPI->getNumOperands() < 2)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_848' href='#L_ALLOCA_848'><pre>848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_849' href='#L_ALLOCA_849'><pre>849</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_850' href='#L_ALLOCA_850'><pre>850</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> // Find the first non-zero index of a GEP. If all indices are zero, return</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_851' href='#L_ALLOCA_851'><pre>851</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> // one past the last index.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_852' href='#L_ALLOCA_852'><pre>852</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> <div class='tooltip'>auto FirstNZIdx = [](const GetElementPtrInst *GEPI) <span class='tooltip-content'>2.58M</span></div><div class='tooltip'>{<span class='tooltip-content'>2.58M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_853' href='#L_ALLOCA_853'><pre>853</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> unsigned I = 1;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_854' href='#L_ALLOCA_854'><pre>854</pre></a></td><td class='covered-line'><pre>6.16M</pre></td><td class='code'><pre> for (unsigned IE = GEPI->getNumOperands(); <div class='tooltip'>I != IE<span class='tooltip-content'>6.16M</span></div>; <div class='tooltip'>++I<span class='tooltip-content'>3.57M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.77M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_855' href='#L_ALLOCA_855'><pre>855</pre></a></td><td class='covered-line'><pre>5.77M</pre></td><td class='code'><pre> Value *V = GEPI->getOperand(I);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_856' href='#L_ALLOCA_856'><pre>856</pre></a></td><td class='covered-line'><pre>5.77M</pre></td><td class='code'><pre> if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_857' href='#L_ALLOCA_857'><pre>857</pre></a></td><td class='covered-line'><pre>5.29M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.29M</span></div><div class='tooltip'>CI->isZero()<span class='tooltip-content'>5.29M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_858' href='#L_ALLOCA_858'><pre>858</pre></a></td><td class='covered-line'><pre>3.57M</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_859' href='#L_ALLOCA_859'><pre>859</pre></a></td><td class='covered-line'><pre>5.77M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_860' href='#L_ALLOCA_860'><pre>860</pre></a></td><td class='covered-line'><pre>2.20M</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_861' href='#L_ALLOCA_861'><pre>861</pre></a></td><td class='covered-line'><pre>5.77M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_862' href='#L_ALLOCA_862'><pre>862</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_863' href='#L_ALLOCA_863'><pre>863</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_864' href='#L_ALLOCA_864'><pre>864</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_865' href='#L_ALLOCA_865'><pre>865</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_866' href='#L_ALLOCA_866'><pre>866</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> // Skip through initial 'zero' indices, and find the corresponding pointer</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_867' href='#L_ALLOCA_867'><pre>867</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> // type. See if the next index is not a constant.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_868' href='#L_ALLOCA_868'><pre>868</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> Idx = FirstNZIdx(GEPI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_869' href='#L_ALLOCA_869'><pre>869</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> if (Idx == GEPI->getNumOperands())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_870' href='#L_ALLOCA_870'><pre>870</pre></a></td><td class='covered-line'><pre>388k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_871' href='#L_ALLOCA_871'><pre>871</pre></a></td><td class='covered-line'><pre>2.20M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.20M</span></div><div class='tooltip'>isa<Constant>(GEPI->getOperand(Idx))<span class='tooltip-content'>2.20M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_872' href='#L_ALLOCA_872'><pre>872</pre></a></td><td class='covered-line'><pre>1.71M</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_873' href='#L_ALLOCA_873'><pre>873</pre></a></td><td class='covered-line'><pre>2.20M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_874' href='#L_ALLOCA_874'><pre>874</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> SmallVector<Value *, 4> Ops(GEPI->idx_begin(), GEPI->idx_begin() + Idx);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_875' href='#L_ALLOCA_875'><pre>875</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> Type *AllocTy =</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_876' href='#L_ALLOCA_876'><pre>876</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> GetElementPtrInst::getIndexedType(GEPI->getSourceElementType(), Ops);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_877' href='#L_ALLOCA_877'><pre>877</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> if (<div class='tooltip'>!AllocTy || <span class='tooltip-content'>485k</span></div><div class='tooltip'>!AllocTy->isSized()<span class='tooltip-content'>485k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_878' href='#L_ALLOCA_878'><pre>878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_879' href='#L_ALLOCA_879'><pre>879</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> const DataLayout &DL = IC.getDataLayout();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_880' href='#L_ALLOCA_880'><pre>880</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> uint64_t TyAllocSize = DL.getTypeAllocSize(AllocTy);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_881' href='#L_ALLOCA_881'><pre>881</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_882' href='#L_ALLOCA_882'><pre>882</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // If there are more indices after the one we might replace with a zero, make</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_883' href='#L_ALLOCA_883'><pre>883</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // sure they're all non-negative. If any of them are negative, the overall</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_884' href='#L_ALLOCA_884'><pre>884</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // address being computed might be before the base address determined by the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_885' href='#L_ALLOCA_885'><pre>885</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // first non-zero index.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_886' href='#L_ALLOCA_886'><pre>886</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> auto IsAllNonNegative = [&]() {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_887' href='#L_ALLOCA_887'><pre>887</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> for (unsigned i = Idx+1, e = GEPI->getNumOperands(); <div class='tooltip'>i != e<span class='tooltip-content'>56</span></div>; <div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'>{<span class='tooltip-content'>56</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_888' href='#L_ALLOCA_888'><pre>888</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> bool KnownNonNegative, KnownNegative;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_889' href='#L_ALLOCA_889'><pre>889</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> IC.ComputeSignBit(GEPI->getOperand(i), KnownNonNegative,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_890' href='#L_ALLOCA_890'><pre>890</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> KnownNegative, 0, MemI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_891' href='#L_ALLOCA_891'><pre>891</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> if (KnownNonNegative)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_892' href='#L_ALLOCA_892'><pre>892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>continue</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_893' href='#L_ALLOCA_893'><pre>893</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_894' href='#L_ALLOCA_894'><pre>894</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_895' href='#L_ALLOCA_895'><pre>895</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_896' href='#L_ALLOCA_896'><pre>896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_897' href='#L_ALLOCA_897'><pre>897</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_898' href='#L_ALLOCA_898'><pre>898</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_899' href='#L_ALLOCA_899'><pre>899</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // FIXME: If the GEP is not inbounds, and there are extra indices after the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_900' href='#L_ALLOCA_900'><pre>900</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // one we'll replace, those could cause the address computation to wrap</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_901' href='#L_ALLOCA_901'><pre>901</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // (rendering the IsAllNonNegative() check below insufficient). We can do</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_902' href='#L_ALLOCA_902'><pre>902</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // better, ignoring zero indices (and other indices we can prove small</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_903' href='#L_ALLOCA_903'><pre>903</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // enough not to wrap).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_904' href='#L_ALLOCA_904'><pre>904</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> if (<div class='tooltip'>Idx+1 != GEPI->getNumOperands() && <span class='tooltip-content'>485k</span></div><div class='tooltip'>!GEPI->isInBounds()<span class='tooltip-content'>157k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_905' href='#L_ALLOCA_905'><pre>905</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_906' href='#L_ALLOCA_906'><pre>906</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_907' href='#L_ALLOCA_907'><pre>907</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // Note that isObjectSizeLessThanOrEq will return true only if the pointer is</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_908' href='#L_ALLOCA_908'><pre>908</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> // also known to be dereferenceable.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_909' href='#L_ALLOCA_909'><pre>909</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre> return isObjectSizeLessThanOrEq(GEPI->getOperand(0), TyAllocSize, DL) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_910' href='#L_ALLOCA_910'><pre>910</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> IsAllNonNegative();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_911' href='#L_ALLOCA_911'><pre>911</pre></a></td><td class='covered-line'><pre>485k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_912' href='#L_ALLOCA_912'><pre>912</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_913' href='#L_ALLOCA_913'><pre>913</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If we're indexing into an object with a variable index for the memory</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_914' href='#L_ALLOCA_914'><pre>914</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// access, but the object has only one element, we can assume that the index</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_915' href='#L_ALLOCA_915'><pre>915</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// will always be zero. If we replace the GEP, return it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_916' href='#L_ALLOCA_916'><pre>916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>template <typename T></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_917' href='#L_ALLOCA_917'><pre>917</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *replaceGEPIdxWithZero(InstCombiner &IC, Value *Ptr,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_918' href='#L_ALLOCA_918'><pre>918</pre></a></td><td class='covered-line'><pre>4.63M</pre></td><td class='code'><pre> T &MemI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_919' href='#L_ALLOCA_919'><pre>919</pre></a></td><td class='covered-line'><pre>4.63M</pre></td><td class='code'><pre> if (GetElementPtrInst *<div class='tooltip'>GEPI<span class='tooltip-content'>4.63M</span></div> = dyn_cast<GetElementPtrInst>(Ptr)) <div class='tooltip'>{<span class='tooltip-content'>2.58M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_920' href='#L_ALLOCA_920'><pre>920</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> unsigned Idx;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_921' href='#L_ALLOCA_921'><pre>921</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> if (<div class='tooltip'>canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)<span class='tooltip-content'>2.58M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_922' href='#L_ALLOCA_922'><pre>922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewGEPI = GEPI->clone();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_923' href='#L_ALLOCA_923'><pre>923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->setOperand(Idx,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_924' href='#L_ALLOCA_924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_925' href='#L_ALLOCA_925'><pre>925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->insertBefore(GEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_926' href='#L_ALLOCA_926'><pre>926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MemI.setOperand(MemI.getPointerOperandIndex(), NewGEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_927' href='#L_ALLOCA_927'><pre>927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewGEPI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_928' href='#L_ALLOCA_928'><pre>928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_929' href='#L_ALLOCA_929'><pre>929</pre></a></td><td class='covered-line'><pre>2.58M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_930' href='#L_ALLOCA_930'><pre>930</pre></a></td><td class='covered-line'><pre>4.63M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_931' href='#L_ALLOCA_931'><pre>931</pre></a></td><td class='covered-line'><pre>4.63M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_932' href='#L_ALLOCA_932'><pre>932</pre></a></td><td class='covered-line'><pre>4.63M</pre></td><td class='code'><pre>}</pre><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>InstCombineLoadStoreAlloca.cpp:llvm::Instruction* replaceGEPIdxWithZero<llvm::LoadInst>(llvm::InstCombiner&, llvm::Value*, llvm::LoadInst&)</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_918' href='#L_ALLOCA_918'><pre>918</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> T &MemI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_919' href='#L_ALLOCA_919'><pre>919</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (GetElementPtrInst *<div class='tooltip'>GEPI<span class='tooltip-content'>3.11M</span></div> = dyn_cast<GetElementPtrInst>(Ptr)) <div class='tooltip'>{<span class='tooltip-content'>1.81M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_920' href='#L_ALLOCA_920'><pre>920</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> unsigned Idx;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_921' href='#L_ALLOCA_921'><pre>921</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> if (<div class='tooltip'>canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)<span class='tooltip-content'>1.81M</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_922' href='#L_ALLOCA_922'><pre>922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewGEPI = GEPI->clone();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_923' href='#L_ALLOCA_923'><pre>923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->setOperand(Idx,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_924' href='#L_ALLOCA_924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_925' href='#L_ALLOCA_925'><pre>925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->insertBefore(GEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_926' href='#L_ALLOCA_926'><pre>926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MemI.setOperand(MemI.getPointerOperandIndex(), NewGEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_927' href='#L_ALLOCA_927'><pre>927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewGEPI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_928' href='#L_ALLOCA_928'><pre>928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_929' href='#L_ALLOCA_929'><pre>929</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_930' href='#L_ALLOCA_930'><pre>930</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_931' href='#L_ALLOCA_931'><pre>931</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_932' href='#L_ALLOCA_932'><pre>932</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre>}</pre></td></tr></table></div></div><div class='expansion-view'><div class='centered'><table><div class='source-name-title'><pre>InstCombineLoadStoreAlloca.cpp:llvm::Instruction* replaceGEPIdxWithZero<llvm::StoreInst>(llvm::InstCombiner&, llvm::Value*, llvm::StoreInst&)</pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_918' href='#L_ALLOCA_918'><pre>918</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> T &MemI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_919' href='#L_ALLOCA_919'><pre>919</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (GetElementPtrInst *<div class='tooltip'>GEPI<span class='tooltip-content'>1.51M</span></div> = dyn_cast<GetElementPtrInst>(Ptr)) <div class='tooltip'>{<span class='tooltip-content'>772k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_920' href='#L_ALLOCA_920'><pre>920</pre></a></td><td class='covered-line'><pre>772k</pre></td><td class='code'><pre> unsigned Idx;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_921' href='#L_ALLOCA_921'><pre>921</pre></a></td><td class='covered-line'><pre>772k</pre></td><td class='code'><pre> if (<div class='tooltip'>canReplaceGEPIdxWithZero(IC, GEPI, &MemI, Idx)<span class='tooltip-content'>772k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_922' href='#L_ALLOCA_922'><pre>922</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewGEPI = GEPI->clone();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_923' href='#L_ALLOCA_923'><pre>923</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->setOperand(Idx,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_924' href='#L_ALLOCA_924'><pre>924</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_925' href='#L_ALLOCA_925'><pre>925</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewGEPI->insertBefore(GEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_926' href='#L_ALLOCA_926'><pre>926</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MemI.setOperand(MemI.getPointerOperandIndex(), NewGEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_927' href='#L_ALLOCA_927'><pre>927</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewGEPI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_928' href='#L_ALLOCA_928'><pre>928</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_929' href='#L_ALLOCA_929'><pre>929</pre></a></td><td class='covered-line'><pre>772k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_930' href='#L_ALLOCA_930'><pre>930</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_931' href='#L_ALLOCA_931'><pre>931</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_932' href='#L_ALLOCA_932'><pre>932</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre>}</pre></td></tr></table></div></div></td></tr><tr><td class='line-number'><a name='L_ALLOCA_933' href='#L_ALLOCA_933'><pre>933</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_934' href='#L_ALLOCA_934'><pre>934</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_935' href='#L_ALLOCA_935'><pre>935</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> Value *Op = LI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_936' href='#L_ALLOCA_936'><pre>936</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_937' href='#L_ALLOCA_937'><pre>937</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // Try to canonicalize the loaded type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_938' href='#L_ALLOCA_938'><pre>938</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> if (Instruction *Res = combineLoadToOperationType(*this, LI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_939' href='#L_ALLOCA_939'><pre>939</pre></a></td><td class='covered-line'><pre>29.9k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_940' href='#L_ALLOCA_940'><pre>940</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_941' href='#L_ALLOCA_941'><pre>941</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // Attempt to improve the alignment.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_942' href='#L_ALLOCA_942'><pre>942</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> unsigned KnownAlign = getOrEnforceKnownAlignment(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_943' href='#L_ALLOCA_943'><pre>943</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> Op, DL.getPrefTypeAlignment(LI.getType()), DL, &LI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_944' href='#L_ALLOCA_944'><pre>944</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> unsigned LoadAlign = LI.getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_945' href='#L_ALLOCA_945'><pre>945</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> unsigned EffectiveLoadAlign =</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_946' href='#L_ALLOCA_946'><pre>946</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> LoadAlign != 0 ? <div class='tooltip'>LoadAlign<span class='tooltip-content'>3.11M</span></div> : <div class='tooltip'>DL.getABITypeAlignment(LI.getType())<span class='tooltip-content'>1.33k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_947' href='#L_ALLOCA_947'><pre>947</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_948' href='#L_ALLOCA_948'><pre>948</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (KnownAlign > EffectiveLoadAlign)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_949' href='#L_ALLOCA_949'><pre>949</pre></a></td><td class='covered-line'><pre>1.76k</pre></td><td class='code'><pre> LI.setAlignment(KnownAlign);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_950' href='#L_ALLOCA_950'><pre>950</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>3.11M</span></div><div class='tooltip'>LoadAlign == 0<span class='tooltip-content'>3.11M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_951' href='#L_ALLOCA_951'><pre>951</pre></a></td><td class='covered-line'><pre>1.21k</pre></td><td class='code'><pre> LI.setAlignment(EffectiveLoadAlign);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_952' href='#L_ALLOCA_952'><pre>952</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_953' href='#L_ALLOCA_953'><pre>953</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // Replace GEP indices if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_954' href='#L_ALLOCA_954'><pre>954</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (Instruction *<div class='tooltip'>NewGEPI<span class='tooltip-content'>3.11M</span></div> = replaceGEPIdxWithZero(*this, Op, LI)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_955' href='#L_ALLOCA_955'><pre>955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(NewGEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_956' href='#L_ALLOCA_956'><pre>956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &LI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_957' href='#L_ALLOCA_957'><pre>957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_958' href='#L_ALLOCA_958'><pre>958</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_959' href='#L_ALLOCA_959'><pre>959</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>3.11M</span></div><div class='tooltip'>Res<span class='tooltip-content'>3.11M</span></div> = unpackLoadToAggregate(*this, LI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_960' href='#L_ALLOCA_960'><pre>960</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_961' href='#L_ALLOCA_961'><pre>961</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_962' href='#L_ALLOCA_962'><pre>962</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // Do really simple store-to-load forwarding and load CSE, to catch cases</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_963' href='#L_ALLOCA_963'><pre>963</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // where there are several consecutive memory accesses to the same location,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_964' href='#L_ALLOCA_964'><pre>964</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // separated by a few arithmetic operations.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_965' href='#L_ALLOCA_965'><pre>965</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> BasicBlock::iterator BBI(LI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_966' href='#L_ALLOCA_966'><pre>966</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> bool IsLoadCSE = false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_967' href='#L_ALLOCA_967'><pre>967</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> if (Value *AvailableVal = FindAvailableLoadedValue(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_968' href='#L_ALLOCA_968'><pre>968</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> &LI, LI.getParent(), BBI, DefMaxInstsToScan, AA, &IsLoadCSE)) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_969' href='#L_ALLOCA_969'><pre>969</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> if (IsLoadCSE)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_970' href='#L_ALLOCA_970'><pre>970</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> combineMetadataForCSE(cast<LoadInst>(AvailableVal), &LI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_971' href='#L_ALLOCA_971'><pre>971</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_972' href='#L_ALLOCA_972'><pre>972</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> return replaceInstUsesWith(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_973' href='#L_ALLOCA_973'><pre>973</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> LI, Builder->CreateBitOrPointerCast(AvailableVal, LI.getType(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_974' href='#L_ALLOCA_974'><pre>974</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> LI.getName() + ".cast"));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_975' href='#L_ALLOCA_975'><pre>975</pre></a></td><td class='covered-line'><pre>8.55k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_976' href='#L_ALLOCA_976'><pre>976</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_977' href='#L_ALLOCA_977'><pre>977</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // None of the following transforms are legal for volatile/ordered atomic</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_978' href='#L_ALLOCA_978'><pre>978</pre></a></td><td class='covered-line'><pre>3.11M</pre></td><td class='code'><pre> // loads. Most of them do apply for unordered atomics.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_979' href='#L_ALLOCA_979'><pre>979</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.10M</span></div><div class='tooltip'>!LI.isUnordered()<span class='tooltip-content'>3.10M</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>480</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_980' href='#L_ALLOCA_980'><pre>980</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_981' href='#L_ALLOCA_981'><pre>981</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> // load(gep null, ...) -> unreachable</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_982' href='#L_ALLOCA_982'><pre>982</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> <div class='tooltip'>if (GetElementPtrInst *<span class='tooltip-content'>3.10M</span></div><div class='tooltip'>GEPI<span class='tooltip-content'>3.10M</span></div> = dyn_cast<GetElementPtrInst>(Op)) <div class='tooltip'>{<span class='tooltip-content'>1.81M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_983' href='#L_ALLOCA_983'><pre>983</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> const Value *GEPI0 = GEPI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_984' href='#L_ALLOCA_984'><pre>984</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> // TODO: Consider a target hook for valid address spaces for this xform.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_985' href='#L_ALLOCA_985'><pre>985</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<ConstantPointerNull>(GEPI0) && <span class='tooltip-content'>1.81M</span></div><div class='tooltip'><span class='red'>GEPI->getPointerAddressSpace() == 0</span><span class='tooltip-content'>0</span></div>)<div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_986' href='#L_ALLOCA_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert a new store to null instruction before the load to indicate</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_987' href='#L_ALLOCA_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that this code is not reachable. We do this instead of inserting</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_988' href='#L_ALLOCA_988'><pre>988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // an unreachable instruction directly because we cannot modify the</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_989' href='#L_ALLOCA_989'><pre>989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // CFG.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_990' href='#L_ALLOCA_990'><pre>990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> new StoreInst(UndefValue::get(LI.getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_991' href='#L_ALLOCA_991'><pre>991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(Op->getType()), &LI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_992' href='#L_ALLOCA_992'><pre>992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(LI, UndefValue::get(LI.getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_993' href='#L_ALLOCA_993'><pre>993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_994' href='#L_ALLOCA_994'><pre>994</pre></a></td><td class='covered-line'><pre>1.81M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_995' href='#L_ALLOCA_995'><pre>995</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_996' href='#L_ALLOCA_996'><pre>996</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> // load null/undef -> unreachable</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_997' href='#L_ALLOCA_997'><pre>997</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> // TODO: Consider a target hook for valid address spaces for this xform.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_998' href='#L_ALLOCA_998'><pre>998</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.10M</span></div><div class='tooltip'>isa<UndefValue>(Op) ||<span class='tooltip-content'>3.10M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_999' href='#L_ALLOCA_999'><pre>999</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> <div class='tooltip'>(isa<ConstantPointerNull>(Op) && <span class='tooltip-content'>3.10M</span></div><div class='tooltip'><span class='red'>LI.getPointerAddressSpace() == 0</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1000' href='#L_ALLOCA_1000'><pre>1000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert a new store to null instruction before the load to indicate that</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1001' href='#L_ALLOCA_1001'><pre>1001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // this code is not reachable. We do this instead of inserting an</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1002' href='#L_ALLOCA_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // unreachable instruction directly because we cannot modify the CFG.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1003' href='#L_ALLOCA_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> new StoreInst(UndefValue::get(LI.getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1004' href='#L_ALLOCA_1004'><pre>1004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant::getNullValue(Op->getType()), &LI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1005' href='#L_ALLOCA_1005'><pre>1005</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(LI, UndefValue::get(LI.getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1006' href='#L_ALLOCA_1006'><pre>1006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1007' href='#L_ALLOCA_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1008' href='#L_ALLOCA_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.10M</span></div><div class='tooltip'>Op->hasOneUse()<span class='tooltip-content'>3.10M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.74M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1009' href='#L_ALLOCA_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // Change select and PHI nodes to select values instead of addresses: this</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1010' href='#L_ALLOCA_1010'><pre>1010</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // helps alias analysis out a lot, allows many others simplifications, and</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1011' href='#L_ALLOCA_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // exposes redundancy in the code.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1012' href='#L_ALLOCA_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1013' href='#L_ALLOCA_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // Note that we cannot do the transformation unless we know that the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1014' href='#L_ALLOCA_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // introduced loads cannot trap! Something like this is valid as long as</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1015' href='#L_ALLOCA_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // the condition is always false: load (select bool %C, int* null, int* %G),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1016' href='#L_ALLOCA_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // but it would not be valid if we transformed it to load from null</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1017' href='#L_ALLOCA_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> // unconditionally.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1018' href='#L_ALLOCA_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1019' href='#L_ALLOCA_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> if (SelectInst *<div class='tooltip'>SI<span class='tooltip-content'>1.74M</span></div> = dyn_cast<SelectInst>(Op)) <div class='tooltip'>{<span class='tooltip-content'>5.63k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1020' href='#L_ALLOCA_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>5.63k</pre></td><td class='code'><pre> // load (select (Cond, &V1, &V2)) --> select(Cond, load &V1, load &V2).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1021' href='#L_ALLOCA_1021'><pre>1021</pre></a></td><td class='covered-line'><pre>5.63k</pre></td><td class='code'><pre> unsigned Align = LI.getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1022' href='#L_ALLOCA_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>5.63k</pre></td><td class='code'><pre> if (isSafeToLoadUnconditionally(SI->getOperand(1), Align, DL, SI) &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1023' href='#L_ALLOCA_1023'><pre>1023</pre></a></td><td class='covered-line'><pre>231</pre></td><td class='code'><pre> <div class='tooltip'>isSafeToLoadUnconditionally(SI->getOperand(2), Align, DL, SI)<span class='tooltip-content'>231</span></div>) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1024' href='#L_ALLOCA_1024'><pre>1024</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> LoadInst *V1 = Builder->CreateLoad(SI->getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1025' href='#L_ALLOCA_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> SI->getOperand(1)->getName()+".val");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1026' href='#L_ALLOCA_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> LoadInst *V2 = Builder->CreateLoad(SI->getOperand(2),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1027' href='#L_ALLOCA_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> SI->getOperand(2)->getName()+".val");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1028' href='#L_ALLOCA_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> assert(LI.isUnordered() && "implied by above");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1029' href='#L_ALLOCA_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> V1->setAlignment(Align);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1030' href='#L_ALLOCA_1030'><pre>1030</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> V1->setAtomic(LI.getOrdering(), LI.getSynchScope());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1031' href='#L_ALLOCA_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> V2->setAlignment(Align);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1032' href='#L_ALLOCA_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> V2->setAtomic(LI.getOrdering(), LI.getSynchScope());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1033' href='#L_ALLOCA_1033'><pre>1033</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> return SelectInst::Create(SI->getCondition(), V1, V2);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1034' href='#L_ALLOCA_1034'><pre>1034</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1035' href='#L_ALLOCA_1035'><pre>1035</pre></a></td><td class='covered-line'><pre>5.63k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1036' href='#L_ALLOCA_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>5.63k</pre></td><td class='code'><pre> // load (select (cond, null, P)) -> load P</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1037' href='#L_ALLOCA_1037'><pre>1037</pre></a></td><td class='covered-line'><pre>5.53k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.53k</span></div><div class='tooltip'>isa<ConstantPointerNull>(SI->getOperand(1)) &&<span class='tooltip-content'>5.53k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1038' href='#L_ALLOCA_1038'><pre>1038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>LI.getPointerAddressSpace() == 0</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1039' href='#L_ALLOCA_1039'><pre>1039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LI.setOperand(0, SI->getOperand(2));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1040' href='#L_ALLOCA_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &LI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1041' href='#L_ALLOCA_1041'><pre>1041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1042' href='#L_ALLOCA_1042'><pre>1042</pre></a></td><td class='covered-line'><pre>5.53k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1043' href='#L_ALLOCA_1043'><pre>1043</pre></a></td><td class='covered-line'><pre>5.53k</pre></td><td class='code'><pre> // load (select (cond, P, null)) -> load P</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1044' href='#L_ALLOCA_1044'><pre>1044</pre></a></td><td class='covered-line'><pre>5.53k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.53k</span></div><div class='tooltip'>isa<ConstantPointerNull>(SI->getOperand(2)) &&<span class='tooltip-content'>5.53k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1045' href='#L_ALLOCA_1045'><pre>1045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>LI.getPointerAddressSpace() == 0</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1046' href='#L_ALLOCA_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LI.setOperand(0, SI->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1047' href='#L_ALLOCA_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &LI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1048' href='#L_ALLOCA_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1049' href='#L_ALLOCA_1049'><pre>1049</pre></a></td><td class='covered-line'><pre>5.53k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1050' href='#L_ALLOCA_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>1.74M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1051' href='#L_ALLOCA_1051'><pre>1051</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1052' href='#L_ALLOCA_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>3.10M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1053' href='#L_ALLOCA_1053'><pre>1053</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1054' href='#L_ALLOCA_1054'><pre>1054</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Look for extractelement/insertvalue sequence that acts like a bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1055' href='#L_ALLOCA_1055'><pre>1055</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1056' href='#L_ALLOCA_1056'><pre>1056</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \returns underlying value that was "cast", or nullptr otherwise.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1057' href='#L_ALLOCA_1057'><pre>1057</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1058' href='#L_ALLOCA_1058'><pre>1058</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For example, if we have:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1059' href='#L_ALLOCA_1059'><pre>1059</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1060' href='#L_ALLOCA_1060'><pre>1060</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %E0 = extractelement <2 x double> %U, i32 0</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1061' href='#L_ALLOCA_1061'><pre>1061</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %V0 = insertvalue [2 x double] undef, double %E0, 0</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1062' href='#L_ALLOCA_1062'><pre>1062</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %E1 = extractelement <2 x double> %U, i32 1</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1063' href='#L_ALLOCA_1063'><pre>1063</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %V1 = insertvalue [2 x double] %V0, double %E1, 1</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1064' href='#L_ALLOCA_1064'><pre>1064</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1065' href='#L_ALLOCA_1065'><pre>1065</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and the layout of a <2 x double> is isomorphic to a [2 x double],</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1066' href='#L_ALLOCA_1066'><pre>1066</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// then %V1 can be safely approximated by a conceptual "bitcast" of %U.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1067' href='#L_ALLOCA_1067'><pre>1067</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Note that %U may contain non-undef values where %V1 has undef.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1068' href='#L_ALLOCA_1068'><pre>1068</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre>static Value *likeBitCastFromVector(InstCombiner &IC, Value *V) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1069' href='#L_ALLOCA_1069'><pre>1069</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> Value *U = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1070' href='#L_ALLOCA_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> while (auto *<div class='tooltip'>IV<span class='tooltip-content'>1.51M</span></div> = dyn_cast<InsertValueInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1071' href='#L_ALLOCA_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> auto *E = dyn_cast<ExtractElementInst>(IV->getInsertedValueOperand());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1072' href='#L_ALLOCA_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (!E)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1073' href='#L_ALLOCA_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1074' href='#L_ALLOCA_1074'><pre>1074</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>auto *W = E->getVectorOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1075' href='#L_ALLOCA_1075'><pre>1075</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!U</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1076' href='#L_ALLOCA_1076'><pre>1076</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>U = W</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1077' href='#L_ALLOCA_1077'><pre>1077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>U != W</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1078' href='#L_ALLOCA_1078'><pre>1078</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1079' href='#L_ALLOCA_1079'><pre>1079</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *CI = dyn_cast<ConstantInt>(E->getIndexOperand());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1080' href='#L_ALLOCA_1080'><pre>1080</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CI || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>IV->getNumIndices() != 1</span><span class='tooltip-content'>0</span></div><span class='red'> || </span><div class='tooltip'><span class='red'>CI->getZExtValue() != *IV->idx_begin()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1081' href='#L_ALLOCA_1081'><pre>1081</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1082' href='#L_ALLOCA_1082'><pre>1082</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>V = IV->getAggregateOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1083' href='#L_ALLOCA_1083'><pre>1083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1084' href='#L_ALLOCA_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>!isa<UndefValue>(V) ||<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>!U<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1085' href='#L_ALLOCA_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1086' href='#L_ALLOCA_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1087' href='#L_ALLOCA_1087'><pre>1087</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>auto *UT = cast<VectorType>(U->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1088' href='#L_ALLOCA_1088'><pre>1088</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *VT = V->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1089' href='#L_ALLOCA_1089'><pre>1089</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Check that types UT and VT are bitwise isomorphic.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1090' href='#L_ALLOCA_1090'><pre>1090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const auto &DL = IC.getDataLayout();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1091' href='#L_ALLOCA_1091'><pre>1091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>DL.getTypeStoreSizeInBits(UT) != DL.getTypeStoreSizeInBits(VT)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1092' href='#L_ALLOCA_1092'><pre>1092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1093' href='#L_ALLOCA_1093'><pre>1093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1094' href='#L_ALLOCA_1094'><pre>1094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ArrayType>(VT)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1095' href='#L_ALLOCA_1095'><pre>1095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>AT->getNumElements() != UT->getNumElements()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1096' href='#L_ALLOCA_1096'><pre>1096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1097' href='#L_ALLOCA_1097'><pre>1097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1098' href='#L_ALLOCA_1098'><pre>1098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ST = cast<StructType>(VT);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1099' href='#L_ALLOCA_1099'><pre>1099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>ST->getNumElements() != UT->getNumElements()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1100' href='#L_ALLOCA_1100'><pre>1100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1101' href='#L_ALLOCA_1101'><pre>1101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>for (const auto *EltT : ST->elements()) </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1102' href='#L_ALLOCA_1102'><pre>1102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>EltT != UT->getElementType()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1103' href='#L_ALLOCA_1103'><pre>1103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1104' href='#L_ALLOCA_1104'><pre>1104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1105' href='#L_ALLOCA_1105'><pre>1105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1106' href='#L_ALLOCA_1106'><pre>1106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return U</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1107' href='#L_ALLOCA_1107'><pre>1107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1108' href='#L_ALLOCA_1108'><pre>1108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1109' href='#L_ALLOCA_1109'><pre>1109</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Combine stores to match the type of value being stored.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1110' href='#L_ALLOCA_1110'><pre>1110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1111' href='#L_ALLOCA_1111'><pre>1111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The core idea here is that the memory does not have any intrinsic type and</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1112' href='#L_ALLOCA_1112'><pre>1112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where we can we should match the type of a store to the type of value being</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1113' href='#L_ALLOCA_1113'><pre>1113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// stored.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1114' href='#L_ALLOCA_1114'><pre>1114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1115' href='#L_ALLOCA_1115'><pre>1115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// However, this routine must never change the width of a store or the number of</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1116' href='#L_ALLOCA_1116'><pre>1116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// stores as that would introduce a semantic change. This combine is expected to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1117' href='#L_ALLOCA_1117'><pre>1117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// be a semantic no-op which just allows stores to more closely model the types</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1118' href='#L_ALLOCA_1118'><pre>1118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// of their incoming values.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1119' href='#L_ALLOCA_1119'><pre>1119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1120' href='#L_ALLOCA_1120'><pre>1120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Currently, we also refuse to change the precise type used for an atomic or</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1121' href='#L_ALLOCA_1121'><pre>1121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// volatile store. This is debatable, and might be reasonable to change later.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1122' href='#L_ALLOCA_1122'><pre>1122</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// However, it is risky in case some backend or other part of LLVM is relying</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1123' href='#L_ALLOCA_1123'><pre>1123</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// on the exact type stored to select appropriate atomic operations.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1124' href='#L_ALLOCA_1124'><pre>1124</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1125' href='#L_ALLOCA_1125'><pre>1125</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \returns true if the store was successfully combined away. This indicates</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1126' href='#L_ALLOCA_1126'><pre>1126</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the caller must erase the store instruction. We have to let the caller erase</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1127' href='#L_ALLOCA_1127'><pre>1127</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the store instruction as otherwise there is no way to signal whether it was</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1128' href='#L_ALLOCA_1128'><pre>1128</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// combined or not: IC.EraseInstFromFunction returns a null pointer.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1129' href='#L_ALLOCA_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre>static bool combineStoreToValueType(InstCombiner &IC, StoreInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1130' href='#L_ALLOCA_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // FIXME: We could probably with some care handle both volatile and ordered</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1131' href='#L_ALLOCA_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // atomic stores here but it isn't clear that this is important.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1132' href='#L_ALLOCA_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> if (!SI.isUnordered())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1133' href='#L_ALLOCA_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1134' href='#L_ALLOCA_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1135' href='#L_ALLOCA_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // swifterror values can't be bitcasted.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1136' href='#L_ALLOCA_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.52M</span></div><div class='tooltip'>SI.getPointerOperand()->isSwiftError()<span class='tooltip-content'>1.52M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1137' href='#L_ALLOCA_1137'><pre>1137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1138' href='#L_ALLOCA_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1139' href='#L_ALLOCA_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> Value *V = SI.getValueOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1140' href='#L_ALLOCA_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1141' href='#L_ALLOCA_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // Fold away bit casts of the stored value by storing the original type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1142' href='#L_ALLOCA_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>BC<span class='tooltip-content'>1.52M</span></div> = dyn_cast<BitCastInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>10.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1143' href='#L_ALLOCA_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> V = BC->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1144' href='#L_ALLOCA_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>!SI.isAtomic() || <span class='tooltip-content'>10.6k</span></div><div class='tooltip'><span class='red'>isSupportedAtomicType(V->getType())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1145' href='#L_ALLOCA_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> combineStoreToNewValue(IC, SI, V);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1146' href='#L_ALLOCA_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1147' href='#L_ALLOCA_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1148' href='#L_ALLOCA_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1149' href='#L_ALLOCA_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1150' href='#L_ALLOCA_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>U<span class='tooltip-content'>1.51M</span></div> = likeBitCastFromVector(IC, V))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1151' href='#L_ALLOCA_1151'><pre>1151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!SI.isAtomic() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isSupportedAtomicType(U->getType())</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1152' href='#L_ALLOCA_1152'><pre>1152</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> combineStoreToNewValue(IC, SI, U);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1153' href='#L_ALLOCA_1153'><pre>1153</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1154' href='#L_ALLOCA_1154'><pre>1154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1155' href='#L_ALLOCA_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1156' href='#L_ALLOCA_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // FIXME: We should also canonicalize stores of vectors when their elements</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1157' href='#L_ALLOCA_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // are cast to other types.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1158' href='#L_ALLOCA_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1159' href='#L_ALLOCA_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1160' href='#L_ALLOCA_1160'><pre>1160</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1161' href='#L_ALLOCA_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre>static bool unpackStoreToAggregate(InstCombiner &IC, StoreInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1162' href='#L_ALLOCA_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // FIXME: We could probably with some care handle both volatile and atomic</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1163' href='#L_ALLOCA_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // stores here but it isn't clear that this is important.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1164' href='#L_ALLOCA_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (!SI.isSimple())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1165' href='#L_ALLOCA_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1166' href='#L_ALLOCA_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1167' href='#L_ALLOCA_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> Value *V = SI.getValueOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1168' href='#L_ALLOCA_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> Type *T = V->getType();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1169' href='#L_ALLOCA_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1170' href='#L_ALLOCA_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (!T->isAggregateType())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1171' href='#L_ALLOCA_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1172' href='#L_ALLOCA_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1173' href='#L_ALLOCA_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>2</span></div><div class='tooltip'>ST<span class='tooltip-content'>2</span></div> = dyn_cast<StructType>(T)) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1174' href='#L_ALLOCA_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // If the struct only have one element, we unpack.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1175' href='#L_ALLOCA_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> unsigned Count = ST->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1176' href='#L_ALLOCA_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>Count == 1<span class='tooltip-content'>2</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1177' href='#L_ALLOCA_1177'><pre>1177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = IC.Builder->CreateExtractValue(V, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1178' href='#L_ALLOCA_1178'><pre>1178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> combineStoreToNewValue(IC, SI, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1179' href='#L_ALLOCA_1179'><pre>1179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1180' href='#L_ALLOCA_1180'><pre>1180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1181' href='#L_ALLOCA_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1182' href='#L_ALLOCA_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // We don't want to break loads with padding here as we'd loose</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1183' href='#L_ALLOCA_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // the knowledge that padding exists for the rest of the pipeline.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1184' href='#L_ALLOCA_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> const DataLayout &DL = IC.getDataLayout();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1185' href='#L_ALLOCA_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto *SL = DL.getStructLayout(ST);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1186' href='#L_ALLOCA_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (SL->hasPadding())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1187' href='#L_ALLOCA_1187'><pre>1187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1188' href='#L_ALLOCA_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1189' href='#L_ALLOCA_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto Align = SI.getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1190' href='#L_ALLOCA_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (!Align)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1191' href='#L_ALLOCA_1191'><pre>1191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Align = DL.getABITypeAlignment(ST)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1192' href='#L_ALLOCA_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1193' href='#L_ALLOCA_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> SmallString<16> EltName = V->getName();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1194' href='#L_ALLOCA_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> EltName += ".elt";</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1195' href='#L_ALLOCA_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto *Addr = SI.getPointerOperand();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1196' href='#L_ALLOCA_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> SmallString<16> AddrName = Addr->getName();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1197' href='#L_ALLOCA_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> AddrName += ".repack";</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1198' href='#L_ALLOCA_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1199' href='#L_ALLOCA_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto *IdxType = Type::getInt32Ty(ST->getContext());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1200' href='#L_ALLOCA_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto *Zero = ConstantInt::get(IdxType, 0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1201' href='#L_ALLOCA_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < Count<span class='tooltip-content'>6</span></div>; <div class='tooltip'>i++<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1202' href='#L_ALLOCA_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *Indices[2] = {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1203' href='#L_ALLOCA_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Zero,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1204' href='#L_ALLOCA_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ConstantInt::get(IdxType, i),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1205' href='#L_ALLOCA_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1206' href='#L_ALLOCA_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> auto *Ptr = IC.Builder->CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1207' href='#L_ALLOCA_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> AddrName);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1208' href='#L_ALLOCA_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> auto *Val = IC.Builder->CreateExtractValue(V, i, EltName);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1209' href='#L_ALLOCA_1209'><pre>1209</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> auto EltAlign = MinAlign(Align, SL->getElementOffset(i));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1210' href='#L_ALLOCA_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> IC.Builder->CreateAlignedStore(Val, Ptr, EltAlign);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1211' href='#L_ALLOCA_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1212' href='#L_ALLOCA_1212'><pre>1212</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1213' href='#L_ALLOCA_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1214' href='#L_ALLOCA_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1215' href='#L_ALLOCA_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1216' href='#L_ALLOCA_1216'><pre>1216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (auto *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>AT</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ArrayType>(T)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1217' href='#L_ALLOCA_1217'><pre>1217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the array only have one element, we unpack.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1218' href='#L_ALLOCA_1218'><pre>1218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto NumElements = AT->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1219' href='#L_ALLOCA_1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NumElements == 1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1220' href='#L_ALLOCA_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = IC.Builder->CreateExtractValue(V, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1221' href='#L_ALLOCA_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> combineStoreToNewValue(IC, SI, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1222' href='#L_ALLOCA_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1223' href='#L_ALLOCA_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1224' href='#L_ALLOCA_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1225' href='#L_ALLOCA_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Bail out if the array is too large. Ideally we would like to optimize</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1226' href='#L_ALLOCA_1226'><pre>1226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // arrays of arbitrary size but this has a terrible impact on compile time.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1227' href='#L_ALLOCA_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The threshold here is chosen arbitrarily, maybe needs a little bit of</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1228' href='#L_ALLOCA_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // tuning.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1229' href='#L_ALLOCA_1229'><pre>1229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>NumElements > IC.MaxArraySizeForCombine</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1230' href='#L_ALLOCA_1230'><pre>1230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1231' href='#L_ALLOCA_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1232' href='#L_ALLOCA_1232'><pre>1232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>const DataLayout &DL = IC.getDataLayout();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1233' href='#L_ALLOCA_1233'><pre>1233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto EltSize = DL.getTypeAllocSize(AT->getElementType());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1234' href='#L_ALLOCA_1234'><pre>1234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Align = SI.getAlignment();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1235' href='#L_ALLOCA_1235'><pre>1235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Align</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1236' href='#L_ALLOCA_1236'><pre>1236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Align = DL.getABITypeAlignment(T)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1237' href='#L_ALLOCA_1237'><pre>1237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1238' href='#L_ALLOCA_1238'><pre>1238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallString<16> EltName = V->getName();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1239' href='#L_ALLOCA_1239'><pre>1239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltName += ".elt";</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1240' href='#L_ALLOCA_1240'><pre>1240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Addr = SI.getPointerOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1241' href='#L_ALLOCA_1241'><pre>1241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallString<16> AddrName = Addr->getName();</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1242' href='#L_ALLOCA_1242'><pre>1242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddrName += ".repack";</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1243' href='#L_ALLOCA_1243'><pre>1243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1244' href='#L_ALLOCA_1244'><pre>1244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *IdxType = Type::getInt64Ty(T->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1245' href='#L_ALLOCA_1245'><pre>1245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Zero = ConstantInt::get(IdxType, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1246' href='#L_ALLOCA_1246'><pre>1246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1247' href='#L_ALLOCA_1247'><pre>1247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> uint64_t Offset = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1248' href='#L_ALLOCA_1248'><pre>1248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (uint64_t i = 0; </span><div class='tooltip'><span class='red'>i < NumElements</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>i++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1249' href='#L_ALLOCA_1249'><pre>1249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Indices[2] = {</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1250' href='#L_ALLOCA_1250'><pre>1250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Zero,</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1251' href='#L_ALLOCA_1251'><pre>1251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(IdxType, i),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1252' href='#L_ALLOCA_1252'><pre>1252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> };</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1253' href='#L_ALLOCA_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Ptr = IC.Builder->CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices),</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1254' href='#L_ALLOCA_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AddrName);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1255' href='#L_ALLOCA_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Val = IC.Builder->CreateExtractValue(V, i, EltName);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1256' href='#L_ALLOCA_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto EltAlign = MinAlign(Align, Offset);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1257' href='#L_ALLOCA_1257'><pre>1257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.Builder->CreateAlignedStore(Val, Ptr, EltAlign);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1258' href='#L_ALLOCA_1258'><pre>1258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset += EltSize;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1259' href='#L_ALLOCA_1259'><pre>1259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1260' href='#L_ALLOCA_1260'><pre>1260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1261' href='#L_ALLOCA_1261'><pre>1261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1262' href='#L_ALLOCA_1262'><pre>1262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1263' href='#L_ALLOCA_1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1264' href='#L_ALLOCA_1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1265' href='#L_ALLOCA_1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1266' href='#L_ALLOCA_1266'><pre>1266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1267' href='#L_ALLOCA_1267'><pre>1267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// equivalentAddressValues - Test if A and B will obviously have the same</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1268' href='#L_ALLOCA_1268'><pre>1268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// value. This includes recognizing that %t0 and %t1 will have the same</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1269' href='#L_ALLOCA_1269'><pre>1269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// value in code like this:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1270' href='#L_ALLOCA_1270'><pre>1270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %t0 = getelementptr \@a, 0, 3</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1271' href='#L_ALLOCA_1271'><pre>1271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// store i32 0, i32* %t0</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1272' href='#L_ALLOCA_1272'><pre>1272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %t1 = getelementptr \@a, 0, 3</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1273' href='#L_ALLOCA_1273'><pre>1273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %t2 = load i32* %t1</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1274' href='#L_ALLOCA_1274'><pre>1274</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1275' href='#L_ALLOCA_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre>static bool equivalentAddressValues(Value *A, Value *B) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1276' href='#L_ALLOCA_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // Test if the values are trivially equivalent.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1277' href='#L_ALLOCA_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> if (<div class='tooltip'>A == B<span class='tooltip-content'>716k</span></div>) <div class='tooltip'>return true<span class='tooltip-content'>285</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1278' href='#L_ALLOCA_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1279' href='#L_ALLOCA_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // Test if the values come form identical arithmetic instructions.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1280' href='#L_ALLOCA_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // This uses isIdenticalToWhenDefined instead of isIdenticalTo because</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1281' href='#L_ALLOCA_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // its only used to compare two uses within the same basic block, which</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1282' href='#L_ALLOCA_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // means that they'll always either have the same value or one of them</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1283' href='#L_ALLOCA_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // will have an undefined value.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1284' href='#L_ALLOCA_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>716k</span></div><div class='tooltip'>isa<BinaryOperator>(A) ||<span class='tooltip-content'>716k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1285' href='#L_ALLOCA_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> isa<CastInst>(A) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1286' href='#L_ALLOCA_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>463k</pre></td><td class='code'><pre> isa<PHINode>(A) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1287' href='#L_ALLOCA_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>453k</pre></td><td class='code'><pre> isa<GetElementPtrInst>(A))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1288' href='#L_ALLOCA_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>613k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>613k</span></div><div class='tooltip'>BI<span class='tooltip-content'>613k</span></div> = dyn_cast<Instruction>(B))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1289' href='#L_ALLOCA_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>575k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>575k</span></div><div class='tooltip'>cast<Instruction>(A)->isIdenticalToWhenDefined(BI)<span class='tooltip-content'>575k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1290' href='#L_ALLOCA_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>816</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1291' href='#L_ALLOCA_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1292' href='#L_ALLOCA_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre> // Otherwise they may not be equivalent.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1293' href='#L_ALLOCA_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>715k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1294' href='#L_ALLOCA_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>716k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1295' href='#L_ALLOCA_1295'><pre>1295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1296' href='#L_ALLOCA_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1297' href='#L_ALLOCA_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> Value *Val = SI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1298' href='#L_ALLOCA_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> Value *Ptr = SI.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1299' href='#L_ALLOCA_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1300' href='#L_ALLOCA_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // Try to canonicalize the stored type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1301' href='#L_ALLOCA_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> if (combineStoreToValueType(*this, SI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1302' href='#L_ALLOCA_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>10.6k</pre></td><td class='code'><pre> return eraseInstFromFunction(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1303' href='#L_ALLOCA_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1304' href='#L_ALLOCA_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> // Attempt to improve the alignment.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1305' href='#L_ALLOCA_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> unsigned KnownAlign = getOrEnforceKnownAlignment(</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1306' href='#L_ALLOCA_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> Ptr, DL.getPrefTypeAlignment(Val->getType()), DL, &SI, &AC, &DT);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1307' href='#L_ALLOCA_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> unsigned StoreAlign = SI.getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1308' href='#L_ALLOCA_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> unsigned EffectiveStoreAlign =</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1309' href='#L_ALLOCA_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> StoreAlign != 0 ? <div class='tooltip'>StoreAlign<span class='tooltip-content'>1.51M</span></div> : <div class='tooltip'>DL.getABITypeAlignment(Val->getType())<span class='tooltip-content'>200</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1310' href='#L_ALLOCA_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1311' href='#L_ALLOCA_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (KnownAlign > EffectiveStoreAlign)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1312' href='#L_ALLOCA_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>6.29k</pre></td><td class='code'><pre> SI.setAlignment(KnownAlign);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1313' href='#L_ALLOCA_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>StoreAlign == 0<span class='tooltip-content'>1.51M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1314' href='#L_ALLOCA_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>102</pre></td><td class='code'><pre> SI.setAlignment(EffectiveStoreAlign);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1315' href='#L_ALLOCA_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1316' href='#L_ALLOCA_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // Try to canonicalize the stored type.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1317' href='#L_ALLOCA_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (unpackStoreToAggregate(*this, SI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1318' href='#L_ALLOCA_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return eraseInstFromFunction(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1319' href='#L_ALLOCA_1319'><pre>1319</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1320' href='#L_ALLOCA_1320'><pre>1320</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // Replace GEP indices if possible.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1321' href='#L_ALLOCA_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>NewGEPI<span class='tooltip-content'>1.51M</span></div> = replaceGEPIdxWithZero(*this, Ptr, SI)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1322' href='#L_ALLOCA_1322'><pre>1322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(NewGEPI);</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1323' href='#L_ALLOCA_1323'><pre>1323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &SI;</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1324' href='#L_ALLOCA_1324'><pre>1324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1325' href='#L_ALLOCA_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1326' href='#L_ALLOCA_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // Don't hack volatile/ordered stores.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1327' href='#L_ALLOCA_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // FIXME: Some bits are legal for ordered atomic stores; needs refactoring.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1328' href='#L_ALLOCA_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>!SI.isUnordered()<span class='tooltip-content'>1.51M</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>24</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1329' href='#L_ALLOCA_1329'><pre>1329</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1330' href='#L_ALLOCA_1330'><pre>1330</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // If the RHS is an alloca with a single use, zapify the store, making the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1331' href='#L_ALLOCA_1331'><pre>1331</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // alloca dead.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1332' href='#L_ALLOCA_1332'><pre>1332</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>Ptr->hasOneUse()<span class='tooltip-content'>1.51M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>908k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1333' href='#L_ALLOCA_1333'><pre>1333</pre></a></td><td class='covered-line'><pre>908k</pre></td><td class='code'><pre> if (isa<AllocaInst>(Ptr))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1334' href='#L_ALLOCA_1334'><pre>1334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return eraseInstFromFunction(SI)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1335' href='#L_ALLOCA_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>908k</pre></td><td class='code'><pre> <div class='tooltip'>if (GetElementPtrInst *<span class='tooltip-content'>908k</span></div><div class='tooltip'>GEP<span class='tooltip-content'>908k</span></div> = dyn_cast<GetElementPtrInst>(Ptr)) <div class='tooltip'>{<span class='tooltip-content'>494k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1336' href='#L_ALLOCA_1336'><pre>1336</pre></a></td><td class='covered-line'><pre>494k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<AllocaInst>(GEP->getOperand(0))<span class='tooltip-content'>494k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>105k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1337' href='#L_ALLOCA_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>105k</pre></td><td class='code'><pre> if (GEP->getOperand(0)->hasOneUse())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1338' href='#L_ALLOCA_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return eraseInstFromFunction(SI)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1339' href='#L_ALLOCA_1339'><pre>1339</pre></a></td><td class='covered-line'><pre>105k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1340' href='#L_ALLOCA_1340'><pre>1340</pre></a></td><td class='covered-line'><pre>494k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1341' href='#L_ALLOCA_1341'><pre>1341</pre></a></td><td class='covered-line'><pre>908k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1342' href='#L_ALLOCA_1342'><pre>1342</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1343' href='#L_ALLOCA_1343'><pre>1343</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // Do really simple DSE, to catch cases where there are several consecutive</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1344' href='#L_ALLOCA_1344'><pre>1344</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // stores to the same location, separated by a few arithmetic operations. This</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1345' href='#L_ALLOCA_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // situation often occurs with bitfield accesses.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1346' href='#L_ALLOCA_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> BasicBlock::iterator BBI(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1347' href='#L_ALLOCA_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>3.45M</pre></td><td class='code'><pre> for (unsigned ScanInsts = 6; <div class='tooltip'>BBI != SI.getParent()->begin() && <span class='tooltip-content'>3.45M</span></div><div class='tooltip'>ScanInsts<span class='tooltip-content'>3.17M</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1348' href='#L_ALLOCA_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> <div class='tooltip'>--ScanInsts<span class='tooltip-content'>1.93M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.14M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1349' href='#L_ALLOCA_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> --BBI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1350' href='#L_ALLOCA_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // Don't count debug info directives, lest they affect codegen,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1351' href='#L_ALLOCA_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> // and we skip pointer-to-pointer bitcasts, which are NOPs.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1352' href='#L_ALLOCA_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> if (isa<DbgInfoIntrinsic>(BBI) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1353' href='#L_ALLOCA_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre> <div class='tooltip'>(isa<BitCastInst>(BBI) && <span class='tooltip-content'>3.14M</span></div><div class='tooltip'>BBI->getType()->isPointerTy()<span class='tooltip-content'>383k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>382k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1354' href='#L_ALLOCA_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>382k</pre></td><td class='code'><pre> ScanInsts++;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1355' href='#L_ALLOCA_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>382k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1356' href='#L_ALLOCA_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>382k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1357' href='#L_ALLOCA_1357'><pre>1357</pre></a></td><td class='covered-line'><pre>3.14M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1358' href='#L_ALLOCA_1358'><pre>1358</pre></a></td><td class='covered-line'><pre>2.76M</pre></td><td class='code'><pre> <div class='tooltip'>if (StoreInst *<span class='tooltip-content'>2.76M</span></div><div class='tooltip'>PrevSI<span class='tooltip-content'>2.76M</span></div> = dyn_cast<StoreInst>(BBI)) <div class='tooltip'>{<span class='tooltip-content'>475k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1359' href='#L_ALLOCA_1359'><pre>1359</pre></a></td><td class='covered-line'><pre>475k</pre></td><td class='code'><pre> // Prev store isn't volatile, and stores to the same location?</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1360' href='#L_ALLOCA_1360'><pre>1360</pre></a></td><td class='covered-line'><pre>475k</pre></td><td class='code'><pre> if (<div class='tooltip'>PrevSI->isUnordered() && <span class='tooltip-content'>475k</span></div><div class='tooltip'>equivalentAddressValues(PrevSI->getOperand(1),<span class='tooltip-content'>475k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1361' href='#L_ALLOCA_1361'><pre>1361</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> SI.getOperand(1))) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1362' href='#L_ALLOCA_1362'><pre>1362</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> ++NumDeadStore;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1363' href='#L_ALLOCA_1363'><pre>1363</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> ++BBI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1364' href='#L_ALLOCA_1364'><pre>1364</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> eraseInstFromFunction(*PrevSI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1365' href='#L_ALLOCA_1365'><pre>1365</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1366' href='#L_ALLOCA_1366'><pre>1366</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1367' href='#L_ALLOCA_1367'><pre>1367</pre></a></td><td class='covered-line'><pre>474k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1368' href='#L_ALLOCA_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>475k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1369' href='#L_ALLOCA_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>2.76M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1370' href='#L_ALLOCA_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>2.76M</pre></td><td class='code'><pre> // If this is a load, we have to stop. However, if the loaded value is from</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1371' href='#L_ALLOCA_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>2.76M</pre></td><td class='code'><pre> // the pointer we're loading and is producing the pointer we're storing,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1372' href='#L_ALLOCA_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>2.76M</pre></td><td class='code'><pre> // then *this* store is dead (X = load P; store X -> P).</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1373' href='#L_ALLOCA_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>2.28M</pre></td><td class='code'><pre> <div class='tooltip'>if (LoadInst *<span class='tooltip-content'>2.28M</span></div><div class='tooltip'>LI<span class='tooltip-content'>2.28M</span></div> = dyn_cast<LoadInst>(BBI)) <div class='tooltip'>{<span class='tooltip-content'>579k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1374' href='#L_ALLOCA_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre> if (<div class='tooltip'>LI == Val && <span class='tooltip-content'>579k</span></div><div class='tooltip'>equivalentAddressValues(LI->getOperand(0), Ptr)<span class='tooltip-content'>241k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1375' href='#L_ALLOCA_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> assert(SI.isUnordered() && "can't eliminate ordering operation");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1376' href='#L_ALLOCA_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return eraseInstFromFunction(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1377' href='#L_ALLOCA_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1378' href='#L_ALLOCA_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1379' href='#L_ALLOCA_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre> // Otherwise, this is a load from some other location. Stores before it</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1380' href='#L_ALLOCA_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre> // may not be dead.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1381' href='#L_ALLOCA_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1382' href='#L_ALLOCA_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>579k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1383' href='#L_ALLOCA_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>2.28M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1384' href='#L_ALLOCA_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>2.28M</pre></td><td class='code'><pre> // Don't skip over loads, throws or things that can modify memory.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1385' href='#L_ALLOCA_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>1.70M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.70M</span></div><div class='tooltip'>BBI->mayWriteToMemory() || <span class='tooltip-content'>1.70M</span></div><div class='tooltip'>BBI->mayReadFromMemory()<span class='tooltip-content'>1.55M</span></div> || <div class='tooltip'>BBI->mayThrow()<span class='tooltip-content'>1.55M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1386' href='#L_ALLOCA_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>159k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1387' href='#L_ALLOCA_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>1.70M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1388' href='#L_ALLOCA_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1389' href='#L_ALLOCA_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // store X, null -> turns into 'unreachable' in SimplifyCFG</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1390' href='#L_ALLOCA_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>isa<ConstantPointerNull>(Ptr) && <span class='tooltip-content'>1.51M</span></div><div class='tooltip'><span class='red'>SI.getPointerAddressSpace() == 0</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1391' href='#L_ALLOCA_1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!isa<UndefValue>(Val)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1392' href='#L_ALLOCA_1392'><pre>1392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SI.setOperand(0, UndefValue::get(Val->getType()));</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1393' href='#L_ALLOCA_1393'><pre>1393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>U</span><span class='red'> = dyn_cast<Instruction>(Val))</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1394' href='#L_ALLOCA_1394'><pre>1394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Worklist.Add(U)</span><span class='red'>; // Dropped a use.</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1395' href='#L_ALLOCA_1395'><pre>1395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1396' href='#L_ALLOCA_1396'><pre>1396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr; // Do not modify these!</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1397' href='#L_ALLOCA_1397'><pre>1397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1398' href='#L_ALLOCA_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1399' href='#L_ALLOCA_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // store undef, Ptr -> noop</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1400' href='#L_ALLOCA_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.51M</span></div><div class='tooltip'>isa<UndefValue>(Val)<span class='tooltip-content'>1.51M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1401' href='#L_ALLOCA_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return eraseInstFromFunction(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1402' href='#L_ALLOCA_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1403' href='#L_ALLOCA_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // If this store is the last instruction in the basic block (possibly</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1404' href='#L_ALLOCA_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // excepting debug info instructions), and if the block ends with an</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1405' href='#L_ALLOCA_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> // unconditional branch, try to move it to the successor block.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1406' href='#L_ALLOCA_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> BBI = SI.getIterator();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1407' href='#L_ALLOCA_1407'><pre>1407</pre></a></td><td class='covered-line'><pre>1.62M</pre></td><td class='code'><pre> do {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1408' href='#L_ALLOCA_1408'><pre>1408</pre></a></td><td class='covered-line'><pre>1.62M</pre></td><td class='code'><pre> ++BBI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1409' href='#L_ALLOCA_1409'><pre>1409</pre></a></td><td class='covered-line'><pre>1.62M</pre></td><td class='code'><pre> } while (isa<DbgInfoIntrinsic>(BBI) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1410' href='#L_ALLOCA_1410'><pre>1410</pre></a></td><td class='covered-line'><pre>1.62M</pre></td><td class='code'><pre> <div class='tooltip'>(isa<BitCastInst>(BBI) && <span class='tooltip-content'>1.62M</span></div><div class='tooltip'>BBI->getType()->isPointerTy()<span class='tooltip-content'>104k</span></div>));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1411' href='#L_ALLOCA_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> if (BranchInst *BI = dyn_cast<BranchInst>(BBI))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1412' href='#L_ALLOCA_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>235k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>235k</span></div><div class='tooltip'>BI->isUnconditional()<span class='tooltip-content'>235k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1413' href='#L_ALLOCA_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>229k</span></div><div class='tooltip'>SimplifyStoreAtEndOfBlock(SI)<span class='tooltip-content'>229k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1414' href='#L_ALLOCA_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> return nullptr; // xform done!</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1415' href='#L_ALLOCA_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1416' href='#L_ALLOCA_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1417' href='#L_ALLOCA_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>1.51M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1418' href='#L_ALLOCA_1418'><pre>1418</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1419' href='#L_ALLOCA_1419'><pre>1419</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// SimplifyStoreAtEndOfBlock - Turn things like:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1420' href='#L_ALLOCA_1420'><pre>1420</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// if () { *P = v1; } else { *P = v2 }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1421' href='#L_ALLOCA_1421'><pre>1421</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into a phi node with a store in the successor.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1422' href='#L_ALLOCA_1422'><pre>1422</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1423' href='#L_ALLOCA_1423'><pre>1423</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Simplify things like:</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1424' href='#L_ALLOCA_1424'><pre>1424</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// *P = v1; if () { *P = v2; }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1425' href='#L_ALLOCA_1425'><pre>1425</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into a phi node with a store in the successor.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1426' href='#L_ALLOCA_1426'><pre>1426</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1427' href='#L_ALLOCA_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre>bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1428' href='#L_ALLOCA_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> assert(SI.isUnordered() &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1429' href='#L_ALLOCA_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> "this code has not been auditted for volatile or ordered store case");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1430' href='#L_ALLOCA_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1431' href='#L_ALLOCA_1431'><pre>1431</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> BasicBlock *StoreBB = SI.getParent();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1432' href='#L_ALLOCA_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1433' href='#L_ALLOCA_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> // Check to see if the successor block has exactly two incoming edges. If</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1434' href='#L_ALLOCA_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> // so, see if the other predecessor contains a store to the same location.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1435' href='#L_ALLOCA_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> // if so, insert a PHI node (if needed) and move the stores down.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1436' href='#L_ALLOCA_1436'><pre>1436</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> BasicBlock *DestBB = StoreBB->getTerminator()->getSuccessor(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1437' href='#L_ALLOCA_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1438' href='#L_ALLOCA_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> // Determine whether Dest has exactly two predecessors and, if so, compute</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1439' href='#L_ALLOCA_1439'><pre>1439</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> // the other predecessor.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1440' href='#L_ALLOCA_1440'><pre>1440</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> pred_iterator PI = pred_begin(DestBB);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1441' href='#L_ALLOCA_1441'><pre>1441</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> BasicBlock *P = *PI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1442' href='#L_ALLOCA_1442'><pre>1442</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> BasicBlock *OtherBB = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1443' href='#L_ALLOCA_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1444' href='#L_ALLOCA_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> if (P != StoreBB)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1445' href='#L_ALLOCA_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> OtherBB = P;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1446' href='#L_ALLOCA_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1447' href='#L_ALLOCA_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre> if (++PI == pred_end(DestBB))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1448' href='#L_ALLOCA_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1449' href='#L_ALLOCA_1449'><pre>1449</pre></a></td><td class='covered-line'><pre>229k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1450' href='#L_ALLOCA_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>228k</pre></td><td class='code'><pre> P = *PI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1451' href='#L_ALLOCA_1451'><pre>1451</pre></a></td><td class='covered-line'><pre>228k</pre></td><td class='code'><pre> if (<div class='tooltip'>P != StoreBB<span class='tooltip-content'>228k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>143k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1452' href='#L_ALLOCA_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>143k</pre></td><td class='code'><pre> if (OtherBB)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1453' href='#L_ALLOCA_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>54.5k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1454' href='#L_ALLOCA_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>88.8k</pre></td><td class='code'><pre> OtherBB = P;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1455' href='#L_ALLOCA_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>88.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1456' href='#L_ALLOCA_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>174k</span></div><div class='tooltip'>++PI != pred_end(DestBB)<span class='tooltip-content'>174k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1457' href='#L_ALLOCA_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>29.8k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1458' href='#L_ALLOCA_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1459' href='#L_ALLOCA_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> // Bail out if all the relevant blocks aren't distinct (this can happen,</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1460' href='#L_ALLOCA_1460'><pre>1460</pre></a></td><td class='covered-line'><pre>174k</pre></td><td class='code'><pre> // for example, if SI is in an infinite loop)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1461' href='#L_ALLOCA_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>144k</span></div><div class='tooltip'>StoreBB == DestBB || <span class='tooltip-content'>144k</span></div><div class='tooltip'>OtherBB == DestBB<span class='tooltip-content'>144k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1462' href='#L_ALLOCA_1462'><pre>1462</pre></a></td><td class='covered-line'><pre>4.91k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1463' href='#L_ALLOCA_1463'><pre>1463</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1464' href='#L_ALLOCA_1464'><pre>1464</pre></a></td><td class='covered-line'><pre>144k</pre></td><td class='code'><pre> // Verify that the other block ends in a branch and is not otherwise empty.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1465' href='#L_ALLOCA_1465'><pre>1465</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> BasicBlock::iterator BBI(OtherBB->getTerminator());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1466' href='#L_ALLOCA_1466'><pre>1466</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> BranchInst *OtherBr = dyn_cast<BranchInst>(BBI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1467' href='#L_ALLOCA_1467'><pre>1467</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> if (<div class='tooltip'>!OtherBr || <span class='tooltip-content'>139k</span></div><div class='tooltip'>BBI == OtherBB->begin()<span class='tooltip-content'>138k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1468' href='#L_ALLOCA_1468'><pre>1468</pre></a></td><td class='covered-line'><pre>4.80k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1469' href='#L_ALLOCA_1469'><pre>1469</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1470' href='#L_ALLOCA_1470'><pre>1470</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> // If the other block ends in an unconditional branch, check for the 'if then</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1471' href='#L_ALLOCA_1471'><pre>1471</pre></a></td><td class='covered-line'><pre>139k</pre></td><td class='code'><pre> // else' case. there is an instruction before the branch.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1472' href='#L_ALLOCA_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>134k</pre></td><td class='code'><pre> StoreInst *OtherStore = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1473' href='#L_ALLOCA_1473'><pre>1473</pre></a></td><td class='covered-line'><pre>134k</pre></td><td class='code'><pre> if (<div class='tooltip'>OtherBr->isUnconditional()<span class='tooltip-content'>134k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>41.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1474' href='#L_ALLOCA_1474'><pre>1474</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> --BBI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1475' href='#L_ALLOCA_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // Skip over debugging info.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1476' href='#L_ALLOCA_1476'><pre>1476</pre></a></td><td class='covered-line'><pre>42.2k</pre></td><td class='code'><pre> while (isa<DbgInfoIntrinsic>(BBI) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1477' href='#L_ALLOCA_1477'><pre>1477</pre></a></td><td class='covered-line'><pre>42.2k</pre></td><td class='code'><pre> <div class='tooltip'>(isa<BitCastInst>(BBI) && <span class='tooltip-content'>42.2k</span></div><div class='tooltip'>BBI->getType()->isPointerTy()<span class='tooltip-content'>565</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>554</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1478' href='#L_ALLOCA_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>554</pre></td><td class='code'><pre> if (BBI==OtherBB->begin())</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1479' href='#L_ALLOCA_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1480' href='#L_ALLOCA_1480'><pre>1480</pre></a></td><td class='covered-line'><pre>534</pre></td><td class='code'><pre> --BBI;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1481' href='#L_ALLOCA_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>534</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1482' href='#L_ALLOCA_1482'><pre>1482</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // If this isn't a store, isn't a store to the same location, or is not the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1483' href='#L_ALLOCA_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // right kind of store, bail out.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1484' href='#L_ALLOCA_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> OtherStore = dyn_cast<StoreInst>(BBI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1485' href='#L_ALLOCA_1485'><pre>1485</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>!OtherStore || <span class='tooltip-content'>41.7k</span></div><div class='tooltip'>OtherStore->getOperand(1) != SI.getOperand(1)<span class='tooltip-content'>24.4k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1486' href='#L_ALLOCA_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> !SI.isSameOperationAs(OtherStore))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1487' href='#L_ALLOCA_1487'><pre>1487</pre></a></td><td class='covered-line'><pre>41.5k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1488' href='#L_ALLOCA_1488'><pre>1488</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1489' href='#L_ALLOCA_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> // Otherwise, the other block ended with a conditional branch. If one of the</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1490' href='#L_ALLOCA_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> // destinations is StoreBB, then we have the if/then case.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1491' href='#L_ALLOCA_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> if (OtherBr->getSuccessor(0) != StoreBB &&</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1492' href='#L_ALLOCA_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>72.3k</pre></td><td class='code'><pre> OtherBr->getSuccessor(1) != StoreBB)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1493' href='#L_ALLOCA_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1494' href='#L_ALLOCA_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1495' href='#L_ALLOCA_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> // Okay, we know that OtherBr now goes to Dest and StoreBB, so this is an</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1496' href='#L_ALLOCA_1496'><pre>1496</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> // if/then triangle. See if there is a store to the same ptr as SI that</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1497' href='#L_ALLOCA_1497'><pre>1497</pre></a></td><td class='covered-line'><pre>92.7k</pre></td><td class='code'><pre> // lives in OtherBB.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1498' href='#L_ALLOCA_1498'><pre>1498</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> <div class='tooltip'>for (;; <span class='tooltip-content'>64.6k</span></div><div class='tooltip'>--BBI<span class='tooltip-content'>155k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>219k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1499' href='#L_ALLOCA_1499'><pre>1499</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> // Check to see if we find the matching store.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1500' href='#L_ALLOCA_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> if (<div class='tooltip'>(OtherStore = dyn_cast<StoreInst>(BBI))<span class='tooltip-content'>219k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1501' href='#L_ALLOCA_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> if (OtherStore->getOperand(1) != SI.getOperand(1) ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1502' href='#L_ALLOCA_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre> !SI.isSameOperationAs(OtherStore))</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1503' href='#L_ALLOCA_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>11.9k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1504' href='#L_ALLOCA_1504'><pre>1504</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1505' href='#L_ALLOCA_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1506' href='#L_ALLOCA_1506'><pre>1506</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> // If we find something that may be using or overwriting the stored</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1507' href='#L_ALLOCA_1507'><pre>1507</pre></a></td><td class='covered-line'><pre>219k</pre></td><td class='code'><pre> // value, or if we run out of instructions, we can't do the xform.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1508' href='#L_ALLOCA_1508'><pre>1508</pre></a></td><td class='covered-line'><pre>207k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>207k</span></div><div class='tooltip'>BBI->mayReadFromMemory() || <span class='tooltip-content'>207k</span></div><div class='tooltip'>BBI->mayThrow()<span class='tooltip-content'>160k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1509' href='#L_ALLOCA_1509'><pre>1509</pre></a></td><td class='covered-line'><pre>160k</pre></td><td class='code'><pre> <div class='tooltip'>BBI->mayWriteToMemory()<span class='tooltip-content'>160k</span></div> || <div class='tooltip'>BBI == OtherBB->begin()<span class='tooltip-content'>160k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1510' href='#L_ALLOCA_1510'><pre>1510</pre></a></td><td class='covered-line'><pre>52.4k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1511' href='#L_ALLOCA_1511'><pre>1511</pre></a></td><td class='covered-line'><pre>207k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1512' href='#L_ALLOCA_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>64.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1513' href='#L_ALLOCA_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>64.6k</pre></td><td class='code'><pre> // In order to eliminate the store in OtherBr, we have to</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1514' href='#L_ALLOCA_1514'><pre>1514</pre></a></td><td class='covered-line'><pre>64.6k</pre></td><td class='code'><pre> // make sure nothing reads or overwrites the stored value in</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1515' href='#L_ALLOCA_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>64.6k</pre></td><td class='code'><pre> // StoreBB.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1516' href='#L_ALLOCA_1516'><pre>1516</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> <div class='tooltip'>for (BasicBlock::iterator I = StoreBB->begin(); <span class='tooltip-content'>269</span></div><div class='tooltip'>&*I != &SI<span class='tooltip-content'>522</span></div>; <div class='tooltip'>++I<span class='tooltip-content'>253</span></div>) <div class='tooltip'>{<span class='tooltip-content'>479</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1517' href='#L_ALLOCA_1517'><pre>1517</pre></a></td><td class='covered-line'><pre>479</pre></td><td class='code'><pre> // FIXME: This should really be AA driven.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1518' href='#L_ALLOCA_1518'><pre>1518</pre></a></td><td class='covered-line'><pre>479</pre></td><td class='code'><pre> if (<div class='tooltip'>I->mayReadFromMemory() || <span class='tooltip-content'>479</span></div><div class='tooltip'>I->mayThrow()<span class='tooltip-content'>298</span></div> || <div class='tooltip'>I->mayWriteToMemory()<span class='tooltip-content'>298</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1519' href='#L_ALLOCA_1519'><pre>1519</pre></a></td><td class='covered-line'><pre>226</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1520' href='#L_ALLOCA_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>479</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1521' href='#L_ALLOCA_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>269</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1522' href='#L_ALLOCA_1522'><pre>1522</pre></a></td><td class='covered-line'><pre>134k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1523' href='#L_ALLOCA_1523'><pre>1523</pre></a></td><td class='covered-line'><pre>134k</pre></td><td class='code'><pre> // Insert a PHI node now if we need it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1524' href='#L_ALLOCA_1524'><pre>1524</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> Value *MergedVal = OtherStore->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1525' href='#L_ALLOCA_1525'><pre>1525</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> if (<div class='tooltip'>MergedVal != SI.getOperand(0)<span class='tooltip-content'>223</span></div>) <div class='tooltip'>{<span class='tooltip-content'>216</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1526' href='#L_ALLOCA_1526'><pre>1526</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> PHINode *PN = PHINode::Create(MergedVal->getType(), 2, "storemerge");</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1527' href='#L_ALLOCA_1527'><pre>1527</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> PN->addIncoming(SI.getOperand(0), SI.getParent());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1528' href='#L_ALLOCA_1528'><pre>1528</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> PN->addIncoming(OtherStore->getOperand(0), OtherBB);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1529' href='#L_ALLOCA_1529'><pre>1529</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> MergedVal = InsertNewInstBefore(PN, DestBB->front());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1530' href='#L_ALLOCA_1530'><pre>1530</pre></a></td><td class='covered-line'><pre>216</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1531' href='#L_ALLOCA_1531'><pre>1531</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1532' href='#L_ALLOCA_1532'><pre>1532</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> // Advance to a place where it is safe to insert the new store and</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1533' href='#L_ALLOCA_1533'><pre>1533</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> // insert it.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1534' href='#L_ALLOCA_1534'><pre>1534</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> BBI = DestBB->getFirstInsertionPt();</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1535' href='#L_ALLOCA_1535'><pre>1535</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> StoreInst *NewSI = new StoreInst(MergedVal, SI.getOperand(1),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1536' href='#L_ALLOCA_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> SI.isVolatile(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1537' href='#L_ALLOCA_1537'><pre>1537</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> SI.getAlignment(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1538' href='#L_ALLOCA_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> SI.getOrdering(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1539' href='#L_ALLOCA_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> SI.getSynchScope());</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1540' href='#L_ALLOCA_1540'><pre>1540</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> InsertNewInstBefore(NewSI, *BBI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1541' href='#L_ALLOCA_1541'><pre>1541</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> // The debug locations of the original instructions might differ; merge them.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1542' href='#L_ALLOCA_1542'><pre>1542</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> NewSI->setDebugLoc(DILocation::getMergedLocation(SI.getDebugLoc(),</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1543' href='#L_ALLOCA_1543'><pre>1543</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> OtherStore->getDebugLoc()));</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1544' href='#L_ALLOCA_1544'><pre>1544</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1545' href='#L_ALLOCA_1545'><pre>1545</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> // If the two stores had AA tags, merge them.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1546' href='#L_ALLOCA_1546'><pre>1546</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> AAMDNodes AATags;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1547' href='#L_ALLOCA_1547'><pre>1547</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> SI.getAAMetadata(AATags);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1548' href='#L_ALLOCA_1548'><pre>1548</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> if (<div class='tooltip'>AATags<span class='tooltip-content'>223</span></div>) <div class='tooltip'>{<span class='tooltip-content'>211</span></div></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1549' href='#L_ALLOCA_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>211</pre></td><td class='code'><pre> OtherStore->getAAMetadata(AATags, /* Merge = */ true);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1550' href='#L_ALLOCA_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>211</pre></td><td class='code'><pre> NewSI->setAAMetadata(AATags);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1551' href='#L_ALLOCA_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>211</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1552' href='#L_ALLOCA_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1553' href='#L_ALLOCA_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> // Nuke the old stores.</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1554' href='#L_ALLOCA_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> eraseInstFromFunction(SI);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1555' href='#L_ALLOCA_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> eraseInstFromFunction(*OtherStore);</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1556' href='#L_ALLOCA_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>223</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_ALLOCA_1557' href='#L_ALLOCA_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>134k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='MULDIV' href='#MULDIV'>lib/Transforms/InstCombine/InstCombineMulDivRem.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_MULDIV_41'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1' href='#L_MULDIV_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineMulDivRem.cpp -------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_2' href='#L_MULDIV_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_3' href='#L_MULDIV_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_4' href='#L_MULDIV_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_5' href='#L_MULDIV_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_6' href='#L_MULDIV_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_7' href='#L_MULDIV_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_8' href='#L_MULDIV_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_9' href='#L_MULDIV_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_10' href='#L_MULDIV_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visit functions for mul, fmul, sdiv, udiv, fdiv,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_11' href='#L_MULDIV_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// srem, urem, frem.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_12' href='#L_MULDIV_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_13' href='#L_MULDIV_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_14' href='#L_MULDIV_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_15' href='#L_MULDIV_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_16' href='#L_MULDIV_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_17' href='#L_MULDIV_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_18' href='#L_MULDIV_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_19' href='#L_MULDIV_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_20' href='#L_MULDIV_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_21' href='#L_MULDIV_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_22' href='#L_MULDIV_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_23' href='#L_MULDIV_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_24' href='#L_MULDIV_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_25' href='#L_MULDIV_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The specific integer value is used in a context where it is known to be</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_26' href='#L_MULDIV_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// non-zero. If this allows us to simplify the computation, do so and return</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_27' href='#L_MULDIV_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the new operand, otherwise return null.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_28' href='#L_MULDIV_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *simplifyValueKnownNonZero(Value *V, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_29' href='#L_MULDIV_29'><pre>29</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre> Instruction &CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_30' href='#L_MULDIV_30'><pre>30</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre> // If V has multiple uses, then we would have to do more analysis to determine</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_31' href='#L_MULDIV_31'><pre>31</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre> // if this is safe. For example, the use could be in dynamically unreached</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_32' href='#L_MULDIV_32'><pre>32</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre> // code.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_33' href='#L_MULDIV_33'><pre>33</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!V->hasOneUse()<span class='tooltip-content'>40.1k</span></div>) <div class='tooltip'>return nullptr<span class='tooltip-content'>36.3k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_34' href='#L_MULDIV_34'><pre>34</pre></a></td><td class='covered-line'><pre>40.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_35' href='#L_MULDIV_35'><pre>35</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> bool MadeChange = false;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_36' href='#L_MULDIV_36'><pre>36</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_37' href='#L_MULDIV_37'><pre>37</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // ((1 << A) >>u B) --> (1 << (A-B))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_38' href='#L_MULDIV_38'><pre>38</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // Because V cannot be zero, we know that B is less than A.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_39' href='#L_MULDIV_39'><pre>39</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> Value *A = nullptr, *B = nullptr, *One = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_40' href='#L_MULDIV_40'><pre>40</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> if (match(V, m_LShr(m_OneUse(m_Shl(m_Value(One), m_Value(A))), m_Value(B))) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_41' href='#L_MULDIV_41'><pre>41</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>match(One, m_One())</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_42' href='#L_MULDIV_42'><pre>42</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> A = IC.Builder->CreateSub(A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_43' href='#L_MULDIV_43'><pre>43</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return IC.Builder->CreateShl(One, A);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_44' href='#L_MULDIV_44'><pre>44</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_45' href='#L_MULDIV_45'><pre>45</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_46' href='#L_MULDIV_46'><pre>46</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // (PowerOfTwo >>u B) --> isExact since shifting out the result would make it</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_47' href='#L_MULDIV_47'><pre>47</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // inexact. Similarly for <<.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_48' href='#L_MULDIV_48'><pre>48</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> BinaryOperator *I = dyn_cast<BinaryOperator>(V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_49' href='#L_MULDIV_49'><pre>49</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> if (<div class='tooltip'>I && <span class='tooltip-content'>3.84k</span></div><div class='tooltip'>I->isLogicalShift()<span class='tooltip-content'>817</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_50' href='#L_MULDIV_50'><pre>50</pre></a></td><td class='covered-line'><pre>304</pre></td><td class='code'><pre> isKnownToBeAPowerOfTwo(I->getOperand(0), IC.getDataLayout(), false, 0,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_51' href='#L_MULDIV_51'><pre>51</pre></a></td><td class='covered-line'><pre>304</pre></td><td class='code'><pre> &IC.getAssumptionCache(), &CxtI,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_52' href='#L_MULDIV_52'><pre>52</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> &IC.getDominatorTree())) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_53' href='#L_MULDIV_53'><pre>53</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // We know that this is an exact/nuw shift and that the input is a</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_54' href='#L_MULDIV_54'><pre>54</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // non-zero context as well.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_55' href='#L_MULDIV_55'><pre>55</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V2<span class='tooltip-content'>52</span></div> = simplifyValueKnownNonZero(I->getOperand(0), IC, CxtI)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_56' href='#L_MULDIV_56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->setOperand(0, V2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_57' href='#L_MULDIV_57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_58' href='#L_MULDIV_58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_59' href='#L_MULDIV_59'><pre>59</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_60' href='#L_MULDIV_60'><pre>60</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> if (<div class='tooltip'>I->getOpcode() == Instruction::LShr && <span class='tooltip-content'>52</span></div><div class='tooltip'><span class='red'>!I->isExact()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_61' href='#L_MULDIV_61'><pre>61</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->setIsExact();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_62' href='#L_MULDIV_62'><pre>62</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_63' href='#L_MULDIV_63'><pre>63</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_64' href='#L_MULDIV_64'><pre>64</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_65' href='#L_MULDIV_65'><pre>65</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> if (<div class='tooltip'>I->getOpcode() == Instruction::Shl && <span class='tooltip-content'>52</span></div><div class='tooltip'>!I->hasNoUnsignedWrap()<span class='tooltip-content'>52</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_66' href='#L_MULDIV_66'><pre>66</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> I->setHasNoUnsignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_67' href='#L_MULDIV_67'><pre>67</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> MadeChange = true;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_68' href='#L_MULDIV_68'><pre>68</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_69' href='#L_MULDIV_69'><pre>69</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_70' href='#L_MULDIV_70'><pre>70</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_71' href='#L_MULDIV_71'><pre>71</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // TODO: Lots more we could do here:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_72' href='#L_MULDIV_72'><pre>72</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // If V is a phi node, we can call this on each of its operands.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_73' href='#L_MULDIV_73'><pre>73</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre> // "select cond, X, 0" can simplify to "X".</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_74' href='#L_MULDIV_74'><pre>74</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_75' href='#L_MULDIV_75'><pre>75</pre></a></td><td class='covered-line'><pre>3.83k</pre></td><td class='code'><pre> return MadeChange ? <div class='tooltip'>V<span class='tooltip-content'>10</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>3.83k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_76' href='#L_MULDIV_76'><pre>76</pre></a></td><td class='covered-line'><pre>3.84k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_77' href='#L_MULDIV_77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_78' href='#L_MULDIV_78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_79' href='#L_MULDIV_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// True if the multiply can not be expressed in an int this size.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_80' href='#L_MULDIV_80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool MultiplyOverflows(const APInt &C1, const APInt &C2, APInt &Product,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_81' href='#L_MULDIV_81'><pre>81</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> bool IsSigned) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_82' href='#L_MULDIV_82'><pre>82</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> bool Overflow;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_83' href='#L_MULDIV_83'><pre>83</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (IsSigned)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_84' href='#L_MULDIV_84'><pre>84</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> Product = C1.smul_ov(C2, Overflow);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_85' href='#L_MULDIV_85'><pre>85</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_86' href='#L_MULDIV_86'><pre>86</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Product = C1.umul_ov(C2, Overflow);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_87' href='#L_MULDIV_87'><pre>87</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_88' href='#L_MULDIV_88'><pre>88</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return Overflow;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_89' href='#L_MULDIV_89'><pre>89</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_90' href='#L_MULDIV_90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_91' href='#L_MULDIV_91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief True if C2 is a multiple of C1. Quotient contains C2/C1.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_92' href='#L_MULDIV_92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool IsMultiple(const APInt &C1, const APInt &C2, APInt &Quotient,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_93' href='#L_MULDIV_93'><pre>93</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> bool IsSigned) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_94' href='#L_MULDIV_94'><pre>94</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> assert(C1.getBitWidth() == C2.getBitWidth() &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_95' href='#L_MULDIV_95'><pre>95</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> "Inconsistent width of constants!");</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_96' href='#L_MULDIV_96'><pre>96</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_97' href='#L_MULDIV_97'><pre>97</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> // Bail if we will divide by zero.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_98' href='#L_MULDIV_98'><pre>98</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> if (C2.isMinValue())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_99' href='#L_MULDIV_99'><pre>99</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_100' href='#L_MULDIV_100'><pre>100</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_101' href='#L_MULDIV_101'><pre>101</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> // Bail if we would divide INT_MIN by -1.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_102' href='#L_MULDIV_102'><pre>102</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>449</span></div><div class='tooltip'>IsSigned && <span class='tooltip-content'>449</span></div><div class='tooltip'>C1.isMinSignedValue()<span class='tooltip-content'>414</span></div> && <div class='tooltip'><span class='red'>C2.isAllOnesValue()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_103' href='#L_MULDIV_103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_104' href='#L_MULDIV_104'><pre>104</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_105' href='#L_MULDIV_105'><pre>105</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> APInt Remainder(C1.getBitWidth(), /*Val=*/0ULL, IsSigned);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_106' href='#L_MULDIV_106'><pre>106</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> if (IsSigned)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_107' href='#L_MULDIV_107'><pre>107</pre></a></td><td class='covered-line'><pre>414</pre></td><td class='code'><pre> APInt::sdivrem(C1, C2, Quotient, Remainder);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_108' href='#L_MULDIV_108'><pre>108</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_109' href='#L_MULDIV_109'><pre>109</pre></a></td><td class='covered-line'><pre>35</pre></td><td class='code'><pre> APInt::udivrem(C1, C2, Quotient, Remainder);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_110' href='#L_MULDIV_110'><pre>110</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_111' href='#L_MULDIV_111'><pre>111</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre> return Remainder.isMinValue();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_112' href='#L_MULDIV_112'><pre>112</pre></a></td><td class='covered-line'><pre>449</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_113' href='#L_MULDIV_113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_114' href='#L_MULDIV_114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief A helper routine of InstCombiner::visitMul().</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_115' href='#L_MULDIV_115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_116' href='#L_MULDIV_116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If C is a vector of known powers of 2, then this function returns</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_117' href='#L_MULDIV_117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a new vector obtained from C replacing each element with its logBase2.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_118' href='#L_MULDIV_118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return a null pointer otherwise.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_119' href='#L_MULDIV_119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static Constant *getLogBase2Vector(ConstantDataVector *CV) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_120' href='#L_MULDIV_120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt *IVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_121' href='#L_MULDIV_121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 4> Elts;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_122' href='#L_MULDIV_122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_123' href='#L_MULDIV_123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = CV->getNumElements(); </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_124' href='#L_MULDIV_124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = CV->getElementAsConstant(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_125' href='#L_MULDIV_125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!match(Elt, m_APInt(IVal)) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!IVal->isPowerOf2()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_126' href='#L_MULDIV_126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_127' href='#L_MULDIV_127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Elts.push_back(ConstantInt::get(Elt->getType(), IVal->logBase2()));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_128' href='#L_MULDIV_128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_129' href='#L_MULDIV_129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_130' href='#L_MULDIV_130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ConstantVector::get(Elts)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_131' href='#L_MULDIV_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_132' href='#L_MULDIV_132'><pre>132</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_133' href='#L_MULDIV_133'><pre>133</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Return true if we can prove that:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_134' href='#L_MULDIV_134'><pre>134</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (mul LHS, RHS) === (mul nsw LHS, RHS)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_135' href='#L_MULDIV_135'><pre>135</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::WillNotOverflowSignedMul(Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_136' href='#L_MULDIV_136'><pre>136</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> Instruction &CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_137' href='#L_MULDIV_137'><pre>137</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // Multiplying n * m significant bits yields a result of n + m significant</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_138' href='#L_MULDIV_138'><pre>138</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // bits. If the total number of significant bits does not exceed the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_139' href='#L_MULDIV_139'><pre>139</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // result bit width (minus 1), there is no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_140' href='#L_MULDIV_140'><pre>140</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // This means if we have enough leading sign bits in the operands</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_141' href='#L_MULDIV_141'><pre>141</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // we can guarantee that the result does not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_142' href='#L_MULDIV_142'><pre>142</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // Ref: "Hacker's Delight" by Henry Warren</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_143' href='#L_MULDIV_143'><pre>143</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> unsigned BitWidth = LHS->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_144' href='#L_MULDIV_144'><pre>144</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_145' href='#L_MULDIV_145'><pre>145</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // Note that underestimating the number of sign bits gives a more</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_146' href='#L_MULDIV_146'><pre>146</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // conservative answer.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_147' href='#L_MULDIV_147'><pre>147</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> unsigned SignBits =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_148' href='#L_MULDIV_148'><pre>148</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> ComputeNumSignBits(LHS, 0, &CxtI) + ComputeNumSignBits(RHS, 0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_149' href='#L_MULDIV_149'><pre>149</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_150' href='#L_MULDIV_150'><pre>150</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // First handle the easy case: if we have enough sign bits there's</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_151' href='#L_MULDIV_151'><pre>151</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // definitely no overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_152' href='#L_MULDIV_152'><pre>152</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> if (SignBits > BitWidth + 1)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_153' href='#L_MULDIV_153'><pre>153</pre></a></td><td class='covered-line'><pre>178</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_154' href='#L_MULDIV_154'><pre>154</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_155' href='#L_MULDIV_155'><pre>155</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // There are two ambiguous cases where there can be no overflow:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_156' href='#L_MULDIV_156'><pre>156</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // SignBits == BitWidth + 1 and</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_157' href='#L_MULDIV_157'><pre>157</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // SignBits == BitWidth</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_158' href='#L_MULDIV_158'><pre>158</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // The second case is difficult to check, therefore we only handle the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_159' href='#L_MULDIV_159'><pre>159</pre></a></td><td class='covered-line'><pre>7.24k</pre></td><td class='code'><pre> // first case.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_160' href='#L_MULDIV_160'><pre>160</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.06k</span></div><div class='tooltip'>SignBits == BitWidth + 1<span class='tooltip-content'>7.06k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_161' href='#L_MULDIV_161'><pre>161</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // It overflows only when both arguments are negative and the true</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_162' href='#L_MULDIV_162'><pre>162</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // product is exactly the minimum negative number.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_163' href='#L_MULDIV_163'><pre>163</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // E.g. mul i16 with 17 sign bits: 0xff00 * 0xff80 = 0x8000</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_164' href='#L_MULDIV_164'><pre>164</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // For simplicity we just check if at least one side is not negative.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_165' href='#L_MULDIV_165'><pre>165</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> bool LHSNonNegative, LHSNegative;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_166' href='#L_MULDIV_166'><pre>166</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> bool RHSNonNegative, RHSNegative;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_167' href='#L_MULDIV_167'><pre>167</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ComputeSignBit(LHS, LHSNonNegative, LHSNegative, /*Depth=*/0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_168' href='#L_MULDIV_168'><pre>168</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ComputeSignBit(RHS, RHSNonNegative, RHSNegative, /*Depth=*/0, &CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_169' href='#L_MULDIV_169'><pre>169</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSNonNegative || <span class='tooltip-content'>3</span></div><div class='tooltip'>RHSNonNegative<span class='tooltip-content'>2</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_170' href='#L_MULDIV_170'><pre>170</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_171' href='#L_MULDIV_171'><pre>171</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_172' href='#L_MULDIV_172'><pre>172</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_173' href='#L_MULDIV_173'><pre>173</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_174' href='#L_MULDIV_174'><pre>174</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_175' href='#L_MULDIV_175'><pre>175</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitMul(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_176' href='#L_MULDIV_176'><pre>176</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_177' href='#L_MULDIV_177'><pre>177</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_178' href='#L_MULDIV_178'><pre>178</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_179' href='#L_MULDIV_179'><pre>179</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_180' href='#L_MULDIV_180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_181' href='#L_MULDIV_181'><pre>181</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_182' href='#L_MULDIV_182'><pre>182</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>39.8k</span></div><div class='tooltip'>V<span class='tooltip-content'>39.8k</span></div> = SimplifyMulInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_183' href='#L_MULDIV_183'><pre>183</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_184' href='#L_MULDIV_184'><pre>184</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_185' href='#L_MULDIV_185'><pre>185</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>39.8k</span></div><div class='tooltip'>V<span class='tooltip-content'>39.8k</span></div> = SimplifyUsingDistributiveLaws(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_186' href='#L_MULDIV_186'><pre>186</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_187' href='#L_MULDIV_187'><pre>187</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_188' href='#L_MULDIV_188'><pre>188</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> // X * -1 == 0 - X</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_189' href='#L_MULDIV_189'><pre>189</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>39.8k</span></div><div class='tooltip'>match(Op1, m_AllOnes())<span class='tooltip-content'>39.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>41</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_190' href='#L_MULDIV_190'><pre>190</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::CreateNeg(Op0, I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_191' href='#L_MULDIV_191'><pre>191</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> if (I.hasNoSignedWrap())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_192' href='#L_MULDIV_192'><pre>192</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> BO->setHasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_193' href='#L_MULDIV_193'><pre>193</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_194' href='#L_MULDIV_194'><pre>194</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_195' href='#L_MULDIV_195'><pre>195</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_196' href='#L_MULDIV_196'><pre>196</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> // Also allow combining multiply instructions on vectors.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_197' href='#L_MULDIV_197'><pre>197</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_198' href='#L_MULDIV_198'><pre>198</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> Value *NewOp;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_199' href='#L_MULDIV_199'><pre>199</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> Constant *C1, *C2;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_200' href='#L_MULDIV_200'><pre>200</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> const APInt *IVal;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_201' href='#L_MULDIV_201'><pre>201</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> if (match(&I, m_Mul(m_Shl(m_Value(NewOp), m_Constant(C2)),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_202' href='#L_MULDIV_202'><pre>202</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre> m_Constant(C1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_203' href='#L_MULDIV_203'><pre>203</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> <div class='tooltip'>match(C1, m_APInt(IVal))<span class='tooltip-content'>15</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_204' href='#L_MULDIV_204'><pre>204</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // ((X << C2)*C1) == (X * (C1 << C2))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_205' href='#L_MULDIV_205'><pre>205</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Constant *Shl = ConstantExpr::getShl(C1, C2);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_206' href='#L_MULDIV_206'><pre>206</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> BinaryOperator *Mul = cast<BinaryOperator>(I.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_207' href='#L_MULDIV_207'><pre>207</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::CreateMul(NewOp, Shl);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_208' href='#L_MULDIV_208'><pre>208</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (<div class='tooltip'>I.hasNoUnsignedWrap() && <span class='tooltip-content'>15</span></div><div class='tooltip'><span class='red'>Mul->hasNoUnsignedWrap()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_209' href='#L_MULDIV_209'><pre>209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BO->setHasNoUnsignedWrap()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_210' href='#L_MULDIV_210'><pre>210</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (<div class='tooltip'>I.hasNoSignedWrap() && <span class='tooltip-content'>15</span></div><div class='tooltip'>Mul->hasNoSignedWrap()<span class='tooltip-content'>9</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_211' href='#L_MULDIV_211'><pre>211</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> Shl->isNotMinSignedValue())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_212' href='#L_MULDIV_212'><pre>212</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> BO->setHasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_213' href='#L_MULDIV_213'><pre>213</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_214' href='#L_MULDIV_214'><pre>214</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_215' href='#L_MULDIV_215'><pre>215</pre></a></td><td class='covered-line'><pre>39.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_216' href='#L_MULDIV_216'><pre>216</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>39.7k</span></div><div class='tooltip'>match(&I, m_Mul(m_Value(NewOp), m_Constant(C1)))<span class='tooltip-content'>39.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.97k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_217' href='#L_MULDIV_217'><pre>217</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre> Constant *NewCst = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_218' href='#L_MULDIV_218'><pre>218</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(C1, m_APInt(IVal)) && <span class='tooltip-content'>9.97k</span></div><div class='tooltip'>IVal->isPowerOf2()<span class='tooltip-content'>9.97k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_219' href='#L_MULDIV_219'><pre>219</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre> // Replace X*(2^C) with X << C, where C is either a scalar or a splat.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_220' href='#L_MULDIV_220'><pre>220</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> NewCst = ConstantInt::get(NewOp->getType(), IVal->logBase2());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_221' href='#L_MULDIV_221'><pre>221</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> else <div class='tooltip'>if (ConstantDataVector *<span class='tooltip-content'>7.56k</span></div><div class='tooltip'>CV<span class='tooltip-content'>7.56k</span></div> = dyn_cast<ConstantDataVector>(C1))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_222' href='#L_MULDIV_222'><pre>222</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // Replace X*(2^C) with X << C, where C is a vector of known</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_223' href='#L_MULDIV_223'><pre>223</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // constant powers of 2.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_224' href='#L_MULDIV_224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NewCst = getLogBase2Vector(CV)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_225' href='#L_MULDIV_225'><pre>225</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_226' href='#L_MULDIV_226'><pre>226</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre> if (<div class='tooltip'>NewCst<span class='tooltip-content'>9.97k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.41k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_227' href='#L_MULDIV_227'><pre>227</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> unsigned Width = NewCst->getType()->getPrimitiveSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_228' href='#L_MULDIV_228'><pre>228</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> BinaryOperator *Shl = BinaryOperator::CreateShl(NewOp, NewCst);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_229' href='#L_MULDIV_229'><pre>229</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_230' href='#L_MULDIV_230'><pre>230</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> if (I.hasNoUnsignedWrap())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_231' href='#L_MULDIV_231'><pre>231</pre></a></td><td class='covered-line'><pre>212</pre></td><td class='code'><pre> Shl->setHasNoUnsignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_232' href='#L_MULDIV_232'><pre>232</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> if (<div class='tooltip'>I.hasNoSignedWrap()<span class='tooltip-content'>2.41k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_233' href='#L_MULDIV_233'><pre>233</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> uint64_t V;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_234' href='#L_MULDIV_234'><pre>234</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(NewCst, m_ConstantInt(V)) && <span class='tooltip-content'>1.12k</span></div><div class='tooltip'>V != Width - 1<span class='tooltip-content'>1.12k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_235' href='#L_MULDIV_235'><pre>235</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> Shl->setHasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_236' href='#L_MULDIV_236'><pre>236</pre></a></td><td class='covered-line'><pre>1.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_237' href='#L_MULDIV_237'><pre>237</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_238' href='#L_MULDIV_238'><pre>238</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> return Shl;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_239' href='#L_MULDIV_239'><pre>239</pre></a></td><td class='covered-line'><pre>2.41k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_240' href='#L_MULDIV_240'><pre>240</pre></a></td><td class='covered-line'><pre>9.97k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_241' href='#L_MULDIV_241'><pre>241</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_242' href='#L_MULDIV_242'><pre>242</pre></a></td><td class='covered-line'><pre>39.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_243' href='#L_MULDIV_243'><pre>243</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>CI<span class='tooltip-content'>37.3k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>7.56k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_244' href='#L_MULDIV_244'><pre>244</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // (Y - X) * (-(2**n)) -> (X - Y) * (2**n), for positive nonzero n</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_245' href='#L_MULDIV_245'><pre>245</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // (Y + const) * (-(2**n)) -> (-constY) * (2**n), for positive nonzero n</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_246' href='#L_MULDIV_246'><pre>246</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // The "* (2**n)" thus becomes a potential shifting opportunity.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_247' href='#L_MULDIV_247'><pre>247</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_248' href='#L_MULDIV_248'><pre>248</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> const APInt & Val = CI->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_249' href='#L_MULDIV_249'><pre>249</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> const APInt &PosVal = Val.abs();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_250' href='#L_MULDIV_250'><pre>250</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> if (<div class='tooltip'>Val.isNegative() && <span class='tooltip-content'>7.56k</span></div><div class='tooltip'>PosVal.isPowerOf2()<span class='tooltip-content'>392</span></div>) <div class='tooltip'>{<span class='tooltip-content'>121</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_251' href='#L_MULDIV_251'><pre>251</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> Value *X = nullptr, *Y = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_252' href='#L_MULDIV_252'><pre>252</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>121</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_253' href='#L_MULDIV_253'><pre>253</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> ConstantInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_254' href='#L_MULDIV_254'><pre>254</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> Value *Sub = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_255' href='#L_MULDIV_255'><pre>255</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> if (match(Op0, m_Sub(m_Value(Y), m_Value(X))))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_256' href='#L_MULDIV_256'><pre>256</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Sub = Builder->CreateSub(X, Y, "suba");</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_257' href='#L_MULDIV_257'><pre>257</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>33</span></div><div class='tooltip'>match(Op0, m_Add(m_Value(Y), m_ConstantInt(C1)))<span class='tooltip-content'>33</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_258' href='#L_MULDIV_258'><pre>258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Sub = Builder->CreateSub(Builder->CreateNeg(C1), Y, "subc")</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_259' href='#L_MULDIV_259'><pre>259</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> if (Sub)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_260' href='#L_MULDIV_260'><pre>260</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_261' href='#L_MULDIV_261'><pre>261</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> BinaryOperator::CreateMul(Sub,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_262' href='#L_MULDIV_262'><pre>262</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt::get(Y->getType(), PosVal));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_263' href='#L_MULDIV_263'><pre>263</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_264' href='#L_MULDIV_264'><pre>264</pre></a></td><td class='covered-line'><pre>121</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_265' href='#L_MULDIV_265'><pre>265</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_266' href='#L_MULDIV_266'><pre>266</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_267' href='#L_MULDIV_267'><pre>267</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_268' href='#L_MULDIV_268'><pre>268</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // Simplify mul instructions with a constant RHS.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_269' href='#L_MULDIV_269'><pre>269</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>isa<Constant>(Op1)<span class='tooltip-content'>37.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7.56k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_270' href='#L_MULDIV_270'><pre>270</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> if (Instruction *FoldedMul = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_271' href='#L_MULDIV_271'><pre>271</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return FoldedMul;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_272' href='#L_MULDIV_272'><pre>272</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_273' href='#L_MULDIV_273'><pre>273</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> // Canonicalize (X+C1)*CI -> X*CI+C1*CI.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_274' href='#L_MULDIV_274'><pre>274</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_275' href='#L_MULDIV_275'><pre>275</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_276' href='#L_MULDIV_276'><pre>276</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> Constant *C1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_277' href='#L_MULDIV_277'><pre>277</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_OneUse(m_Add(m_Value(X), m_Constant(C1))))<span class='tooltip-content'>7.56k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_278' href='#L_MULDIV_278'><pre>278</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> Value *Mul = Builder->CreateMul(C1, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_279' href='#L_MULDIV_279'><pre>279</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> // Only go forward with the transform if C1*CI simplifies to a tidier</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_280' href='#L_MULDIV_280'><pre>280</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> // constant.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_281' href='#L_MULDIV_281'><pre>281</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> if (!match(Mul, m_Mul(m_Value(), m_Value())))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_282' href='#L_MULDIV_282'><pre>282</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> return BinaryOperator::CreateAdd(Builder->CreateMul(X, Op1), Mul);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_283' href='#L_MULDIV_283'><pre>283</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_284' href='#L_MULDIV_284'><pre>284</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_285' href='#L_MULDIV_285'><pre>285</pre></a></td><td class='covered-line'><pre>7.56k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_286' href='#L_MULDIV_286'><pre>286</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_287' href='#L_MULDIV_287'><pre>287</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>Op0v<span class='tooltip-content'>37.3k</span></div> = dyn_castNegVal(Op0)) <div class='tooltip'>{ // -X * -Y = X*Y<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_288' href='#L_MULDIV_288'><pre>288</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>Op1v<span class='tooltip-content'>1</span></div> = dyn_castNegVal(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_289' href='#L_MULDIV_289'><pre>289</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::CreateMul(Op0v, Op1v);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_290' href='#L_MULDIV_290'><pre>290</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (I.hasNoSignedWrap() &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_291' href='#L_MULDIV_291'><pre>291</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> match(Op0, m_NSWSub(m_Value(), m_Value())) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_292' href='#L_MULDIV_292'><pre>292</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> match(Op1, m_NSWSub(m_Value(), m_Value())))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_293' href='#L_MULDIV_293'><pre>293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BO->setHasNoSignedWrap()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_294' href='#L_MULDIV_294'><pre>294</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_295' href='#L_MULDIV_295'><pre>295</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_296' href='#L_MULDIV_296'><pre>296</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_297' href='#L_MULDIV_297'><pre>297</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_298' href='#L_MULDIV_298'><pre>298</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // (X / Y) * Y = X - (X % Y)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_299' href='#L_MULDIV_299'><pre>299</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // (X / Y) * -Y = (X % Y) - X</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_300' href='#L_MULDIV_300'><pre>300</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_301' href='#L_MULDIV_301'><pre>301</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> Value *Y = Op1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_302' href='#L_MULDIV_302'><pre>302</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> BinaryOperator *Div = dyn_cast<BinaryOperator>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_303' href='#L_MULDIV_303'><pre>303</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Div || <span class='tooltip-content'>37.3k</span></div><div class='tooltip'>(Div->getOpcode() != Instruction::UDiv &&<span class='tooltip-content'>10.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_304' href='#L_MULDIV_304'><pre>304</pre></a></td><td class='covered-line'><pre>36.4k</pre></td><td class='code'><pre> <div class='tooltip'>Div->getOpcode() != Instruction::SDiv<span class='tooltip-content'>10.2k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>36.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_305' href='#L_MULDIV_305'><pre>305</pre></a></td><td class='covered-line'><pre>36.4k</pre></td><td class='code'><pre> Y = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_306' href='#L_MULDIV_306'><pre>306</pre></a></td><td class='covered-line'><pre>36.4k</pre></td><td class='code'><pre> Div = dyn_cast<BinaryOperator>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_307' href='#L_MULDIV_307'><pre>307</pre></a></td><td class='covered-line'><pre>36.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_308' href='#L_MULDIV_308'><pre>308</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> Value *Neg = dyn_castNegVal(Y);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_309' href='#L_MULDIV_309'><pre>309</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>Div && <span class='tooltip-content'>37.3k</span></div><div class='tooltip'>Div->hasOneUse()<span class='tooltip-content'>3.87k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_310' href='#L_MULDIV_310'><pre>310</pre></a></td><td class='covered-line'><pre>1.98k</pre></td><td class='code'><pre> <div class='tooltip'>(Div->getOperand(1) == Y || <span class='tooltip-content'>1.98k</span></div><div class='tooltip'>Div->getOperand(1) == Neg<span class='tooltip-content'>1.97k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_311' href='#L_MULDIV_311'><pre>311</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> (Div->getOpcode() == Instruction::UDiv ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_312' href='#L_MULDIV_312'><pre>312</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>Div->getOpcode() == Instruction::SDiv</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_313' href='#L_MULDIV_313'><pre>313</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *X = Div->getOperand(0), *DivOp1 = Div->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_314' href='#L_MULDIV_314'><pre>314</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_315' href='#L_MULDIV_315'><pre>315</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // If the division is exact, X % Y is zero, so we end up with X or -X.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_316' href='#L_MULDIV_316'><pre>316</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>Div->isExact()<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_317' href='#L_MULDIV_317'><pre>317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DivOp1 == Y</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_318' href='#L_MULDIV_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, X)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_319' href='#L_MULDIV_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return BinaryOperator::CreateNeg(X)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_320' href='#L_MULDIV_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_321' href='#L_MULDIV_321'><pre>321</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_322' href='#L_MULDIV_322'><pre>322</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>auto RemOpc = Div->getOpcode() == Instruction::UDiv ? <span class='tooltip-content'>7</span></div><div class='tooltip'>Instruction::URem<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_323' href='#L_MULDIV_323'><pre>323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : <span class='red'>Instruction::SRem</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_324' href='#L_MULDIV_324'><pre>324</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Value *Rem = Builder->CreateBinOp(RemOpc, X, DivOp1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_325' href='#L_MULDIV_325'><pre>325</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (DivOp1 == Y)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_326' href='#L_MULDIV_326'><pre>326</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return BinaryOperator::CreateSub(X, Rem);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_327' href='#L_MULDIV_327'><pre>327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateSub(Rem, X)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_328' href='#L_MULDIV_328'><pre>328</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_329' href='#L_MULDIV_329'><pre>329</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_330' href='#L_MULDIV_330'><pre>330</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_331' href='#L_MULDIV_331'><pre>331</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> /// i1 mul -> i1 and.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_332' href='#L_MULDIV_332'><pre>332</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>I.getType()->getScalarType()->isIntegerTy(1)<span class='tooltip-content'>37.3k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_333' href='#L_MULDIV_333'><pre>333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(Op0, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_334' href='#L_MULDIV_334'><pre>334</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_335' href='#L_MULDIV_335'><pre>335</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // X*(1 << Y) --> X << Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_336' href='#L_MULDIV_336'><pre>336</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // (1 << Y)*X --> X << Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_337' href='#L_MULDIV_337'><pre>337</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_338' href='#L_MULDIV_338'><pre>338</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> Value *Y;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_339' href='#L_MULDIV_339'><pre>339</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> BinaryOperator *BO = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_340' href='#L_MULDIV_340'><pre>340</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> bool ShlNSW = false;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_341' href='#L_MULDIV_341'><pre>341</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Shl(m_One(), m_Value(Y)))<span class='tooltip-content'>37.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_342' href='#L_MULDIV_342'><pre>342</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> BO = BinaryOperator::CreateShl(Op1, Y);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_343' href='#L_MULDIV_343'><pre>343</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ShlNSW = cast<ShlOperator>(Op0)->hasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_344' href='#L_MULDIV_344'><pre>344</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>match(Op1, m_Shl(m_One(), m_Value(Y)))<span class='tooltip-content'>37.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_345' href='#L_MULDIV_345'><pre>345</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> BO = BinaryOperator::CreateShl(Op0, Y);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_346' href='#L_MULDIV_346'><pre>346</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ShlNSW = cast<ShlOperator>(Op1)->hasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_347' href='#L_MULDIV_347'><pre>347</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_348' href='#L_MULDIV_348'><pre>348</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>BO<span class='tooltip-content'>37.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_349' href='#L_MULDIV_349'><pre>349</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (I.hasNoUnsignedWrap())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_350' href='#L_MULDIV_350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BO->setHasNoUnsignedWrap()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_351' href='#L_MULDIV_351'><pre>351</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>I.hasNoSignedWrap() && <span class='tooltip-content'>7</span></div><div class='tooltip'>ShlNSW<span class='tooltip-content'>7</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_352' href='#L_MULDIV_352'><pre>352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BO->setHasNoSignedWrap()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_353' href='#L_MULDIV_353'><pre>353</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_354' href='#L_MULDIV_354'><pre>354</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_355' href='#L_MULDIV_355'><pre>355</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_356' href='#L_MULDIV_356'><pre>356</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_357' href='#L_MULDIV_357'><pre>357</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // If one of the operands of the multiply is a cast from a boolean value, then</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_358' href='#L_MULDIV_358'><pre>358</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // we know the bool is either zero or one, so this is a 'masking' multiply.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_359' href='#L_MULDIV_359'><pre>359</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // X * Y (where Y is 0 or 1) -> X & (0-Y)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_360' href='#L_MULDIV_360'><pre>360</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.3k</span></div><div class='tooltip'>!I.getType()->isVectorTy()<span class='tooltip-content'>37.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>37.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_361' href='#L_MULDIV_361'><pre>361</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> // -2 is "-1 << 1" so it is all bits set except the low one.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_362' href='#L_MULDIV_362'><pre>362</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> APInt Negative2(I.getType()->getPrimitiveSizeInBits(), (uint64_t)-2, true);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_363' href='#L_MULDIV_363'><pre>363</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_364' href='#L_MULDIV_364'><pre>364</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> Value *BoolCast = nullptr, *OtherOp = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_365' href='#L_MULDIV_365'><pre>365</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskedValueIsZero(Op0, Negative2, 0, &I)<span class='tooltip-content'>37.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>146</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_366' href='#L_MULDIV_366'><pre>366</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> BoolCast = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_367' href='#L_MULDIV_367'><pre>367</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> OtherOp = Op1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_368' href='#L_MULDIV_368'><pre>368</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>37.1k</span></div><div class='tooltip'>MaskedValueIsZero(Op1, Negative2, 0, &I)<span class='tooltip-content'>37.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_369' href='#L_MULDIV_369'><pre>369</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> BoolCast = Op1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_370' href='#L_MULDIV_370'><pre>370</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> OtherOp = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_371' href='#L_MULDIV_371'><pre>371</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_372' href='#L_MULDIV_372'><pre>372</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_373' href='#L_MULDIV_373'><pre>373</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>BoolCast<span class='tooltip-content'>37.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>149</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_374' href='#L_MULDIV_374'><pre>374</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> Value *V = Builder->CreateSub(Constant::getNullValue(I.getType()),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_375' href='#L_MULDIV_375'><pre>375</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> BoolCast);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_376' href='#L_MULDIV_376'><pre>376</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(V, OtherOp);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_377' href='#L_MULDIV_377'><pre>377</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_378' href='#L_MULDIV_378'><pre>378</pre></a></td><td class='covered-line'><pre>37.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_379' href='#L_MULDIV_379'><pre>379</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_380' href='#L_MULDIV_380'><pre>380</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // Check for (mul (sext x), y), see if we can merge this into an</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_381' href='#L_MULDIV_381'><pre>381</pre></a></td><td class='covered-line'><pre>37.3k</pre></td><td class='code'><pre> // integer mul followed by a sext.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_382' href='#L_MULDIV_382'><pre>382</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (SExtInst *<span class='tooltip-content'>37.1k</span></div><div class='tooltip'>Op0Conv<span class='tooltip-content'>37.1k</span></div> = dyn_cast<SExtInst>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>1.63k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_383' href='#L_MULDIV_383'><pre>383</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> // (mul (sext x), cst) --> (sext (mul x, cst'))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_384' href='#L_MULDIV_384'><pre>384</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Op1C<span class='tooltip-content'>1.63k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1.19k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_385' href='#L_MULDIV_385'><pre>385</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0Conv->hasOneUse()<span class='tooltip-content'>1.19k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.15k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_386' href='#L_MULDIV_386'><pre>386</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> Constant *CI =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_387' href='#L_MULDIV_387'><pre>387</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> ConstantExpr::getTrunc(Op1C, Op0Conv->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_388' href='#L_MULDIV_388'><pre>388</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> if (ConstantExpr::getSExt(CI, I.getType()) == Op1C &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_389' href='#L_MULDIV_389'><pre>389</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> <div class='tooltip'>WillNotOverflowSignedMul(Op0Conv->getOperand(0), CI, I)<span class='tooltip-content'>1.15k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_390' href='#L_MULDIV_390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new, smaller mul.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_391' href='#L_MULDIV_391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewMul =</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_392' href='#L_MULDIV_392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateNSWMul(Op0Conv->getOperand(0), CI, "mulconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_393' href='#L_MULDIV_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new SExtInst(NewMul, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_394' href='#L_MULDIV_394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_395' href='#L_MULDIV_395'><pre>395</pre></a></td><td class='covered-line'><pre>1.15k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_396' href='#L_MULDIV_396'><pre>396</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_397' href='#L_MULDIV_397'><pre>397</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_398' href='#L_MULDIV_398'><pre>398</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> // (mul (sext x), (sext y)) --> (sext (mul int x, y))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_399' href='#L_MULDIV_399'><pre>399</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> <div class='tooltip'>if (SExtInst *<span class='tooltip-content'>1.63k</span></div><div class='tooltip'>Op1Conv<span class='tooltip-content'>1.63k</span></div> = dyn_cast<SExtInst>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>147</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_400' href='#L_MULDIV_400'><pre>400</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> // Only do this if x/y have the same type, if at last one of them has a</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_401' href='#L_MULDIV_401'><pre>401</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> // single use (so we don't increase the number of sexts), and if the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_402' href='#L_MULDIV_402'><pre>402</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> // integer mul will not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_403' href='#L_MULDIV_403'><pre>403</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> if (Op0Conv->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_404' href='#L_MULDIV_404'><pre>404</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> Op1Conv->getOperand(0)->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_405' href='#L_MULDIV_405'><pre>405</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> <div class='tooltip'>(Op0Conv->hasOneUse() || <span class='tooltip-content'>147</span></div><div class='tooltip'>Op1Conv->hasOneUse()<span class='tooltip-content'>63</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_406' href='#L_MULDIV_406'><pre>406</pre></a></td><td class='covered-line'><pre>135</pre></td><td class='code'><pre> WillNotOverflowSignedMul(Op0Conv->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_407' href='#L_MULDIV_407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Op1Conv->getOperand(0), I)) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_408' href='#L_MULDIV_408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new integer mul.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_409' href='#L_MULDIV_409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewMul = Builder->CreateNSWMul(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_410' href='#L_MULDIV_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op0Conv->getOperand(0), Op1Conv->getOperand(0), "mulconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_411' href='#L_MULDIV_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new SExtInst(NewMul, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_412' href='#L_MULDIV_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_413' href='#L_MULDIV_413'><pre>413</pre></a></td><td class='covered-line'><pre>147</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_414' href='#L_MULDIV_414'><pre>414</pre></a></td><td class='covered-line'><pre>1.63k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_415' href='#L_MULDIV_415'><pre>415</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_416' href='#L_MULDIV_416'><pre>416</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> // Check for (mul (zext x), y), see if we can merge this into an</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_417' href='#L_MULDIV_417'><pre>417</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> // integer mul followed by a zext.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_418' href='#L_MULDIV_418'><pre>418</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>37.1k</span></div><div class='tooltip'>Op0Conv<span class='tooltip-content'>37.1k</span></div> = dyn_cast<ZExtInst>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>1.83k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_419' href='#L_MULDIV_419'><pre>419</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> // (mul (zext x), cst) --> (zext (mul x, cst'))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_420' href='#L_MULDIV_420'><pre>420</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Op1C<span class='tooltip-content'>1.83k</span></div> = dyn_cast<ConstantInt>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1.32k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_421' href='#L_MULDIV_421'><pre>421</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op0Conv->hasOneUse()<span class='tooltip-content'>1.32k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>985</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_422' href='#L_MULDIV_422'><pre>422</pre></a></td><td class='covered-line'><pre>985</pre></td><td class='code'><pre> Constant *CI =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_423' href='#L_MULDIV_423'><pre>423</pre></a></td><td class='covered-line'><pre>985</pre></td><td class='code'><pre> ConstantExpr::getTrunc(Op1C, Op0Conv->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_424' href='#L_MULDIV_424'><pre>424</pre></a></td><td class='covered-line'><pre>985</pre></td><td class='code'><pre> if (ConstantExpr::getZExt(CI, I.getType()) == Op1C &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_425' href='#L_MULDIV_425'><pre>425</pre></a></td><td class='covered-line'><pre>934</pre></td><td class='code'><pre> computeOverflowForUnsignedMul(Op0Conv->getOperand(0), CI, &I) ==</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_426' href='#L_MULDIV_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> OverflowResult::NeverOverflows) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_427' href='#L_MULDIV_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new, smaller mul.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_428' href='#L_MULDIV_428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewMul =</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_429' href='#L_MULDIV_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateNUWMul(Op0Conv->getOperand(0), CI, "mulconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_430' href='#L_MULDIV_430'><pre>430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ZExtInst(NewMul, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_431' href='#L_MULDIV_431'><pre>431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_432' href='#L_MULDIV_432'><pre>432</pre></a></td><td class='covered-line'><pre>985</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_433' href='#L_MULDIV_433'><pre>433</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_434' href='#L_MULDIV_434'><pre>434</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_435' href='#L_MULDIV_435'><pre>435</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> // (mul (zext x), (zext y)) --> (zext (mul int x, y))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_436' href='#L_MULDIV_436'><pre>436</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>1.83k</span></div><div class='tooltip'>Op1Conv<span class='tooltip-content'>1.83k</span></div> = dyn_cast<ZExtInst>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>26</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_437' href='#L_MULDIV_437'><pre>437</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> // Only do this if x/y have the same type, if at last one of them has a</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_438' href='#L_MULDIV_438'><pre>438</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> // single use (so we don't increase the number of zexts), and if the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_439' href='#L_MULDIV_439'><pre>439</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> // integer mul will not overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_440' href='#L_MULDIV_440'><pre>440</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> if (Op0Conv->getOperand(0)->getType() ==</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_441' href='#L_MULDIV_441'><pre>441</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> Op1Conv->getOperand(0)->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_442' href='#L_MULDIV_442'><pre>442</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> <div class='tooltip'>(Op0Conv->hasOneUse() || <span class='tooltip-content'>26</span></div><div class='tooltip'>Op1Conv->hasOneUse()<span class='tooltip-content'>26</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_443' href='#L_MULDIV_443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>computeOverflowForUnsignedMul(Op0Conv->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_444' href='#L_MULDIV_444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op1Conv->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_445' href='#L_MULDIV_445'><pre>445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> &I) == OverflowResult::NeverOverflows</span>) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_446' href='#L_MULDIV_446'><pre>446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new integer mul.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_447' href='#L_MULDIV_447'><pre>447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewMul = Builder->CreateNUWMul(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_448' href='#L_MULDIV_448'><pre>448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op0Conv->getOperand(0), Op1Conv->getOperand(0), "mulconv");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_449' href='#L_MULDIV_449'><pre>449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ZExtInst(NewMul, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_450' href='#L_MULDIV_450'><pre>450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_451' href='#L_MULDIV_451'><pre>451</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_452' href='#L_MULDIV_452'><pre>452</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_453' href='#L_MULDIV_453'><pre>453</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_454' href='#L_MULDIV_454'><pre>454</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>37.1k</span></div><div class='tooltip'>!I.hasNoSignedWrap() && <span class='tooltip-content'>37.1k</span></div><div class='tooltip'>WillNotOverflowSignedMul(Op0, Op1, I)<span class='tooltip-content'>5.95k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>181</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_455' href='#L_MULDIV_455'><pre>455</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_456' href='#L_MULDIV_456'><pre>456</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> I.setHasNoSignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_457' href='#L_MULDIV_457'><pre>457</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_458' href='#L_MULDIV_458'><pre>458</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_459' href='#L_MULDIV_459'><pre>459</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre> if (!I.hasNoUnsignedWrap() &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_460' href='#L_MULDIV_460'><pre>460</pre></a></td><td class='covered-line'><pre>35.4k</pre></td><td class='code'><pre> computeOverflowForUnsignedMul(Op0, Op1, &I) ==</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_461' href='#L_MULDIV_461'><pre>461</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> OverflowResult::NeverOverflows) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_462' href='#L_MULDIV_462'><pre>462</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_463' href='#L_MULDIV_463'><pre>463</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> I.setHasNoUnsignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_464' href='#L_MULDIV_464'><pre>464</pre></a></td><td class='covered-line'><pre>124</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_465' href='#L_MULDIV_465'><pre>465</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_466' href='#L_MULDIV_466'><pre>466</pre></a></td><td class='covered-line'><pre>36.3k</pre></td><td class='code'><pre> return Changed ? <div class='tooltip'>&I<span class='tooltip-content'>885</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>36.3k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_467' href='#L_MULDIV_467'><pre>467</pre></a></td><td class='covered-line'><pre>37.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_468' href='#L_MULDIV_468'><pre>468</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_469' href='#L_MULDIV_469'><pre>469</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Detect pattern log2(Y * 0.5) with corresponding fast math flags.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_470' href='#L_MULDIV_470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_471' href='#L_MULDIV_471'><pre>471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Op->hasOneUse()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_472' href='#L_MULDIV_472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_473' href='#L_MULDIV_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_474' href='#L_MULDIV_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_475' href='#L_MULDIV_475'><pre>475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!II</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_476' href='#L_MULDIV_476'><pre>476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_477' href='#L_MULDIV_477'><pre>477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() != Intrinsic::log2 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!II->hasUnsafeAlgebra()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_478' href='#L_MULDIV_478'><pre>478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_479' href='#L_MULDIV_479'><pre>479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Log2 = II;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_480' href='#L_MULDIV_480'><pre>480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_481' href='#L_MULDIV_481'><pre>481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *OpLog2Of = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_482' href='#L_MULDIV_482'><pre>482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!OpLog2Of->hasOneUse()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_483' href='#L_MULDIV_483'><pre>483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_484' href='#L_MULDIV_484'><pre>484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_485' href='#L_MULDIV_485'><pre>485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Instruction *I = dyn_cast<Instruction>(OpLog2Of);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_486' href='#L_MULDIV_486'><pre>486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!I</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_487' href='#L_MULDIV_487'><pre>487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_488' href='#L_MULDIV_488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>I->getOpcode() != Instruction::FMul || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!I->hasUnsafeAlgebra()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_489' href='#L_MULDIV_489'><pre>489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_490' href='#L_MULDIV_490'><pre>490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_491' href='#L_MULDIV_491'><pre>491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(I->getOperand(0), m_SpecificFP(0.5))</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_492' href='#L_MULDIV_492'><pre>492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Y = I->getOperand(1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_493' href='#L_MULDIV_493'><pre>493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(I->getOperand(1), m_SpecificFP(0.5))</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_494' href='#L_MULDIV_494'><pre>494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Y = I->getOperand(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_495' href='#L_MULDIV_495'><pre>495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_496' href='#L_MULDIV_496'><pre>496</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_497' href='#L_MULDIV_497'><pre>497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isFiniteNonZeroFp(Constant *C) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_498' href='#L_MULDIV_498'><pre>498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C->getType()->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_499' href='#L_MULDIV_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = C->getType()->getVectorNumElements(); </span><span class='red'>I != E</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_500' href='#L_MULDIV_500'><pre>500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_501' href='#L_MULDIV_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(C->getAggregateElement(I));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_502' href='#L_MULDIV_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CFP || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CFP->getValueAPF().isFiniteNonZero()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_503' href='#L_MULDIV_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_504' href='#L_MULDIV_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_505' href='#L_MULDIV_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_506' href='#L_MULDIV_506'><pre>506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_507' href='#L_MULDIV_507'><pre>507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_508' href='#L_MULDIV_508'><pre>508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return isa<ConstantFP>(C) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_509' href='#L_MULDIV_509'><pre>509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cast<ConstantFP>(C)->getValueAPF().isFiniteNonZero()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_510' href='#L_MULDIV_510'><pre>510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_511' href='#L_MULDIV_511'><pre>511</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_512' href='#L_MULDIV_512'><pre>512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isNormalFp(Constant *C) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_513' href='#L_MULDIV_513'><pre>513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C->getType()->isVectorTy()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_514' href='#L_MULDIV_514'><pre>514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = C->getType()->getVectorNumElements(); </span><span class='red'>I != E</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_515' href='#L_MULDIV_515'><pre>515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_516' href='#L_MULDIV_516'><pre>516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(C->getAggregateElement(I));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_517' href='#L_MULDIV_517'><pre>517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!CFP || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!CFP->getValueAPF().isNormal()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_518' href='#L_MULDIV_518'><pre>518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_519' href='#L_MULDIV_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_520' href='#L_MULDIV_520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_521' href='#L_MULDIV_521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_522' href='#L_MULDIV_522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_523' href='#L_MULDIV_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>return isa<ConstantFP>(C) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cast<ConstantFP>(C)->getValueAPF().isNormal()</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_524' href='#L_MULDIV_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_525' href='#L_MULDIV_525'><pre>525</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_526' href='#L_MULDIV_526'><pre>526</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Helper function of InstCombiner::visitFMul(BinaryOperator(). It returns</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_527' href='#L_MULDIV_527'><pre>527</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// true iff the given value is FMul or FDiv with one and only one operand</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_528' href='#L_MULDIV_528'><pre>528</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// being a normal constant (i.e. not Zero/NaN/Infinity).</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_529' href='#L_MULDIV_529'><pre>529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isFMulOrFDivWithConstant(Value *V) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_530' href='#L_MULDIV_530'><pre>530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *I = dyn_cast<Instruction>(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_531' href='#L_MULDIV_531'><pre>531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!I || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(I->getOpcode() != Instruction::FMul &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_532' href='#L_MULDIV_532'><pre>532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>I->getOpcode() != Instruction::FDiv</span><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_533' href='#L_MULDIV_533'><pre>533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_534' href='#L_MULDIV_534'><pre>534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_535' href='#L_MULDIV_535'><pre>535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Constant *C0 = dyn_cast<Constant>(I->getOperand(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_536' href='#L_MULDIV_536'><pre>536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(I->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_537' href='#L_MULDIV_537'><pre>537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_538' href='#L_MULDIV_538'><pre>538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_539' href='#L_MULDIV_539'><pre>539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_540' href='#L_MULDIV_540'><pre>540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_541' href='#L_MULDIV_541'><pre>541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>return (C0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isFiniteNonZeroFp(C0)</span><span class='tooltip-content'>0</span></div><span class='red'>) || </span><div class='tooltip'><span class='red'>(C1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isFiniteNonZeroFp(C1)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_542' href='#L_MULDIV_542'><pre>542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_543' href='#L_MULDIV_543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_544' href='#L_MULDIV_544'><pre>544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// foldFMulConst() is a helper routine of InstCombiner::visitFMul().</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_545' href='#L_MULDIV_545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The input \p FMulOrDiv is a FMul/FDiv with one and only one operand</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_546' href='#L_MULDIV_546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// being a constant (i.e. isFMulOrFDivWithConstant(FMulOrDiv) == true).</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_547' href='#L_MULDIV_547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function is to simplify "FMulOrDiv * C" and returns the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_548' href='#L_MULDIV_548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// resulting expression. Note that this function could return NULL in</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_549' href='#L_MULDIV_549'><pre>549</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// case the constants cannot be folded into a normal floating-point.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_550' href='#L_MULDIV_550'><pre>550</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_551' href='#L_MULDIV_551'><pre>551</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::foldFMulConst(Instruction *FMulOrDiv, Constant *C,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_552' href='#L_MULDIV_552'><pre>552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Instruction *InsertBefore) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_553' href='#L_MULDIV_553'><pre>553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(isFMulOrFDivWithConstant(FMulOrDiv) && "V is invalid");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_554' href='#L_MULDIV_554'><pre>554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_555' href='#L_MULDIV_555'><pre>555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0 = FMulOrDiv->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_556' href='#L_MULDIV_556'><pre>556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd1 = FMulOrDiv->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_557' href='#L_MULDIV_557'><pre>557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_558' href='#L_MULDIV_558'><pre>558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C0 = dyn_cast<Constant>(Opnd0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_559' href='#L_MULDIV_559'><pre>559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_560' href='#L_MULDIV_560'><pre>560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_561' href='#L_MULDIV_561'><pre>561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *R = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_562' href='#L_MULDIV_562'><pre>562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_563' href='#L_MULDIV_563'><pre>563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X * C0) * C => X * (C0*C)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_564' href='#L_MULDIV_564'><pre>564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>FMulOrDiv->getOpcode() == Instruction::FMul</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_565' href='#L_MULDIV_565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *F = ConstantExpr::getFMul(C1 ? </span><div class='tooltip'><span class='red'>C1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>C0</span><span class='tooltip-content'>0</span></div><span class='red'>, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_566' href='#L_MULDIV_566'><pre>566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isNormalFp(F)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_567' href='#L_MULDIV_567'><pre>567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>R = BinaryOperator::CreateFMul(C1 ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'>, F)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_568' href='#L_MULDIV_568'><pre>568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_569' href='#L_MULDIV_569'><pre>569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_570' href='#L_MULDIV_570'><pre>570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (C0 / X) * C => (C0 * C) / X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_571' href='#L_MULDIV_571'><pre>571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>FMulOrDiv->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_572' href='#L_MULDIV_572'><pre>572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // It would otherwise introduce another div.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_573' href='#L_MULDIV_573'><pre>573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *F = ConstantExpr::getFMul(C0, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_574' href='#L_MULDIV_574'><pre>574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isNormalFp(F)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_575' href='#L_MULDIV_575'><pre>575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>R = BinaryOperator::CreateFDiv(F, Opnd1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_576' href='#L_MULDIV_576'><pre>576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_577' href='#L_MULDIV_577'><pre>577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_578' href='#L_MULDIV_578'><pre>578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X / C1) * C => X * (C/C1) if C/C1 is not a denormal</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_579' href='#L_MULDIV_579'><pre>579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *F = ConstantExpr::getFDiv(C, C1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_580' href='#L_MULDIV_580'><pre>580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isNormalFp(F)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_581' href='#L_MULDIV_581'><pre>581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> R = BinaryOperator::CreateFMul(Opnd0, F);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_582' href='#L_MULDIV_582'><pre>582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_583' href='#L_MULDIV_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X / C1) * C => X / (C1/C)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_584' href='#L_MULDIV_584'><pre>584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *F = ConstantExpr::getFDiv(C1, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_585' href='#L_MULDIV_585'><pre>585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isNormalFp(F)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_586' href='#L_MULDIV_586'><pre>586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>R = BinaryOperator::CreateFDiv(Opnd0, F)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_587' href='#L_MULDIV_587'><pre>587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_588' href='#L_MULDIV_588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_589' href='#L_MULDIV_589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_590' href='#L_MULDIV_590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_591' href='#L_MULDIV_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>R</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_592' href='#L_MULDIV_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> R->setHasUnsafeAlgebra(true);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_593' href='#L_MULDIV_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstWith(R, *InsertBefore);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_594' href='#L_MULDIV_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_595' href='#L_MULDIV_595'><pre>595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_596' href='#L_MULDIV_596'><pre>596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return R;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_597' href='#L_MULDIV_597'><pre>597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_598' href='#L_MULDIV_598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_599' href='#L_MULDIV_599'><pre>599</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFMul(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_600' href='#L_MULDIV_600'><pre>600</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> bool Changed = SimplifyAssociativeOrCommutative(I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_601' href='#L_MULDIV_601'><pre>601</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_602' href='#L_MULDIV_602'><pre>602</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_603' href='#L_MULDIV_603'><pre>603</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_604' href='#L_MULDIV_604'><pre>604</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_605' href='#L_MULDIV_605'><pre>605</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_606' href='#L_MULDIV_606'><pre>606</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>250k</span></div><div class='tooltip'>isa<Constant>(Op0)<span class='tooltip-content'>250k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_607' href='#L_MULDIV_607'><pre>607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>std::swap(Op0, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_608' href='#L_MULDIV_608'><pre>608</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_609' href='#L_MULDIV_609'><pre>609</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> if (Value *V =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_610' href='#L_MULDIV_610'><pre>610</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> SimplifyFMulInst(Op0, Op1, I.getFastMathFlags(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_611' href='#L_MULDIV_611'><pre>611</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_612' href='#L_MULDIV_612'><pre>612</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_613' href='#L_MULDIV_613'><pre>613</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> bool AllowReassociate = I.hasUnsafeAlgebra();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_614' href='#L_MULDIV_614'><pre>614</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_615' href='#L_MULDIV_615'><pre>615</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> // Simplify mul instructions with a constant RHS.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_616' href='#L_MULDIV_616'><pre>616</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<Constant>(Op1)<span class='tooltip-content'>250k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>21.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_617' href='#L_MULDIV_617'><pre>617</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> if (Instruction *FoldedMul = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_618' href='#L_MULDIV_618'><pre>618</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return FoldedMul;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_619' href='#L_MULDIV_619'><pre>619</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_620' href='#L_MULDIV_620'><pre>620</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> // (fmul X, -1.0) --> (fsub -0.0, X)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_621' href='#L_MULDIV_621'><pre>621</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.0k</span></div><div class='tooltip'>match(Op1, m_SpecificFP(-1.0))<span class='tooltip-content'>21.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>48</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_622' href='#L_MULDIV_622'><pre>622</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> Constant *NegZero = ConstantFP::getNegativeZero(Op1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_623' href='#L_MULDIV_623'><pre>623</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> Instruction *RI = BinaryOperator::CreateFSub(NegZero, Op0);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_624' href='#L_MULDIV_624'><pre>624</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> RI->copyFastMathFlags(&I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_625' href='#L_MULDIV_625'><pre>625</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_626' href='#L_MULDIV_626'><pre>626</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_627' href='#L_MULDIV_627'><pre>627</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_628' href='#L_MULDIV_628'><pre>628</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> Constant *C = cast<Constant>(Op1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_629' href='#L_MULDIV_629'><pre>629</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>AllowReassociate && <span class='tooltip-content'>21.0k</span></div><div class='tooltip'><span class='red'>isFiniteNonZeroFp(C)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_630' href='#L_MULDIV_630'><pre>630</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Let MDC denote an expression in one of these forms:</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_631' href='#L_MULDIV_631'><pre>631</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X * C, C/X, X/C, where C is a constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_632' href='#L_MULDIV_632'><pre>632</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_633' href='#L_MULDIV_633'><pre>633</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Try to simplify "MDC * Constant"</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_634' href='#L_MULDIV_634'><pre>634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isFMulOrFDivWithConstant(Op0)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_635' href='#L_MULDIV_635'><pre>635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = foldFMulConst(cast<Instruction>(Op0), C, &I))</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_636' href='#L_MULDIV_636'><pre>636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_637' href='#L_MULDIV_637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_638' href='#L_MULDIV_638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (MDC +/- C1) * C => (MDC * C) +/- (C1 * C)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_639' href='#L_MULDIV_639'><pre>639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Instruction *FAddSub = dyn_cast<Instruction>(Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_640' href='#L_MULDIV_640'><pre>640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>FAddSub &&</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_641' href='#L_MULDIV_641'><pre>641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>(FAddSub->getOpcode() == Instruction::FAdd ||</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_642' href='#L_MULDIV_642'><pre>642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>FAddSub->getOpcode() == Instruction::FSub</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_643' href='#L_MULDIV_643'><pre>643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0 = FAddSub->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_644' href='#L_MULDIV_644'><pre>644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd1 = FAddSub->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_645' href='#L_MULDIV_645'><pre>645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C0 = dyn_cast<Constant>(Opnd0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_646' href='#L_MULDIV_646'><pre>646</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = dyn_cast<Constant>(Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_647' href='#L_MULDIV_647'><pre>647</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Swap = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_648' href='#L_MULDIV_648'><pre>648</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_649' href='#L_MULDIV_649'><pre>649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(C0, C1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_650' href='#L_MULDIV_650'><pre>650</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> std::swap(Opnd0, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_651' href='#L_MULDIV_651'><pre>651</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Swap = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_652' href='#L_MULDIV_652'><pre>652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_653' href='#L_MULDIV_653'><pre>653</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_654' href='#L_MULDIV_654'><pre>654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>C1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isFiniteNonZeroFp(C1)</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>isFMulOrFDivWithConstant(Opnd0)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_655' href='#L_MULDIV_655'><pre>655</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *M1 = ConstantExpr::getFMul(C1, C);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_656' href='#L_MULDIV_656'><pre>656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *M0 = isNormalFp(cast<Constant>(M1)) ?</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_657' href='#L_MULDIV_657'><pre>657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>foldFMulConst(cast<Instruction>(Opnd0), C, &I)</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_658' href='#L_MULDIV_658'><pre>658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_659' href='#L_MULDIV_659'><pre>659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>M0 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>M1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_660' href='#L_MULDIV_660'><pre>660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Swap && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>FAddSub->getOpcode() == Instruction::FSub</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_661' href='#L_MULDIV_661'><pre>661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>std::swap(M0, M1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_662' href='#L_MULDIV_662'><pre>662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_663' href='#L_MULDIV_663'><pre>663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *RI = (FAddSub->getOpcode() == Instruction::FAdd)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_664' href='#L_MULDIV_664'><pre>664</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>BinaryOperator::CreateFAdd(M0, M1)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_665' href='#L_MULDIV_665'><pre>665</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>BinaryOperator::CreateFSub(M0, M1)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_666' href='#L_MULDIV_666'><pre>666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RI->copyFastMathFlags(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_667' href='#L_MULDIV_667'><pre>667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return RI;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_668' href='#L_MULDIV_668'><pre>668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_669' href='#L_MULDIV_669'><pre>669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_670' href='#L_MULDIV_670'><pre>670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_671' href='#L_MULDIV_671'><pre>671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_672' href='#L_MULDIV_672'><pre>672</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_673' href='#L_MULDIV_673'><pre>673</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_674' href='#L_MULDIV_674'><pre>674</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>250k</span></div><div class='tooltip'>Op0 == Op1<span class='tooltip-content'>250k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_675' href='#L_MULDIV_675'><pre>675</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> if (IntrinsicInst *<div class='tooltip'>II<span class='tooltip-content'>17.5k</span></div> = dyn_cast<IntrinsicInst>(Op0)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_676' href='#L_MULDIV_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // sqrt(X) * sqrt(X) -> X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_677' href='#L_MULDIV_677'><pre>677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>AllowReassociate && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::sqrt</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_678' href='#L_MULDIV_678'><pre>678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, II->getOperand(0))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_679' href='#L_MULDIV_679'><pre>679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_680' href='#L_MULDIV_680'><pre>680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // fabs(X) * fabs(X) -> X * X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_681' href='#L_MULDIV_681'><pre>681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::fabs</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_682' href='#L_MULDIV_682'><pre>682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *FMulVal = BinaryOperator::CreateFMul(II->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_683' href='#L_MULDIV_683'><pre>683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_684' href='#L_MULDIV_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_685' href='#L_MULDIV_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FMulVal->copyFastMathFlags(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_686' href='#L_MULDIV_686'><pre>686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return FMulVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_687' href='#L_MULDIV_687'><pre>687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_688' href='#L_MULDIV_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_689' href='#L_MULDIV_689'><pre>689</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_690' href='#L_MULDIV_690'><pre>690</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_691' href='#L_MULDIV_691'><pre>691</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> // Under unsafe algebra do:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_692' href='#L_MULDIV_692'><pre>692</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> // X * log2(0.5*Y) = X*log2(Y) - X</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_693' href='#L_MULDIV_693'><pre>693</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>250k</span></div><div class='tooltip'>AllowReassociate<span class='tooltip-content'>250k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_694' href='#L_MULDIV_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *OpX = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_695' href='#L_MULDIV_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *OpY = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_696' href='#L_MULDIV_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntrinsicInst *Log2;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_697' href='#L_MULDIV_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> detectLog2OfHalf(Op0, OpY, Log2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_698' href='#L_MULDIV_698'><pre>698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>OpY</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_699' href='#L_MULDIV_699'><pre>699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OpX = Op1;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_700' href='#L_MULDIV_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_701' href='#L_MULDIV_701'><pre>701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> detectLog2OfHalf(Op1, OpY, Log2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_702' href='#L_MULDIV_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>OpY</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_703' href='#L_MULDIV_703'><pre>703</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OpX = Op0;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_704' href='#L_MULDIV_704'><pre>704</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_705' href='#L_MULDIV_705'><pre>705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_706' href='#L_MULDIV_706'><pre>706</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // if pattern detected emit alternate sequence</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_707' href='#L_MULDIV_707'><pre>707</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>OpX && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>OpY</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_708' href='#L_MULDIV_708'><pre>708</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BuilderTy::FastMathFlagGuard Guard(*Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_709' href='#L_MULDIV_709'><pre>709</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->setFastMathFlags(Log2->getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_710' href='#L_MULDIV_710'><pre>710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Log2->setArgOperand(0, OpY);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_711' href='#L_MULDIV_711'><pre>711</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *FMulVal = Builder->CreateFMul(OpX, Log2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_712' href='#L_MULDIV_712'><pre>712</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *FSub = Builder->CreateFSub(FMulVal, OpX);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_713' href='#L_MULDIV_713'><pre>713</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FSub->takeName(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_714' href='#L_MULDIV_714'><pre>714</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, FSub);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_715' href='#L_MULDIV_715'><pre>715</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_716' href='#L_MULDIV_716'><pre>716</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_717' href='#L_MULDIV_717'><pre>717</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_718' href='#L_MULDIV_718'><pre>718</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> // Handle symmetric situation in a 2-iteration loop</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_719' href='#L_MULDIV_719'><pre>719</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> Value *Opnd0 = Op0;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_720' href='#L_MULDIV_720'><pre>720</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> Value *Opnd1 = Op1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_721' href='#L_MULDIV_721'><pre>721</pre></a></td><td class='covered-line'><pre>709k</pre></td><td class='code'><pre> for (int i = 0; <div class='tooltip'>i < 2<span class='tooltip-content'>709k</span></div>; <div class='tooltip'>i++<span class='tooltip-content'>458k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>479k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_722' href='#L_MULDIV_722'><pre>722</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> bool IgnoreZeroSign = I.hasNoSignedZeros();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_723' href='#L_MULDIV_723'><pre>723</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> if (<div class='tooltip'>BinaryOperator::isFNeg(Opnd0, IgnoreZeroSign)<span class='tooltip-content'>479k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8.64k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_724' href='#L_MULDIV_724'><pre>724</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> BuilderTy::FastMathFlagGuard Guard(*Builder);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_725' href='#L_MULDIV_725'><pre>725</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> Builder->setFastMathFlags(I.getFastMathFlags());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_726' href='#L_MULDIV_726'><pre>726</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_727' href='#L_MULDIV_727'><pre>727</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> Value *N0 = dyn_castFNegVal(Opnd0, IgnoreZeroSign);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_728' href='#L_MULDIV_728'><pre>728</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> Value *N1 = dyn_castFNegVal(Opnd1, IgnoreZeroSign);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_729' href='#L_MULDIV_729'><pre>729</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_730' href='#L_MULDIV_730'><pre>730</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> // -X * -Y => X*Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_731' href='#L_MULDIV_731'><pre>731</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre> if (<div class='tooltip'>N1<span class='tooltip-content'>8.64k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>51</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_732' href='#L_MULDIV_732'><pre>732</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> Value *FMul = Builder->CreateFMul(N0, N1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_733' href='#L_MULDIV_733'><pre>733</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> FMul->takeName(&I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_734' href='#L_MULDIV_734'><pre>734</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> return replaceInstUsesWith(I, FMul);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_735' href='#L_MULDIV_735'><pre>735</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_736' href='#L_MULDIV_736'><pre>736</pre></a></td><td class='covered-line'><pre>8.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_737' href='#L_MULDIV_737'><pre>737</pre></a></td><td class='covered-line'><pre>8.59k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8.59k</span></div><div class='tooltip'>Opnd0->hasOneUse()<span class='tooltip-content'>8.59k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>98</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_738' href='#L_MULDIV_738'><pre>738</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> // -X * Y => -(X*Y) (Promote negation as high as possible)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_739' href='#L_MULDIV_739'><pre>739</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> Value *T = Builder->CreateFMul(N0, Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_740' href='#L_MULDIV_740'><pre>740</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> Value *Neg = Builder->CreateFNeg(T);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_741' href='#L_MULDIV_741'><pre>741</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> Neg->takeName(&I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_742' href='#L_MULDIV_742'><pre>742</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> return replaceInstUsesWith(I, Neg);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_743' href='#L_MULDIV_743'><pre>743</pre></a></td><td class='covered-line'><pre>98</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_744' href='#L_MULDIV_744'><pre>744</pre></a></td><td class='covered-line'><pre>8.59k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_745' href='#L_MULDIV_745'><pre>745</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_746' href='#L_MULDIV_746'><pre>746</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // (X*Y) * X => (X*X) * Y where Y != X</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_747' href='#L_MULDIV_747'><pre>747</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // The purpose is two-fold:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_748' href='#L_MULDIV_748'><pre>748</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // 1) to form a power expression (of X).</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_749' href='#L_MULDIV_749'><pre>749</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // 2) potentially shorten the critical path: After transformation, the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_750' href='#L_MULDIV_750'><pre>750</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // latency of the instruction Y is amortized by the expression of X*X,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_751' href='#L_MULDIV_751'><pre>751</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // and therefore Y is in a "less critical" position compared to what it</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_752' href='#L_MULDIV_752'><pre>752</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> // was before the transformation.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_753' href='#L_MULDIV_753'><pre>753</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_754' href='#L_MULDIV_754'><pre>754</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>479k</span></div><div class='tooltip'>AllowReassociate<span class='tooltip-content'>479k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_755' href='#L_MULDIV_755'><pre>755</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Opnd0_0, *Opnd0_1;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_756' href='#L_MULDIV_756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Opnd0->hasOneUse() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_757' href='#L_MULDIV_757'><pre>757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>match(Opnd0, m_FMul(m_Value(Opnd0_0), m_Value(Opnd0_1)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_758' href='#L_MULDIV_758'><pre>758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Y = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_759' href='#L_MULDIV_759'><pre>759</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Opnd0_0 == Opnd1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_1 != Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_760' href='#L_MULDIV_760'><pre>760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Y = Opnd0_1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_761' href='#L_MULDIV_761'><pre>761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_1 == Opnd1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Opnd0_0 != Opnd1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_762' href='#L_MULDIV_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Y = Opnd0_0</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_763' href='#L_MULDIV_763'><pre>763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_764' href='#L_MULDIV_764'><pre>764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Y</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_765' href='#L_MULDIV_765'><pre>765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BuilderTy::FastMathFlagGuard Guard(*Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_766' href='#L_MULDIV_766'><pre>766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->setFastMathFlags(I.getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_767' href='#L_MULDIV_767'><pre>767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *T = Builder->CreateFMul(Opnd1, Opnd1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_768' href='#L_MULDIV_768'><pre>768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *R = Builder->CreateFMul(T, Y);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_769' href='#L_MULDIV_769'><pre>769</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> R->takeName(&I);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_770' href='#L_MULDIV_770'><pre>770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, R);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_771' href='#L_MULDIV_771'><pre>771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_772' href='#L_MULDIV_772'><pre>772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_773' href='#L_MULDIV_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_774' href='#L_MULDIV_774'><pre>774</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_775' href='#L_MULDIV_775'><pre>775</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>479k</span></div><div class='tooltip'>!isa<Constant>(Op1)<span class='tooltip-content'>479k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_776' href='#L_MULDIV_776'><pre>776</pre></a></td><td class='covered-line'><pre>458k</pre></td><td class='code'><pre> std::swap(Opnd0, Opnd1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_777' href='#L_MULDIV_777'><pre>777</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_778' href='#L_MULDIV_778'><pre>778</pre></a></td><td class='covered-line'><pre>20.9k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_779' href='#L_MULDIV_779'><pre>779</pre></a></td><td class='covered-line'><pre>479k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_780' href='#L_MULDIV_780'><pre>780</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_781' href='#L_MULDIV_781'><pre>781</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>250k</span></div><div class='tooltip'>&I<span class='tooltip-content'>2.51k</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>247k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_782' href='#L_MULDIV_782'><pre>782</pre></a></td><td class='covered-line'><pre>250k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_783' href='#L_MULDIV_783'><pre>783</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_784' href='#L_MULDIV_784'><pre>784</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold a divide or remainder of a select instruction.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_785' href='#L_MULDIV_785'><pre>785</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre>bool InstCombiner::SimplifyDivRemOfSelect(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_786' href='#L_MULDIV_786'><pre>786</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> SelectInst *SI = cast<SelectInst>(I.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_787' href='#L_MULDIV_787'><pre>787</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_788' href='#L_MULDIV_788'><pre>788</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> // div/rem X, (Cond ? 0 : Y) -> div/rem X, Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_789' href='#L_MULDIV_789'><pre>789</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> int NonNullOperand = -1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_790' href='#L_MULDIV_790'><pre>790</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> if (Constant *ST = dyn_cast<Constant>(SI->getOperand(1)))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_791' href='#L_MULDIV_791'><pre>791</pre></a></td><td class='covered-line'><pre>279</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>279</span></div><div class='tooltip'>ST->isNullValue()<span class='tooltip-content'>279</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_792' href='#L_MULDIV_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NonNullOperand = 2</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_793' href='#L_MULDIV_793'><pre>793</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> // div/rem X, (Cond ? Y : 0) -> div/rem X, Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_794' href='#L_MULDIV_794'><pre>794</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> if (Constant *ST = dyn_cast<Constant>(SI->getOperand(2)))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_795' href='#L_MULDIV_795'><pre>795</pre></a></td><td class='covered-line'><pre>181</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>181</span></div><div class='tooltip'>ST->isNullValue()<span class='tooltip-content'>181</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_796' href='#L_MULDIV_796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NonNullOperand = 1</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_797' href='#L_MULDIV_797'><pre>797</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_798' href='#L_MULDIV_798'><pre>798</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> if (NonNullOperand == -1)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_799' href='#L_MULDIV_799'><pre>799</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_800' href='#L_MULDIV_800'><pre>800</pre></a></td><td class='covered-line'><pre>397</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_801' href='#L_MULDIV_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *SelectCond = SI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_802' href='#L_MULDIV_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_803' href='#L_MULDIV_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Change the div/rem to use 'Y' instead of the select.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_804' href='#L_MULDIV_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(1, SI->getOperand(NonNullOperand));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_805' href='#L_MULDIV_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_806' href='#L_MULDIV_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Okay, we know we replace the operand of the div/rem with 'Y' with no</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_807' href='#L_MULDIV_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // problem. However, the select, or the condition of the select may have</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_808' href='#L_MULDIV_808'><pre>808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // multiple uses. Based on our knowledge that the operand must be non-zero,</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_809' href='#L_MULDIV_809'><pre>809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // propagate the known value for the select into other uses of it, and</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_810' href='#L_MULDIV_810'><pre>810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // propagate a known value of the condition into its other users.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_811' href='#L_MULDIV_811'><pre>811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_812' href='#L_MULDIV_812'><pre>812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the select and condition only have a single use, don't bother with this,</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_813' href='#L_MULDIV_813'><pre>813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // early exit.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_814' href='#L_MULDIV_814'><pre>814</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>SI->use_empty() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SelectCond->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_815' href='#L_MULDIV_815'><pre>815</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_816' href='#L_MULDIV_816'><pre>816</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_817' href='#L_MULDIV_817'><pre>817</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Scan the current block backward, looking for other uses of SI.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_818' href='#L_MULDIV_818'><pre>818</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>BasicBlock::iterator BBI = I.getIterator(), BBFront = I.getParent()->begin();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_819' href='#L_MULDIV_819'><pre>819</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_820' href='#L_MULDIV_820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> while (</span><div class='tooltip'><span class='red'>BBI != BBFront</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_821' href='#L_MULDIV_821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> --BBI;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_822' href='#L_MULDIV_822'><pre>822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we found a call to a function, we can't assume it will return, so</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_823' href='#L_MULDIV_823'><pre>823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // information from below it cannot be propagated above it.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_824' href='#L_MULDIV_824'><pre>824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<CallInst>(BBI) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<IntrinsicInst>(BBI)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_825' href='#L_MULDIV_825'><pre>825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_826' href='#L_MULDIV_826'><pre>826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_827' href='#L_MULDIV_827'><pre>827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace uses of the select or its condition with the known values.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_828' href='#L_MULDIV_828'><pre>828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>for (Instruction::op_iterator I = BBI->op_begin(), E = BBI->op_end();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_829' href='#L_MULDIV_829'><pre>829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_830' href='#L_MULDIV_830'><pre>830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>*I == SI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_831' href='#L_MULDIV_831'><pre>831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *I = SI->getOperand(NonNullOperand);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_832' href='#L_MULDIV_832'><pre>832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(&*BBI);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_833' href='#L_MULDIV_833'><pre>833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>*I == SelectCond</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_834' href='#L_MULDIV_834'><pre>834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *I = Builder->getInt1(NonNullOperand == 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_835' href='#L_MULDIV_835'><pre>835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(&*BBI);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_836' href='#L_MULDIV_836'><pre>836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_837' href='#L_MULDIV_837'><pre>837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_838' href='#L_MULDIV_838'><pre>838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_839' href='#L_MULDIV_839'><pre>839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we past the instruction, quit looking for it.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_840' href='#L_MULDIV_840'><pre>840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>&*BBI == SI</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_841' href='#L_MULDIV_841'><pre>841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SI = nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_842' href='#L_MULDIV_842'><pre>842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>&*BBI == SelectCond</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_843' href='#L_MULDIV_843'><pre>843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SelectCond = nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_844' href='#L_MULDIV_844'><pre>844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_845' href='#L_MULDIV_845'><pre>845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we ran out of things to eliminate, break out of the loop.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_846' href='#L_MULDIV_846'><pre>846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!SelectCond && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!SI</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_847' href='#L_MULDIV_847'><pre>847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_848' href='#L_MULDIV_848'><pre>848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_849' href='#L_MULDIV_849'><pre>849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_850' href='#L_MULDIV_850'><pre>850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_851' href='#L_MULDIV_851'><pre>851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_852' href='#L_MULDIV_852'><pre>852</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_853' href='#L_MULDIV_853'><pre>853</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_854' href='#L_MULDIV_854'><pre>854</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function implements the transforms common to both integer division</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_855' href='#L_MULDIV_855'><pre>855</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instructions (udiv and sdiv). It is called by the visitors to those integer</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_856' href='#L_MULDIV_856'><pre>856</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// division instructions.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_857' href='#L_MULDIV_857'><pre>857</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// @brief Common integer divide transforms</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_858' href='#L_MULDIV_858'><pre>858</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre>Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_859' href='#L_MULDIV_859'><pre>859</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_860' href='#L_MULDIV_860'><pre>860</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_861' href='#L_MULDIV_861'><pre>861</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> // The RHS is known non-zero.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_862' href='#L_MULDIV_862'><pre>862</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>33.0k</span></div> = simplifyValueKnownNonZero(I.getOperand(1), *this, I)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_863' href='#L_MULDIV_863'><pre>863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(1, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_864' href='#L_MULDIV_864'><pre>864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &I;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_865' href='#L_MULDIV_865'><pre>865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_866' href='#L_MULDIV_866'><pre>866</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_867' href='#L_MULDIV_867'><pre>867</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> // Handle cases involving: [su]div X, (select Cond, Y, Z)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_868' href='#L_MULDIV_868'><pre>868</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> // This does not apply for fdiv.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_869' href='#L_MULDIV_869'><pre>869</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>33.0k</span></div><div class='tooltip'>isa<SelectInst>(Op1) && <span class='tooltip-content'>33.0k</span></div><div class='tooltip'>SimplifyDivRemOfSelect(I)<span class='tooltip-content'>386</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_870' href='#L_MULDIV_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_871' href='#L_MULDIV_871'><pre>871</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_872' href='#L_MULDIV_872'><pre>872</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>33.0k</span></div><div class='tooltip'>LHS<span class='tooltip-content'>33.0k</span></div> = dyn_cast<Instruction>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>31.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_873' href='#L_MULDIV_873'><pre>873</pre></a></td><td class='covered-line'><pre>31.9k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_874' href='#L_MULDIV_874'><pre>874</pre></a></td><td class='covered-line'><pre>31.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(C2))<span class='tooltip-content'>31.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_875' href='#L_MULDIV_875'><pre>875</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_876' href='#L_MULDIV_876'><pre>876</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> const APInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_877' href='#L_MULDIV_877'><pre>877</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> bool IsSigned = I.getOpcode() == Instruction::SDiv;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_878' href='#L_MULDIV_878'><pre>878</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_879' href='#L_MULDIV_879'><pre>879</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> // (X / C1) / C2 -> X / (C1*C2)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_880' href='#L_MULDIV_880'><pre>880</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>(IsSigned && <span class='tooltip-content'>28.0k</span></div><div class='tooltip'>match(LHS, m_SDiv(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>15.0k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_881' href='#L_MULDIV_881'><pre>881</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> <div class='tooltip'>(!IsSigned && <span class='tooltip-content'>28.0k</span></div><div class='tooltip'>match(LHS, m_UDiv(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>12.9k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_882' href='#L_MULDIV_882'><pre>882</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> APInt Product(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_883' href='#L_MULDIV_883'><pre>883</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (!MultiplyOverflows(*C1, *C2, Product, IsSigned))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_884' href='#L_MULDIV_884'><pre>884</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return BinaryOperator::Create(I.getOpcode(), X,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_885' href='#L_MULDIV_885'><pre>885</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> ConstantInt::get(I.getType(), Product));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_886' href='#L_MULDIV_886'><pre>886</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_887' href='#L_MULDIV_887'><pre>887</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_888' href='#L_MULDIV_888'><pre>888</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.0k</span></div><div class='tooltip'>(IsSigned && <span class='tooltip-content'>28.0k</span></div><div class='tooltip'>match(LHS, m_NSWMul(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>15.0k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_889' href='#L_MULDIV_889'><pre>889</pre></a></td><td class='covered-line'><pre>27.8k</pre></td><td class='code'><pre> <div class='tooltip'>(!IsSigned && <span class='tooltip-content'>27.8k</span></div><div class='tooltip'>match(LHS, m_NUWMul(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>12.9k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>168</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_890' href='#L_MULDIV_890'><pre>890</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> APInt Quotient(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_891' href='#L_MULDIV_891'><pre>891</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_892' href='#L_MULDIV_892'><pre>892</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> // (X * C1) / C2 -> X / (C2 / C1) if C2 is a multiple of C1.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_893' href='#L_MULDIV_893'><pre>893</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> if (<div class='tooltip'>IsMultiple(*C2, *C1, Quotient, IsSigned)<span class='tooltip-content'>168</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_894' href='#L_MULDIV_894'><pre>894</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *BO = BinaryOperator::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_895' href='#L_MULDIV_895'><pre>895</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.getOpcode(), X, ConstantInt::get(X->getType(), Quotient));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_896' href='#L_MULDIV_896'><pre>896</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setIsExact(I.isExact());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_897' href='#L_MULDIV_897'><pre>897</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BO;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_898' href='#L_MULDIV_898'><pre>898</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_899' href='#L_MULDIV_899'><pre>899</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_900' href='#L_MULDIV_900'><pre>900</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> // (X * C1) / C2 -> X * (C1 / C2) if C1 is a multiple of C2.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_901' href='#L_MULDIV_901'><pre>901</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>168</span></div><div class='tooltip'>IsMultiple(*C1, *C2, Quotient, IsSigned)<span class='tooltip-content'>168</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_902' href='#L_MULDIV_902'><pre>902</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *BO = BinaryOperator::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_903' href='#L_MULDIV_903'><pre>903</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction::Mul, X, ConstantInt::get(X->getType(), Quotient));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_904' href='#L_MULDIV_904'><pre>904</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setHasNoUnsignedWrap(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_905' href='#L_MULDIV_905'><pre>905</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> !IsSigned &&</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_906' href='#L_MULDIV_906'><pre>906</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cast<OverflowingBinaryOperator>(LHS)->hasNoUnsignedWrap()</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_907' href='#L_MULDIV_907'><pre>907</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setHasNoSignedWrap(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_908' href='#L_MULDIV_908'><pre>908</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<OverflowingBinaryOperator>(LHS)->hasNoSignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_909' href='#L_MULDIV_909'><pre>909</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BO;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_910' href='#L_MULDIV_910'><pre>910</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_911' href='#L_MULDIV_911'><pre>911</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_912' href='#L_MULDIV_912'><pre>912</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_913' href='#L_MULDIV_913'><pre>913</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.0k</span></div><div class='tooltip'>(IsSigned && <span class='tooltip-content'>28.0k</span></div><div class='tooltip'>match(LHS, m_NSWShl(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>15.0k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_914' href='#L_MULDIV_914'><pre>914</pre></a></td><td class='covered-line'><pre>40</pre></td><td class='code'><pre> *C1 != C1->getBitWidth() - 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_915' href='#L_MULDIV_915'><pre>915</pre></a></td><td class='covered-line'><pre>27.9k</pre></td><td class='code'><pre> <div class='tooltip'>(!IsSigned && <span class='tooltip-content'>27.9k</span></div><div class='tooltip'>match(LHS, m_NUWShl(m_Value(X), m_APInt(C1)))<span class='tooltip-content'>12.9k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>57</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_916' href='#L_MULDIV_916'><pre>916</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> APInt Quotient(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_917' href='#L_MULDIV_917'><pre>917</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> APInt C1Shifted = APInt::getOneBitSet(</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_918' href='#L_MULDIV_918'><pre>918</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> C1->getBitWidth(), static_cast<unsigned>(C1->getLimitedValue()));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_919' href='#L_MULDIV_919'><pre>919</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_920' href='#L_MULDIV_920'><pre>920</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> // (X << C1) / C2 -> X / (C2 >> C1) if C2 is a multiple of C1.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_921' href='#L_MULDIV_921'><pre>921</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> if (<div class='tooltip'>IsMultiple(*C2, C1Shifted, Quotient, IsSigned)<span class='tooltip-content'>57</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_922' href='#L_MULDIV_922'><pre>922</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::Create(</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_923' href='#L_MULDIV_923'><pre>923</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> I.getOpcode(), X, ConstantInt::get(X->getType(), Quotient));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_924' href='#L_MULDIV_924'><pre>924</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> BO->setIsExact(I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_925' href='#L_MULDIV_925'><pre>925</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_926' href='#L_MULDIV_926'><pre>926</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_927' href='#L_MULDIV_927'><pre>927</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_928' href='#L_MULDIV_928'><pre>928</pre></a></td><td class='covered-line'><pre>57</pre></td><td class='code'><pre> // (X << C1) / C2 -> X * (C2 >> C1) if C1 is a multiple of C2.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_929' href='#L_MULDIV_929'><pre>929</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>56</span></div><div class='tooltip'>IsMultiple(C1Shifted, *C2, Quotient, IsSigned)<span class='tooltip-content'>56</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_930' href='#L_MULDIV_930'><pre>930</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *BO = BinaryOperator::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_931' href='#L_MULDIV_931'><pre>931</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction::Mul, X, ConstantInt::get(X->getType(), Quotient));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_932' href='#L_MULDIV_932'><pre>932</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setHasNoUnsignedWrap(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_933' href='#L_MULDIV_933'><pre>933</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> !IsSigned &&</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_934' href='#L_MULDIV_934'><pre>934</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cast<OverflowingBinaryOperator>(LHS)->hasNoUnsignedWrap()</span><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_935' href='#L_MULDIV_935'><pre>935</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setHasNoSignedWrap(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_936' href='#L_MULDIV_936'><pre>936</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<OverflowingBinaryOperator>(LHS)->hasNoSignedWrap());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_937' href='#L_MULDIV_937'><pre>937</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BO;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_938' href='#L_MULDIV_938'><pre>938</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_939' href='#L_MULDIV_939'><pre>939</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_940' href='#L_MULDIV_940'><pre>940</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_941' href='#L_MULDIV_941'><pre>941</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>28.0k</span></div><div class='tooltip'>*C2 != 0<span class='tooltip-content'>28.0k</span></div>) // avoid X udiv 0</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_942' href='#L_MULDIV_942'><pre>942</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>28.0k</span></div><div class='tooltip'>FoldedDiv<span class='tooltip-content'>28.0k</span></div> = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_943' href='#L_MULDIV_943'><pre>943</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return FoldedDiv;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_944' href='#L_MULDIV_944'><pre>944</pre></a></td><td class='covered-line'><pre>28.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_945' href='#L_MULDIV_945'><pre>945</pre></a></td><td class='covered-line'><pre>31.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_946' href='#L_MULDIV_946'><pre>946</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_947' href='#L_MULDIV_947'><pre>947</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>33.0k</span></div><div class='tooltip'>One<span class='tooltip-content'>33.0k</span></div> = dyn_cast<ConstantInt>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>627</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_948' href='#L_MULDIV_948'><pre>948</pre></a></td><td class='covered-line'><pre>627</pre></td><td class='code'><pre> if (<div class='tooltip'>One->isOne() && <span class='tooltip-content'>627</span></div><div class='tooltip'><span class='red'>!I.getType()->isIntegerTy(1)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_949' href='#L_MULDIV_949'><pre>949</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool isSigned = I.getOpcode() == Instruction::SDiv;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_950' href='#L_MULDIV_950'><pre>950</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isSigned</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_951' href='#L_MULDIV_951'><pre>951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If Op1 is 0 then it's undefined behaviour, if Op1 is 1 then the</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_952' href='#L_MULDIV_952'><pre>952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // result is one, if Op1 is -1 then the result is minus one, otherwise</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_953' href='#L_MULDIV_953'><pre>953</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // it's zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_954' href='#L_MULDIV_954'><pre>954</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Inc = Builder->CreateAdd(Op1, One);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_955' href='#L_MULDIV_955'><pre>955</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cmp = Builder->CreateICmpULT(</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_956' href='#L_MULDIV_956'><pre>956</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Inc, ConstantInt::get(I.getType(), 3));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_957' href='#L_MULDIV_957'><pre>957</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(Cmp, Op1, ConstantInt::get(I.getType(), 0));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_958' href='#L_MULDIV_958'><pre>958</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_959' href='#L_MULDIV_959'><pre>959</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If Op1 is 0 then it's undefined behaviour. If Op1 is 1 then the</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_960' href='#L_MULDIV_960'><pre>960</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // result is one, otherwise it's zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_961' href='#L_MULDIV_961'><pre>961</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ZExtInst(Builder->CreateICmpEQ(Op1, One), I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_962' href='#L_MULDIV_962'><pre>962</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_963' href='#L_MULDIV_963'><pre>963</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_964' href='#L_MULDIV_964'><pre>964</pre></a></td><td class='covered-line'><pre>627</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_965' href='#L_MULDIV_965'><pre>965</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_966' href='#L_MULDIV_966'><pre>966</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> // See if we can fold away this div instruction.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_967' href='#L_MULDIV_967'><pre>967</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>33.0k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(I)<span class='tooltip-content'>33.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_968' href='#L_MULDIV_968'><pre>968</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_969' href='#L_MULDIV_969'><pre>969</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_970' href='#L_MULDIV_970'><pre>970</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> // (X - (X rem Y)) / Y -> X / Y; usually originates as ((X / Y) * Y) / Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_971' href='#L_MULDIV_971'><pre>971</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> Value *X = nullptr, *Z = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_972' href='#L_MULDIV_972'><pre>972</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Sub(m_Value(X), m_Value(Z)))<span class='tooltip-content'>33.0k</span></div>) <div class='tooltip'>{ // (X - Z) / Y; Y = Op1<span class='tooltip-content'>19.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_973' href='#L_MULDIV_973'><pre>973</pre></a></td><td class='covered-line'><pre>19.3k</pre></td><td class='code'><pre> bool isSigned = I.getOpcode() == Instruction::SDiv;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_974' href='#L_MULDIV_974'><pre>974</pre></a></td><td class='covered-line'><pre>19.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>(isSigned && <span class='tooltip-content'>19.3k</span></div><div class='tooltip'>match(Z, m_SRem(m_Specific(X), m_Specific(Op1)))<span class='tooltip-content'>7.51k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_975' href='#L_MULDIV_975'><pre>975</pre></a></td><td class='covered-line'><pre>19.3k</pre></td><td class='code'><pre> <div class='tooltip'>(!isSigned && <span class='tooltip-content'>19.3k</span></div><div class='tooltip'>match(Z, m_URem(m_Specific(X), m_Specific(Op1)))<span class='tooltip-content'>11.8k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_976' href='#L_MULDIV_976'><pre>976</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::Create(I.getOpcode(), X, Op1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_977' href='#L_MULDIV_977'><pre>977</pre></a></td><td class='covered-line'><pre>19.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_978' href='#L_MULDIV_978'><pre>978</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_979' href='#L_MULDIV_979'><pre>979</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_980' href='#L_MULDIV_980'><pre>980</pre></a></td><td class='covered-line'><pre>33.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_981' href='#L_MULDIV_981'><pre>981</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_982' href='#L_MULDIV_982'><pre>982</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// dyn_castZExtVal - Checks if V is a zext or constant that can</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_983' href='#L_MULDIV_983'><pre>983</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// be truncated to Ty without losing bits.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_984' href='#L_MULDIV_984'><pre>984</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre>static Value *dyn_castZExtVal(Value *V, Type *Ty) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_985' href='#L_MULDIV_985'><pre>985</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre> if (ZExtInst *<div class='tooltip'>Z<span class='tooltip-content'>76</span></div> = dyn_cast<ZExtInst>(V)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_986' href='#L_MULDIV_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Z->getSrcTy() == Ty</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_987' href='#L_MULDIV_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Z->getOperand(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_988' href='#L_MULDIV_988'><pre>988</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>76</span></div><div class='tooltip'>C<span class='tooltip-content'>76</span></div> = dyn_cast<ConstantInt>(V)) <div class='tooltip'>{<span class='tooltip-content'>32</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_989' href='#L_MULDIV_989'><pre>989</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> if (C->getValue().getActiveBits() <= cast<IntegerType>(Ty)->getBitWidth())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_990' href='#L_MULDIV_990'><pre>990</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> return ConstantExpr::getTrunc(C, Ty);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_991' href='#L_MULDIV_991'><pre>991</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_992' href='#L_MULDIV_992'><pre>992</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_993' href='#L_MULDIV_993'><pre>993</pre></a></td><td class='covered-line'><pre>76</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_994' href='#L_MULDIV_994'><pre>994</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_995' href='#L_MULDIV_995'><pre>995</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>namespace {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_996' href='#L_MULDIV_996'><pre>996</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>const unsigned MaxDepth = 6;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_997' href='#L_MULDIV_997'><pre>997</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>typedef Instruction *(*FoldUDivOperandCb)(Value *Op0, Value *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_998' href='#L_MULDIV_998'><pre>998</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const BinaryOperator &I,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_999' href='#L_MULDIV_999'><pre>999</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> InstCombiner &IC);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1000' href='#L_MULDIV_1000'><pre>1000</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1001' href='#L_MULDIV_1001'><pre>1001</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \brief Used to maintain state for visitUDivOperand().</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1002' href='#L_MULDIV_1002'><pre>1002</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct UDivFoldAction {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1003' href='#L_MULDIV_1003'><pre>1003</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> FoldUDivOperandCb FoldAction; ///< Informs visitUDiv() how to fold this</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1004' href='#L_MULDIV_1004'><pre>1004</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///< operand. This can be zero if this action</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1005' href='#L_MULDIV_1005'><pre>1005</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///< joins two actions together.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1006' href='#L_MULDIV_1006'><pre>1006</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1007' href='#L_MULDIV_1007'><pre>1007</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *OperandToFold; ///< Which operand to fold.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1008' href='#L_MULDIV_1008'><pre>1008</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> union {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1009' href='#L_MULDIV_1009'><pre>1009</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *FoldResult; ///< The instruction returned when FoldAction is</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1010' href='#L_MULDIV_1010'><pre>1010</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///< invoked.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1011' href='#L_MULDIV_1011'><pre>1011</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1012' href='#L_MULDIV_1012'><pre>1012</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> size_t SelectLHSIdx; ///< Stores the LHS action index if this action</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1013' href='#L_MULDIV_1013'><pre>1013</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ///< joins two actions together.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1014' href='#L_MULDIV_1014'><pre>1014</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1015' href='#L_MULDIV_1015'><pre>1015</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1016' href='#L_MULDIV_1016'><pre>1016</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> UDivFoldAction(FoldUDivOperandCb FA, Value *InputOperand)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1017' href='#L_MULDIV_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> : FoldAction(FA), OperandToFold(InputOperand), FoldResult(nullptr) {}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1018' href='#L_MULDIV_1018'><pre>1018</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> UDivFoldAction(FoldUDivOperandCb FA, Value *InputOperand, size_t SLHS)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1019' href='#L_MULDIV_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> : FoldAction(FA), OperandToFold(InputOperand), SelectLHSIdx(SLHS) {}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1020' href='#L_MULDIV_1020'><pre>1020</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1021' href='#L_MULDIV_1021'><pre>1021</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1022' href='#L_MULDIV_1022'><pre>1022</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1023' href='#L_MULDIV_1023'><pre>1023</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// X udiv 2^C -> X >> C</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1024' href='#L_MULDIV_1024'><pre>1024</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldUDivPow2Cst(Value *Op0, Value *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1025' href='#L_MULDIV_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> const BinaryOperator &I, InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1026' href='#L_MULDIV_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> const APInt &C = cast<Constant>(Op1)->getUniqueInteger();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1027' href='#L_MULDIV_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> BinaryOperator *LShr = BinaryOperator::CreateLShr(</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1028' href='#L_MULDIV_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> Op0, ConstantInt::get(Op0->getType(), C.logBase2()));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1029' href='#L_MULDIV_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> if (I.isExact())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1030' href='#L_MULDIV_1030'><pre>1030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LShr->setIsExact()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1031' href='#L_MULDIV_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> return LShr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1032' href='#L_MULDIV_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1033' href='#L_MULDIV_1033'><pre>1033</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1034' href='#L_MULDIV_1034'><pre>1034</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// X udiv C, where C >= signbit</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1035' href='#L_MULDIV_1035'><pre>1035</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldUDivNegCst(Value *Op0, Value *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1036' href='#L_MULDIV_1036'><pre>1036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const BinaryOperator &I, InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1037' href='#L_MULDIV_1037'><pre>1037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ICI = IC.Builder->CreateICmpULT(Op0, cast<ConstantInt>(Op1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1038' href='#L_MULDIV_1038'><pre>1038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1039' href='#L_MULDIV_1039'><pre>1039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(ICI, Constant::getNullValue(I.getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1040' href='#L_MULDIV_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(I.getType(), 1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1041' href='#L_MULDIV_1041'><pre>1041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1042' href='#L_MULDIV_1042'><pre>1042</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1043' href='#L_MULDIV_1043'><pre>1043</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// X udiv (C1 << N), where C1 is "1<<C2" --> X >> (N+C2)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1044' href='#L_MULDIV_1044'><pre>1044</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// X udiv (zext (C1 << N)), where C1 is "1<<C2" --> X >> (N+C2)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1045' href='#L_MULDIV_1045'><pre>1045</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldUDivShl(Value *Op0, Value *Op1, const BinaryOperator &I,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1046' href='#L_MULDIV_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1047' href='#L_MULDIV_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ShiftLeft;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1048' href='#L_MULDIV_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!match(Op1, m_ZExt(m_Value(ShiftLeft)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1049' href='#L_MULDIV_1049'><pre>1049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShiftLeft = Op1</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1050' href='#L_MULDIV_1050'><pre>1050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1051' href='#L_MULDIV_1051'><pre>1051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> const APInt *CI;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1052' href='#L_MULDIV_1052'><pre>1052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *N;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1053' href='#L_MULDIV_1053'><pre>1053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!match(ShiftLeft, m_Shl(m_APInt(CI), m_Value(N)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1054' href='#L_MULDIV_1054'><pre>1054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("match should never fail here!");</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1055' href='#L_MULDIV_1055'><pre>1055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>*CI != 1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1056' href='#L_MULDIV_1056'><pre>1056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>N = IC.Builder->CreateAdd(N,</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1057' href='#L_MULDIV_1057'><pre>1057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(N->getType(), CI->logBase2()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1058' href='#L_MULDIV_1058'><pre>1058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Op1 != ShiftLeft</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1059' href='#L_MULDIV_1059'><pre>1059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>N = IC.Builder->CreateZExt(N, Op1->getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1060' href='#L_MULDIV_1060'><pre>1060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *LShr = BinaryOperator::CreateLShr(Op0, N);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1061' href='#L_MULDIV_1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>I.isExact()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1062' href='#L_MULDIV_1062'><pre>1062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LShr->setIsExact()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1063' href='#L_MULDIV_1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LShr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1064' href='#L_MULDIV_1064'><pre>1064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1065' href='#L_MULDIV_1065'><pre>1065</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1066' href='#L_MULDIV_1066'><pre>1066</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// \brief Recursively visits the possible right hand operands of a udiv</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1067' href='#L_MULDIV_1067'><pre>1067</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// instruction, seeing through select instructions, to determine if we can</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1068' href='#L_MULDIV_1068'><pre>1068</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// replace the udiv with something simpler. If we find that an operand is not</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1069' href='#L_MULDIV_1069'><pre>1069</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// able to simplify the udiv, we abort the entire transformation.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1070' href='#L_MULDIV_1070'><pre>1070</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static size_t visitUDivOperand(Value *Op0, Value *Op1, const BinaryOperator &I,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1071' href='#L_MULDIV_1071'><pre>1071</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SmallVectorImpl<UDivFoldAction> &Actions,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1072' href='#L_MULDIV_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> unsigned Depth = 0) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1073' href='#L_MULDIV_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> // Check to see if this is an unsigned division with an exact power of 2,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1074' href='#L_MULDIV_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> // if so, convert to a right shift.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1075' href='#L_MULDIV_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_Power2())<span class='tooltip-content'>15.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>478</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1076' href='#L_MULDIV_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> Actions.push_back(UDivFoldAction(foldUDivPow2Cst, Op1));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1077' href='#L_MULDIV_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> return Actions.size();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1078' href='#L_MULDIV_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1079' href='#L_MULDIV_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>15.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1080' href='#L_MULDIV_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>15.0k</span></div><div class='tooltip'>C<span class='tooltip-content'>15.0k</span></div> = dyn_cast<ConstantInt>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1081' href='#L_MULDIV_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> // X udiv C, where C >= signbit</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1082' href='#L_MULDIV_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>12.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.7k</span></div><div class='tooltip'>C->getValue().isNegative()<span class='tooltip-content'>12.7k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1083' href='#L_MULDIV_1083'><pre>1083</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Actions.push_back(UDivFoldAction(foldUDivNegCst, C));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1084' href='#L_MULDIV_1084'><pre>1084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Actions.size();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1085' href='#L_MULDIV_1085'><pre>1085</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1086' href='#L_MULDIV_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1087' href='#L_MULDIV_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> // X udiv (C1 << N), where C1 is "1<<C2" --> X >> (N+C2)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1088' href='#L_MULDIV_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.0k</span></div><div class='tooltip'>match(Op1, m_Shl(m_Power2(), m_Value())) ||<span class='tooltip-content'>15.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1089' href='#L_MULDIV_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_ZExt(m_Shl(m_Power2(), m_Value())))<span class='tooltip-content'>15.0k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1090' href='#L_MULDIV_1090'><pre>1090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Actions.push_back(UDivFoldAction(foldUDivShl, Op1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1091' href='#L_MULDIV_1091'><pre>1091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Actions.size();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1092' href='#L_MULDIV_1092'><pre>1092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1093' href='#L_MULDIV_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1094' href='#L_MULDIV_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> // The remaining tests are all recursive, so bail out if we hit the limit.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1095' href='#L_MULDIV_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.0k</span></div><div class='tooltip'>Depth++ == MaxDepth<span class='tooltip-content'>15.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1096' href='#L_MULDIV_1096'><pre>1096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return 0</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1097' href='#L_MULDIV_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1098' href='#L_MULDIV_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>15.0k</span></div><div class='tooltip'>SI<span class='tooltip-content'>15.0k</span></div> = dyn_cast<SelectInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1099' href='#L_MULDIV_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>202</pre></td><td class='code'><pre> <div class='tooltip'>if (size_t <span class='tooltip-content'>202</span></div><div class='tooltip'>LHSIdx<span class='tooltip-content'>202</span></div> =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1100' href='#L_MULDIV_1100'><pre>1100</pre></a></td><td class='covered-line'><pre>202</pre></td><td class='code'><pre> visitUDivOperand(Op0, SI->getOperand(1), I, Actions, Depth))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1101' href='#L_MULDIV_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>193</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>193</span></div><div class='tooltip'>visitUDivOperand(Op0, SI->getOperand(2), I, Actions, Depth)<span class='tooltip-content'>193</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1102' href='#L_MULDIV_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Actions.push_back(UDivFoldAction(nullptr, Op1, LHSIdx - 1));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1103' href='#L_MULDIV_1103'><pre>1103</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return Actions.size();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1104' href='#L_MULDIV_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1105' href='#L_MULDIV_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1106' href='#L_MULDIV_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre> return 0;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1107' href='#L_MULDIV_1107'><pre>1107</pre></a></td><td class='covered-line'><pre>15.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1108' href='#L_MULDIV_1108'><pre>1108</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1109' href='#L_MULDIV_1109'><pre>1109</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitUDiv(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1110' href='#L_MULDIV_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1111' href='#L_MULDIV_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1112' href='#L_MULDIV_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1113' href='#L_MULDIV_1113'><pre>1113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1114' href='#L_MULDIV_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1115' href='#L_MULDIV_1115'><pre>1115</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>15.2k</span></div> = SimplifyUDivInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1116' href='#L_MULDIV_1116'><pre>1116</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1117' href='#L_MULDIV_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1118' href='#L_MULDIV_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // Handle the integer div common cases</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1119' href='#L_MULDIV_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>15.2k</span></div><div class='tooltip'>Common<span class='tooltip-content'>15.2k</span></div> = commonIDivTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1120' href='#L_MULDIV_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Common;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1121' href='#L_MULDIV_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1122' href='#L_MULDIV_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // (x lshr C1) udiv C2 --> x udiv (C2 << C1)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1123' href='#L_MULDIV_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1124' href='#L_MULDIV_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1125' href='#L_MULDIV_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> const APInt *C1, *C2;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1126' href='#L_MULDIV_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> if (match(Op0, m_LShr(m_Value(X), m_APInt(C1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1127' href='#L_MULDIV_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> <div class='tooltip'>match(Op1, m_APInt(C2))<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1128' href='#L_MULDIV_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> bool Overflow;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1129' href='#L_MULDIV_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> APInt C2ShlC1 = C2->ushl_ov(*C1, Overflow);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1130' href='#L_MULDIV_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (<div class='tooltip'>!Overflow<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1131' href='#L_MULDIV_1131'><pre>1131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool IsExact = I.isExact() && <span class='red'>match(Op0, m_Exact(m_Value()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1132' href='#L_MULDIV_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::CreateUDiv(</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1133' href='#L_MULDIV_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> X, ConstantInt::get(X->getType(), C2ShlC1));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1134' href='#L_MULDIV_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (IsExact)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1135' href='#L_MULDIV_1135'><pre>1135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BO->setIsExact()</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1136' href='#L_MULDIV_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1137' href='#L_MULDIV_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1138' href='#L_MULDIV_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1139' href='#L_MULDIV_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1140' href='#L_MULDIV_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1141' href='#L_MULDIV_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>15.2k</pre></td><td class='code'><pre> // (zext A) udiv (zext B) --> zext (A udiv B)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1142' href='#L_MULDIV_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (ZExtInst *<span class='tooltip-content'>15.1k</span></div><div class='tooltip'>ZOp0<span class='tooltip-content'>15.1k</span></div> = dyn_cast<ZExtInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1143' href='#L_MULDIV_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>65</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>65</span></div><div class='tooltip'>ZOp1<span class='tooltip-content'>65</span></div> = dyn_castZExtVal(Op1, ZOp0->getSrcTy()))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1144' href='#L_MULDIV_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return new ZExtInst(</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1145' href='#L_MULDIV_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> Builder->CreateUDiv(ZOp0->getOperand(0), ZOp1, "div", I.isExact()),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1146' href='#L_MULDIV_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1147' href='#L_MULDIV_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1148' href='#L_MULDIV_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> // (LHS udiv (select (select (...)))) -> (LHS >> (select (select (...))))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1149' href='#L_MULDIV_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> SmallVector<UDivFoldAction, 6> UDivActions;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1150' href='#L_MULDIV_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> if (visitUDivOperand(Op0, Op1, I, UDivActions))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1151' href='#L_MULDIV_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 0, e = UDivActions.size(); <span class='tooltip-content'>285</span></div><div class='tooltip'>i != e<span class='tooltip-content'>289</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>289</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1152' href='#L_MULDIV_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> FoldUDivOperandCb Action = UDivActions[i].FoldAction;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1153' href='#L_MULDIV_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> Value *ActionOp1 = UDivActions[i].OperandToFold;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1154' href='#L_MULDIV_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> Instruction *Inst;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1155' href='#L_MULDIV_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> if (Action)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1156' href='#L_MULDIV_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>287</pre></td><td class='code'><pre> Inst = Action(Op0, ActionOp1, I, *this);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1157' href='#L_MULDIV_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> else {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1158' href='#L_MULDIV_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // This action joins two actions together. The RHS of this action is</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1159' href='#L_MULDIV_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // simply the last action we processed, we saved the LHS action index in</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1160' href='#L_MULDIV_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // the joining action.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1161' href='#L_MULDIV_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> size_t SelectRHSIdx = i - 1;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1162' href='#L_MULDIV_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *SelectRHS = UDivActions[SelectRHSIdx].FoldResult;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1163' href='#L_MULDIV_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> size_t SelectLHSIdx = UDivActions[i].SelectLHSIdx;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1164' href='#L_MULDIV_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Value *SelectLHS = UDivActions[SelectLHSIdx].FoldResult;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1165' href='#L_MULDIV_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Inst = SelectInst::Create(cast<SelectInst>(ActionOp1)->getCondition(),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1166' href='#L_MULDIV_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> SelectLHS, SelectRHS);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1167' href='#L_MULDIV_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1168' href='#L_MULDIV_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1169' href='#L_MULDIV_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> // If this is the last action to process, return it to the InstCombiner.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1170' href='#L_MULDIV_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> // Otherwise, we insert it before the UDiv and record it so that we may</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1171' href='#L_MULDIV_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> // use it as part of a joining action (i.e., a SelectInst).</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1172' href='#L_MULDIV_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> if (<div class='tooltip'>e - i != 1<span class='tooltip-content'>289</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1173' href='#L_MULDIV_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Inst->insertBefore(&I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1174' href='#L_MULDIV_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> UDivActions[i].FoldResult = Inst;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1175' href='#L_MULDIV_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> } else</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1176' href='#L_MULDIV_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>285</pre></td><td class='code'><pre> return Inst;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1177' href='#L_MULDIV_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>289</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1178' href='#L_MULDIV_1178'><pre>1178</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1179' href='#L_MULDIV_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>14.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1180' href='#L_MULDIV_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1181' href='#L_MULDIV_1181'><pre>1181</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1182' href='#L_MULDIV_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1183' href='#L_MULDIV_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1184' href='#L_MULDIV_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1185' href='#L_MULDIV_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1186' href='#L_MULDIV_1186'><pre>1186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1187' href='#L_MULDIV_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1188' href='#L_MULDIV_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>17.8k</span></div><div class='tooltip'>V<span class='tooltip-content'>17.8k</span></div> = SimplifySDivInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1189' href='#L_MULDIV_1189'><pre>1189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1190' href='#L_MULDIV_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1191' href='#L_MULDIV_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> // Handle the integer div common cases</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1192' href='#L_MULDIV_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>17.8k</span></div><div class='tooltip'>Common<span class='tooltip-content'>17.8k</span></div> = commonIDivTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1193' href='#L_MULDIV_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return Common;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1194' href='#L_MULDIV_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1195' href='#L_MULDIV_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> const APInt *Op1C;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1196' href='#L_MULDIV_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(Op1C))<span class='tooltip-content'>17.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1197' href='#L_MULDIV_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> // sdiv X, -1 == -X</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1198' href='#L_MULDIV_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> if (Op1C->isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1199' href='#L_MULDIV_1199'><pre>1199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateNeg(Op0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1200' href='#L_MULDIV_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1201' href='#L_MULDIV_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> // sdiv exact X, C --> ashr exact X, log2(C)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1202' href='#L_MULDIV_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.4k</span></div><div class='tooltip'>I.isExact() && <span class='tooltip-content'>15.4k</span></div><div class='tooltip'>Op1C->isNonNegative()<span class='tooltip-content'>6.64k</span></div> && <div class='tooltip'>Op1C->isPowerOf2()<span class='tooltip-content'>6.64k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>307</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1203' href='#L_MULDIV_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>307</pre></td><td class='code'><pre> Value *ShAmt = ConstantInt::get(Op1->getType(), Op1C->exactLogBase2());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1204' href='#L_MULDIV_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>307</pre></td><td class='code'><pre> return BinaryOperator::CreateExactAShr(Op0, ShAmt, I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1205' href='#L_MULDIV_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>307</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1206' href='#L_MULDIV_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1207' href='#L_MULDIV_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> // If the dividend is sign-extended and the constant divisor is small enough</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1208' href='#L_MULDIV_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> // to fit in the source type, shrink the division to the narrower type:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1209' href='#L_MULDIV_1209'><pre>1209</pre></a></td><td class='covered-line'><pre>15.4k</pre></td><td class='code'><pre> // (sext X) sdiv C --> sext (X sdiv C)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1210' href='#L_MULDIV_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> Value *Op0Src;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1211' href='#L_MULDIV_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> if (match(Op0, m_OneUse(m_SExt(m_Value(Op0Src)))) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1212' href='#L_MULDIV_1212'><pre>1212</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>Op0Src->getType()->getScalarSizeInBits() >= Op1C->getMinSignedBits()<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>20</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1213' href='#L_MULDIV_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1214' href='#L_MULDIV_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // In the general case, we need to make sure that the dividend is not the</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1215' href='#L_MULDIV_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // minimum signed value because dividing that by -1 is UB. But here, we</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1216' href='#L_MULDIV_1216'><pre>1216</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> // know that the -1 divisor case is already handled above.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1217' href='#L_MULDIV_1217'><pre>1217</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1218' href='#L_MULDIV_1218'><pre>1218</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Constant *NarrowDivisor =</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1219' href='#L_MULDIV_1219'><pre>1219</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> ConstantExpr::getTrunc(cast<Constant>(Op1), Op0Src->getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1220' href='#L_MULDIV_1220'><pre>1220</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Value *NarrowOp = Builder->CreateSDiv(Op0Src, NarrowDivisor);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1221' href='#L_MULDIV_1221'><pre>1221</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return new SExtInst(NarrowOp, Op0->getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1222' href='#L_MULDIV_1222'><pre>1222</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1223' href='#L_MULDIV_1223'><pre>1223</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1224' href='#L_MULDIV_1224'><pre>1224</pre></a></td><td class='covered-line'><pre>17.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1225' href='#L_MULDIV_1225'><pre>1225</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>17.5k</span></div><div class='tooltip'>RHS<span class='tooltip-content'>17.5k</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>15.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1226' href='#L_MULDIV_1226'><pre>1226</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> // X/INT_MIN -> X == INT_MIN</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1227' href='#L_MULDIV_1227'><pre>1227</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> if (RHS->isMinSignedValue())</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1228' href='#L_MULDIV_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return new ZExtInst(Builder->CreateICmpEQ(Op0, Op1), I.getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1229' href='#L_MULDIV_1229'><pre>1229</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1230' href='#L_MULDIV_1230'><pre>1230</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> // -X/C --> X/-C provided the negation doesn't overflow.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1231' href='#L_MULDIV_1231'><pre>1231</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1232' href='#L_MULDIV_1232'><pre>1232</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_NSWSub(m_Zero(), m_Value(X)))<span class='tooltip-content'>15.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1233' href='#L_MULDIV_1233'><pre>1233</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> auto *BO = BinaryOperator::CreateSDiv(X, ConstantExpr::getNeg(RHS));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1234' href='#L_MULDIV_1234'><pre>1234</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> BO->setIsExact(I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1235' href='#L_MULDIV_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1236' href='#L_MULDIV_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1237' href='#L_MULDIV_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>15.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1238' href='#L_MULDIV_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1239' href='#L_MULDIV_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // If the sign bits of both operands are zero (i.e. we can prove they are</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1240' href='#L_MULDIV_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // unsigned inputs), turn this into a udiv.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1241' href='#L_MULDIV_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>17.5k</span></div><div class='tooltip'>I.getType()->isIntegerTy()<span class='tooltip-content'>17.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1242' href='#L_MULDIV_1242'><pre>1242</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1243' href='#L_MULDIV_1243'><pre>1243</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskedValueIsZero(Op0, Mask, 0, &I)<span class='tooltip-content'>17.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>277</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1244' href='#L_MULDIV_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>277</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskedValueIsZero(Op1, Mask, 0, &I)<span class='tooltip-content'>277</span></div>) <div class='tooltip'>{<span class='tooltip-content'>37</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1245' href='#L_MULDIV_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> // X sdiv Y -> X udiv Y, iff X and Y don't have sign bit set</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1246' href='#L_MULDIV_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1247' href='#L_MULDIV_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> BO->setIsExact(I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1248' href='#L_MULDIV_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1249' href='#L_MULDIV_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1250' href='#L_MULDIV_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>277</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1251' href='#L_MULDIV_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>240</span></div><div class='tooltip'>isKnownToBeAPowerOfTwo(Op1, DL, /*OrZero*/ true, 0, &AC, &I, &DT)<span class='tooltip-content'>240</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1252' href='#L_MULDIV_1252'><pre>1252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X sdiv (1 << Y) -> X udiv (1 << Y) ( -> X u>> Y)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1253' href='#L_MULDIV_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Safe because the only negative value (1 << Y) can take on is</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1254' href='#L_MULDIV_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // INT_MIN, and X sdiv INT_MIN == X udiv INT_MIN == 0 if X doesn't have</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1255' href='#L_MULDIV_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the sign bit set.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1256' href='#L_MULDIV_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *BO = BinaryOperator::CreateUDiv(Op0, Op1, I.getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1257' href='#L_MULDIV_1257'><pre>1257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BO->setIsExact(I.isExact());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1258' href='#L_MULDIV_1258'><pre>1258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BO;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1259' href='#L_MULDIV_1259'><pre>1259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1260' href='#L_MULDIV_1260'><pre>1260</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1261' href='#L_MULDIV_1261'><pre>1261</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1262' href='#L_MULDIV_1262'><pre>1262</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1263' href='#L_MULDIV_1263'><pre>1263</pre></a></td><td class='covered-line'><pre>17.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1264' href='#L_MULDIV_1264'><pre>1264</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1265' href='#L_MULDIV_1265'><pre>1265</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1266' href='#L_MULDIV_1266'><pre>1266</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// CvtFDivConstToReciprocal tries to convert X/C into X*1/C if C not a special</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1267' href='#L_MULDIV_1267'><pre>1267</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// FP value and:</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1268' href='#L_MULDIV_1268'><pre>1268</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 1) 1/C is exact, or</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1269' href='#L_MULDIV_1269'><pre>1269</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 2) reciprocal is allowed.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1270' href='#L_MULDIV_1270'><pre>1270</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If the conversion was successful, the simplified expression "X * 1/C" is</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1271' href='#L_MULDIV_1271'><pre>1271</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// returned; otherwise, NULL is returned.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1272' href='#L_MULDIV_1272'><pre>1272</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1273' href='#L_MULDIV_1273'><pre>1273</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *CvtFDivConstToReciprocal(Value *Dividend, Constant *Divisor,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1274' href='#L_MULDIV_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> bool AllowReciprocal) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1275' href='#L_MULDIV_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> if (!isa<ConstantFP>(Divisor)) // TODO: handle vectors.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1276' href='#L_MULDIV_1276'><pre>1276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1277' href='#L_MULDIV_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1278' href='#L_MULDIV_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> const APFloat &FpVal = cast<ConstantFP>(Divisor)->getValueAPF();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1279' href='#L_MULDIV_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> APFloat Reciprocal(FpVal.getSemantics());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1280' href='#L_MULDIV_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> bool Cvt = FpVal.getExactInverse(&Reciprocal);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1281' href='#L_MULDIV_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1282' href='#L_MULDIV_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cvt && <span class='tooltip-content'>1.90k</span></div><div class='tooltip'>AllowReciprocal<span class='tooltip-content'>1.83k</span></div> && <div class='tooltip'><span class='red'>FpVal.isFiniteNonZero()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1283' href='#L_MULDIV_1283'><pre>1283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Reciprocal = APFloat(FpVal.getSemantics(), 1.0f);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1284' href='#L_MULDIV_1284'><pre>1284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> (void)Reciprocal.divide(FpVal, APFloat::rmNearestTiesToEven);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1285' href='#L_MULDIV_1285'><pre>1285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cvt = !Reciprocal.isDenormal();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1286' href='#L_MULDIV_1286'><pre>1286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1287' href='#L_MULDIV_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1288' href='#L_MULDIV_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> if (!Cvt)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1289' href='#L_MULDIV_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1290' href='#L_MULDIV_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1291' href='#L_MULDIV_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> ConstantFP *R;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1292' href='#L_MULDIV_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> R = ConstantFP::get(Dividend->getType()->getContext(), Reciprocal);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1293' href='#L_MULDIV_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> return BinaryOperator::CreateFMul(Dividend, R);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1294' href='#L_MULDIV_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1295' href='#L_MULDIV_1295'><pre>1295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1296' href='#L_MULDIV_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1297' href='#L_MULDIV_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1298' href='#L_MULDIV_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1299' href='#L_MULDIV_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1300' href='#L_MULDIV_1300'><pre>1300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1301' href='#L_MULDIV_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1302' href='#L_MULDIV_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>17.2k</span></div><div class='tooltip'>V<span class='tooltip-content'>17.2k</span></div> = SimplifyFDivInst(Op0, Op1, I.getFastMathFlags(),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1303' href='#L_MULDIV_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1304' href='#L_MULDIV_1304'><pre>1304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1305' href='#L_MULDIV_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1306' href='#L_MULDIV_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>17.2k</span></div><div class='tooltip'>isa<Constant>(Op0)<span class='tooltip-content'>17.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1307' href='#L_MULDIV_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>6.72k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>6.72k</span></div><div class='tooltip'>SI<span class='tooltip-content'>6.72k</span></div> = dyn_cast<SelectInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1308' href='#L_MULDIV_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1</span></div><div class='tooltip'>R<span class='tooltip-content'>1</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1309' href='#L_MULDIV_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1310' href='#L_MULDIV_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1311' href='#L_MULDIV_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> bool AllowReassociate = I.hasUnsafeAlgebra();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1312' href='#L_MULDIV_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> bool AllowReciprocal = I.hasAllowReciprocal();</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1313' href='#L_MULDIV_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1314' href='#L_MULDIV_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>Op1C<span class='tooltip-content'>17.2k</span></div> = dyn_cast<Constant>(Op1)) <div class='tooltip'>{<span class='tooltip-content'>1.90k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1315' href='#L_MULDIV_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> if (SelectInst *SI = dyn_cast<SelectInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1316' href='#L_MULDIV_1316'><pre>1316</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>24</span></div><div class='tooltip'>R<span class='tooltip-content'>24</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1317' href='#L_MULDIV_1317'><pre>1317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return R</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1318' href='#L_MULDIV_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1319' href='#L_MULDIV_1319'><pre>1319</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.90k</span></div><div class='tooltip'>AllowReassociate<span class='tooltip-content'>1.90k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1320' href='#L_MULDIV_1320'><pre>1320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1321' href='#L_MULDIV_1321'><pre>1321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C2 = Op1C;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1322' href='#L_MULDIV_1322'><pre>1322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *X;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1323' href='#L_MULDIV_1323'><pre>1323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Res = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1324' href='#L_MULDIV_1324'><pre>1324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1325' href='#L_MULDIV_1325'><pre>1325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>match(Op0, m_FMul(m_Value(X), m_Constant(C1)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1326' href='#L_MULDIV_1326'><pre>1326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X*C1)/C2 => X * (C1/C2)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1327' href='#L_MULDIV_1327'><pre>1327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1328' href='#L_MULDIV_1328'><pre>1328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C = ConstantExpr::getFDiv(C1, C2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1329' href='#L_MULDIV_1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isNormalFp(C)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1330' href='#L_MULDIV_1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Res = BinaryOperator::CreateFMul(X, C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1331' href='#L_MULDIV_1331'><pre>1331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Op0, m_FDiv(m_Value(X), m_Constant(C1)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1332' href='#L_MULDIV_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X/C1)/C2 => X /(C2*C1) [=> X * 1/(C2*C1) if reciprocal is allowed]</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1333' href='#L_MULDIV_1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1334' href='#L_MULDIV_1334'><pre>1334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C = ConstantExpr::getFMul(C1, C2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1335' href='#L_MULDIV_1335'><pre>1335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isNormalFp(C)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1336' href='#L_MULDIV_1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Res = CvtFDivConstToReciprocal(X, C, AllowReciprocal);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1337' href='#L_MULDIV_1337'><pre>1337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Res</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1338' href='#L_MULDIV_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Res = BinaryOperator::CreateFDiv(X, C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1339' href='#L_MULDIV_1339'><pre>1339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1340' href='#L_MULDIV_1340'><pre>1340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1341' href='#L_MULDIV_1341'><pre>1341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1342' href='#L_MULDIV_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Res</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1343' href='#L_MULDIV_1343'><pre>1343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Res->setFastMathFlags(I.getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1344' href='#L_MULDIV_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Res;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1345' href='#L_MULDIV_1345'><pre>1345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1346' href='#L_MULDIV_1346'><pre>1346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1347' href='#L_MULDIV_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1348' href='#L_MULDIV_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> // X / C => X * 1/C</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1349' href='#L_MULDIV_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>1.90k</span></div><div class='tooltip'>T<span class='tooltip-content'>1.90k</span></div> = CvtFDivConstToReciprocal(Op0, Op1C, AllowReciprocal)) <div class='tooltip'>{<span class='tooltip-content'>77</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1350' href='#L_MULDIV_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> T->copyFastMathFlags(&I);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1351' href='#L_MULDIV_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> return T;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1352' href='#L_MULDIV_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>77</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1353' href='#L_MULDIV_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1354' href='#L_MULDIV_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1355' href='#L_MULDIV_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>1.90k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1356' href='#L_MULDIV_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>17.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1357' href='#L_MULDIV_1357'><pre>1357</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.3k</span></div><div class='tooltip'>AllowReassociate && <span class='tooltip-content'>15.3k</span></div><div class='tooltip'><span class='red'>isa<Constant>(Op0)</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1358' href='#L_MULDIV_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C1 = cast<Constant>(Op0), *C2;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1359' href='#L_MULDIV_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Fold = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1360' href='#L_MULDIV_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *X;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1361' href='#L_MULDIV_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool CreateDiv = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1362' href='#L_MULDIV_1362'><pre>1362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1363' href='#L_MULDIV_1363'><pre>1363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // C1 / (X*C2) => (C1/C2) / X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1364' href='#L_MULDIV_1364'><pre>1364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>match(Op1, m_FMul(m_Value(X), m_Constant(C2)))</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1365' href='#L_MULDIV_1365'><pre>1365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Fold = ConstantExpr::getFDiv(C1, C2)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1366' href='#L_MULDIV_1366'><pre>1366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Op1, m_FDiv(m_Value(X), m_Constant(C2)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1367' href='#L_MULDIV_1367'><pre>1367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // C1 / (X/C2) => (C1*C2) / X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1368' href='#L_MULDIV_1368'><pre>1368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Fold = ConstantExpr::getFMul(C1, C2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1369' href='#L_MULDIV_1369'><pre>1369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Op1, m_FDiv(m_Constant(C2), m_Value(X)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1370' href='#L_MULDIV_1370'><pre>1370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // C1 / (C2/X) => (C1/C2) * X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1371' href='#L_MULDIV_1371'><pre>1371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Fold = ConstantExpr::getFDiv(C1, C2);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1372' href='#L_MULDIV_1372'><pre>1372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CreateDiv = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1373' href='#L_MULDIV_1373'><pre>1373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1374' href='#L_MULDIV_1374'><pre>1374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1375' href='#L_MULDIV_1375'><pre>1375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Fold && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isNormalFp(Fold)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1376' href='#L_MULDIV_1376'><pre>1376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *R = CreateDiv ? </span><span class='red'>BinaryOperator::CreateFDiv(Fold, X)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1377' href='#L_MULDIV_1377'><pre>1377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>BinaryOperator::CreateFMul(X, Fold)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1378' href='#L_MULDIV_1378'><pre>1378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> R->setFastMathFlags(I.getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1379' href='#L_MULDIV_1379'><pre>1379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return R;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1380' href='#L_MULDIV_1380'><pre>1380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1381' href='#L_MULDIV_1381'><pre>1381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1382' href='#L_MULDIV_1382'><pre>1382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1383' href='#L_MULDIV_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1384' href='#L_MULDIV_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>15.3k</span></div><div class='tooltip'>AllowReassociate<span class='tooltip-content'>15.3k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1385' href='#L_MULDIV_1385'><pre>1385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *X, *Y;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1386' href='#L_MULDIV_1386'><pre>1386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewInst = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1387' href='#L_MULDIV_1387'><pre>1387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *SimpR = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1388' href='#L_MULDIV_1388'><pre>1388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1389' href='#L_MULDIV_1389'><pre>1389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Op0->hasOneUse() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Op0, m_FDiv(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1390' href='#L_MULDIV_1390'><pre>1390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X/Y) / Z => X / (Y*Z)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1391' href='#L_MULDIV_1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1392' href='#L_MULDIV_1392'><pre>1392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!isa<Constant>(Y) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Op1)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1393' href='#L_MULDIV_1393'><pre>1393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewInst = Builder->CreateFMul(Y, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1394' href='#L_MULDIV_1394'><pre>1394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><div class='tooltip'><span class='red'>RI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Instruction>(NewInst)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1395' href='#L_MULDIV_1395'><pre>1395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FastMathFlags Flags = I.getFastMathFlags();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1396' href='#L_MULDIV_1396'><pre>1396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Flags &= cast<Instruction>(Op0)->getFastMathFlags();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1397' href='#L_MULDIV_1397'><pre>1397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RI->setFastMathFlags(Flags);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1398' href='#L_MULDIV_1398'><pre>1398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1399' href='#L_MULDIV_1399'><pre>1399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpR = BinaryOperator::CreateFDiv(X, NewInst);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1400' href='#L_MULDIV_1400'><pre>1400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1401' href='#L_MULDIV_1401'><pre>1401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op1->hasOneUse() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>match(Op1, m_FDiv(m_Value(X), m_Value(Y)))</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1402' href='#L_MULDIV_1402'><pre>1402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Z / (X/Y) => Z*Y / X</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1403' href='#L_MULDIV_1403'><pre>1403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1404' href='#L_MULDIV_1404'><pre>1404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!isa<Constant>(Y) || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<Constant>(Op0)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1405' href='#L_MULDIV_1405'><pre>1405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewInst = Builder->CreateFMul(Op0, Y);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1406' href='#L_MULDIV_1406'><pre>1406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><div class='tooltip'><span class='red'>RI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Instruction>(NewInst)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1407' href='#L_MULDIV_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> FastMathFlags Flags = I.getFastMathFlags();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1408' href='#L_MULDIV_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Flags &= cast<Instruction>(Op1)->getFastMathFlags();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1409' href='#L_MULDIV_1409'><pre>1409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RI->setFastMathFlags(Flags);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1410' href='#L_MULDIV_1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1411' href='#L_MULDIV_1411'><pre>1411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpR = BinaryOperator::CreateFDiv(NewInst, X);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1412' href='#L_MULDIV_1412'><pre>1412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1413' href='#L_MULDIV_1413'><pre>1413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1414' href='#L_MULDIV_1414'><pre>1414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1415' href='#L_MULDIV_1415'><pre>1415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewInst</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1416' href='#L_MULDIV_1416'><pre>1416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Instruction *</span><span class='red'>T</span><span class='red'> = dyn_cast<Instruction>(NewInst))</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1417' href='#L_MULDIV_1417'><pre>1417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>T->setDebugLoc(I.getDebugLoc())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1418' href='#L_MULDIV_1418'><pre>1418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SimpR->setFastMathFlags(I.getFastMathFlags());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1419' href='#L_MULDIV_1419'><pre>1419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SimpR;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1420' href='#L_MULDIV_1420'><pre>1420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1421' href='#L_MULDIV_1421'><pre>1421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1422' href='#L_MULDIV_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1423' href='#L_MULDIV_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> Value *LHS;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1424' href='#L_MULDIV_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> Value *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1425' href='#L_MULDIV_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1426' href='#L_MULDIV_1426'><pre>1426</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> // -x / -y -> x / y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1427' href='#L_MULDIV_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_FNeg(m_Value(LHS))) && <span class='tooltip-content'>15.3k</span></div><div class='tooltip'>match(Op1, m_FNeg(m_Value(RHS)))<span class='tooltip-content'>465</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1428' href='#L_MULDIV_1428'><pre>1428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(0, LHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1429' href='#L_MULDIV_1429'><pre>1429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(1, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1430' href='#L_MULDIV_1430'><pre>1430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &I;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1431' href='#L_MULDIV_1431'><pre>1431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1432' href='#L_MULDIV_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1433' href='#L_MULDIV_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1434' href='#L_MULDIV_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1435' href='#L_MULDIV_1435'><pre>1435</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1436' href='#L_MULDIV_1436'><pre>1436</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function implements the transforms common to both integer remainder</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1437' href='#L_MULDIV_1437'><pre>1437</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// instructions (urem and srem). It is called by the visitors to those integer</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1438' href='#L_MULDIV_1438'><pre>1438</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// remainder instructions.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1439' href='#L_MULDIV_1439'><pre>1439</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// @brief Common integer remainder transforms</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1440' href='#L_MULDIV_1440'><pre>1440</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre>Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1441' href='#L_MULDIV_1441'><pre>1441</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1442' href='#L_MULDIV_1442'><pre>1442</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1443' href='#L_MULDIV_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre> // The RHS is known non-zero.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1444' href='#L_MULDIV_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>7.07k</span></div> = simplifyValueKnownNonZero(I.getOperand(1), *this, I)) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1445' href='#L_MULDIV_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> I.setOperand(1, V);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1446' href='#L_MULDIV_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1447' href='#L_MULDIV_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1448' href='#L_MULDIV_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1449' href='#L_MULDIV_1449'><pre>1449</pre></a></td><td class='covered-line'><pre>7.07k</pre></td><td class='code'><pre> // Handle cases involving: rem X, (select Cond, Y, Z)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1450' href='#L_MULDIV_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.06k</span></div><div class='tooltip'>isa<SelectInst>(Op1) && <span class='tooltip-content'>7.06k</span></div><div class='tooltip'>SimplifyDivRemOfSelect(I)<span class='tooltip-content'>11</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1451' href='#L_MULDIV_1451'><pre>1451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1452' href='#L_MULDIV_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1453' href='#L_MULDIV_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.06k</span></div><div class='tooltip'>isa<Constant>(Op1)<span class='tooltip-content'>7.06k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.18k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1454' href='#L_MULDIV_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>3.18k</pre></td><td class='code'><pre> if (Instruction *<div class='tooltip'>Op0I<span class='tooltip-content'>3.18k</span></div> = dyn_cast<Instruction>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>2.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1455' href='#L_MULDIV_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>2.96k</pre></td><td class='code'><pre> if (SelectInst *<div class='tooltip'>SI<span class='tooltip-content'>2.96k</span></div> = dyn_cast<SelectInst>(Op0I)) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1456' href='#L_MULDIV_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (Instruction *R = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1457' href='#L_MULDIV_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1458' href='#L_MULDIV_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>2.95k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>2.95k</span></div><div class='tooltip'>isa<PHINode>(Op0I)<span class='tooltip-content'>2.95k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>578</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1459' href='#L_MULDIV_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> using namespace llvm::PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1460' href='#L_MULDIV_1460'><pre>1460</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> const APInt *Op1Int;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1461' href='#L_MULDIV_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(Op1Int)) && <span class='tooltip-content'>578</span></div><div class='tooltip'>!Op1Int->isMinValue()<span class='tooltip-content'>578</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1462' href='#L_MULDIV_1462'><pre>1462</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> (I.getOpcode() == Instruction::URem ||</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1463' href='#L_MULDIV_1463'><pre>1463</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> <div class='tooltip'>!Op1Int->isMinSignedValue()<span class='tooltip-content'>470</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>578</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1464' href='#L_MULDIV_1464'><pre>1464</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> // FoldOpIntoPhi will speculate instructions to the end of the PHI's</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1465' href='#L_MULDIV_1465'><pre>1465</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> // predecessor blocks, so do this only if we know the srem or urem</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1466' href='#L_MULDIV_1466'><pre>1466</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> // will not fault.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1467' href='#L_MULDIV_1467'><pre>1467</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> if (Instruction *NV = FoldOpIntoPhi(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1468' href='#L_MULDIV_1468'><pre>1468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return NV</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1469' href='#L_MULDIV_1469'><pre>1469</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1470' href='#L_MULDIV_1470'><pre>1470</pre></a></td><td class='covered-line'><pre>578</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1471' href='#L_MULDIV_1471'><pre>1471</pre></a></td><td class='covered-line'><pre>2.96k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1472' href='#L_MULDIV_1472'><pre>1472</pre></a></td><td class='covered-line'><pre>2.96k</pre></td><td class='code'><pre> // See if we can fold away this rem instruction.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1473' href='#L_MULDIV_1473'><pre>1473</pre></a></td><td class='covered-line'><pre>2.95k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.95k</span></div><div class='tooltip'>SimplifyDemandedInstructionBits(I)<span class='tooltip-content'>2.95k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1474' href='#L_MULDIV_1474'><pre>1474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return &I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1475' href='#L_MULDIV_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>2.95k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1476' href='#L_MULDIV_1476'><pre>1476</pre></a></td><td class='covered-line'><pre>3.18k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1477' href='#L_MULDIV_1477'><pre>1477</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1478' href='#L_MULDIV_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1479' href='#L_MULDIV_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>7.06k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1480' href='#L_MULDIV_1480'><pre>1480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1481' href='#L_MULDIV_1481'><pre>1481</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitURem(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1482' href='#L_MULDIV_1482'><pre>1482</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1483' href='#L_MULDIV_1483'><pre>1483</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1484' href='#L_MULDIV_1484'><pre>1484</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1485' href='#L_MULDIV_1485'><pre>1485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1486' href='#L_MULDIV_1486'><pre>1486</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1487' href='#L_MULDIV_1487'><pre>1487</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>3.80k</span></div><div class='tooltip'>V<span class='tooltip-content'>3.80k</span></div> = SimplifyURemInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1488' href='#L_MULDIV_1488'><pre>1488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1489' href='#L_MULDIV_1489'><pre>1489</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1490' href='#L_MULDIV_1490'><pre>1490</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>3.80k</span></div><div class='tooltip'>common<span class='tooltip-content'>3.80k</span></div> = commonIRemTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1491' href='#L_MULDIV_1491'><pre>1491</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return common;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1492' href='#L_MULDIV_1492'><pre>1492</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1493' href='#L_MULDIV_1493'><pre>1493</pre></a></td><td class='covered-line'><pre>3.80k</pre></td><td class='code'><pre> // (zext A) urem (zext B) --> zext (A urem B)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1494' href='#L_MULDIV_1494'><pre>1494</pre></a></td><td class='covered-line'><pre>3.79k</pre></td><td class='code'><pre> <div class='tooltip'>if (ZExtInst *<span class='tooltip-content'>3.79k</span></div><div class='tooltip'>ZOp0<span class='tooltip-content'>3.79k</span></div> = dyn_cast<ZExtInst>(Op0))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1495' href='#L_MULDIV_1495'><pre>1495</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>11</span></div><div class='tooltip'>ZOp1<span class='tooltip-content'>11</span></div> = dyn_castZExtVal(Op1, ZOp0->getSrcTy()))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1496' href='#L_MULDIV_1496'><pre>1496</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return new ZExtInst(Builder->CreateURem(ZOp0->getOperand(0), ZOp1),</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1497' href='#L_MULDIV_1497'><pre>1497</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1498' href='#L_MULDIV_1498'><pre>1498</pre></a></td><td class='covered-line'><pre>3.79k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1499' href='#L_MULDIV_1499'><pre>1499</pre></a></td><td class='covered-line'><pre>3.79k</pre></td><td class='code'><pre> // X urem Y -> X and Y-1, where Y is a power of 2,</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1500' href='#L_MULDIV_1500'><pre>1500</pre></a></td><td class='covered-line'><pre>3.78k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.78k</span></div><div class='tooltip'>isKnownToBeAPowerOfTwo(Op1, DL, /*OrZero*/ true, 0, &AC, &I, &DT)<span class='tooltip-content'>3.78k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>146</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1501' href='#L_MULDIV_1501'><pre>1501</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> Constant *N1 = Constant::getAllOnesValue(I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1502' href='#L_MULDIV_1502'><pre>1502</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> Value *Add = Builder->CreateAdd(Op1, N1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1503' href='#L_MULDIV_1503'><pre>1503</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(Op0, Add);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1504' href='#L_MULDIV_1504'><pre>1504</pre></a></td><td class='covered-line'><pre>146</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1505' href='#L_MULDIV_1505'><pre>1505</pre></a></td><td class='covered-line'><pre>3.78k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1506' href='#L_MULDIV_1506'><pre>1506</pre></a></td><td class='covered-line'><pre>3.78k</pre></td><td class='code'><pre> // 1 urem X -> zext(X != 1)</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1507' href='#L_MULDIV_1507'><pre>1507</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.64k</span></div><div class='tooltip'>match(Op0, m_One())<span class='tooltip-content'>3.64k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1508' href='#L_MULDIV_1508'><pre>1508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cmp = Builder->CreateICmpNE(Op1, Op0);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1509' href='#L_MULDIV_1509'><pre>1509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Ext = Builder->CreateZExt(Cmp, I.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1510' href='#L_MULDIV_1510'><pre>1510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(I, Ext);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1511' href='#L_MULDIV_1511'><pre>1511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1512' href='#L_MULDIV_1512'><pre>1512</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1513' href='#L_MULDIV_1513'><pre>1513</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre> // X urem C -> X < C ? X : X - C, where C >= signbit.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1514' href='#L_MULDIV_1514'><pre>1514</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre> const APInt *DivisorC;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1515' href='#L_MULDIV_1515'><pre>1515</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(DivisorC)) && <span class='tooltip-content'>3.64k</span></div><div class='tooltip'>DivisorC->isNegative()<span class='tooltip-content'>833</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1516' href='#L_MULDIV_1516'><pre>1516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cmp = Builder->CreateICmpULT(Op0, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1517' href='#L_MULDIV_1517'><pre>1517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Sub = Builder->CreateSub(Op0, Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1518' href='#L_MULDIV_1518'><pre>1518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(Cmp, Op0, Sub);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1519' href='#L_MULDIV_1519'><pre>1519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1520' href='#L_MULDIV_1520'><pre>1520</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1521' href='#L_MULDIV_1521'><pre>1521</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1522' href='#L_MULDIV_1522'><pre>1522</pre></a></td><td class='covered-line'><pre>3.64k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1523' href='#L_MULDIV_1523'><pre>1523</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1524' href='#L_MULDIV_1524'><pre>1524</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSRem(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1525' href='#L_MULDIV_1525'><pre>1525</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1526' href='#L_MULDIV_1526'><pre>1526</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1527' href='#L_MULDIV_1527'><pre>1527</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1528' href='#L_MULDIV_1528'><pre>1528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1529' href='#L_MULDIV_1529'><pre>1529</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1530' href='#L_MULDIV_1530'><pre>1530</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>3.26k</span></div><div class='tooltip'>V<span class='tooltip-content'>3.26k</span></div> = SimplifySRemInst(Op0, Op1, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1531' href='#L_MULDIV_1531'><pre>1531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1532' href='#L_MULDIV_1532'><pre>1532</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1533' href='#L_MULDIV_1533'><pre>1533</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> // Handle the integer rem common cases</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1534' href='#L_MULDIV_1534'><pre>1534</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>3.26k</span></div><div class='tooltip'>Common<span class='tooltip-content'>3.26k</span></div> = commonIRemTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1535' href='#L_MULDIV_1535'><pre>1535</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return Common;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1536' href='#L_MULDIV_1536'><pre>1536</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1537' href='#L_MULDIV_1537'><pre>1537</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1538' href='#L_MULDIV_1538'><pre>1538</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> const APInt *Y;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1539' href='#L_MULDIV_1539'><pre>1539</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> // X % -Y -> X % Y</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1540' href='#L_MULDIV_1540'><pre>1540</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(Y)) && <span class='tooltip-content'>3.26k</span></div><div class='tooltip'>Y->isNegative()<span class='tooltip-content'>2.20k</span></div> && <div class='tooltip'><span class='red'>!Y->isMinSignedValue()</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1541' href='#L_MULDIV_1541'><pre>1541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.AddValue(I.getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1542' href='#L_MULDIV_1542'><pre>1542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(1, ConstantInt::get(I.getType(), -*Y));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1543' href='#L_MULDIV_1543'><pre>1543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &I;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1544' href='#L_MULDIV_1544'><pre>1544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1545' href='#L_MULDIV_1545'><pre>1545</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1546' href='#L_MULDIV_1546'><pre>1546</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1547' href='#L_MULDIV_1547'><pre>1547</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> // If the sign bits of both operands are zero (i.e. we can prove they are</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1548' href='#L_MULDIV_1548'><pre>1548</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> // unsigned inputs), turn this into a urem.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1549' href='#L_MULDIV_1549'><pre>1549</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.26k</span></div><div class='tooltip'>I.getType()->isIntegerTy()<span class='tooltip-content'>3.26k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.26k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1550' href='#L_MULDIV_1550'><pre>1550</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1551' href='#L_MULDIV_1551'><pre>1551</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> if (MaskedValueIsZero(Op1, Mask, 0, &I) &&</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1552' href='#L_MULDIV_1552'><pre>1552</pre></a></td><td class='covered-line'><pre>2.20k</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0, Mask, 0, &I)<span class='tooltip-content'>2.20k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>25</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1553' href='#L_MULDIV_1553'><pre>1553</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> // X srem Y -> X urem Y, iff X and Y don't have sign bit set</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1554' href='#L_MULDIV_1554'><pre>1554</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return BinaryOperator::CreateURem(Op0, Op1, I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1555' href='#L_MULDIV_1555'><pre>1555</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1556' href='#L_MULDIV_1556'><pre>1556</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1557' href='#L_MULDIV_1557'><pre>1557</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1558' href='#L_MULDIV_1558'><pre>1558</pre></a></td><td class='covered-line'><pre>3.26k</pre></td><td class='code'><pre> // If it's a constant vector, flip any negative values positive.</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1559' href='#L_MULDIV_1559'><pre>1559</pre></a></td><td class='covered-line'><pre>3.23k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.23k</span></div><div class='tooltip'>isa<ConstantVector>(Op1) || <span class='tooltip-content'>3.23k</span></div><div class='tooltip'>isa<ConstantDataVector>(Op1)<span class='tooltip-content'>3.23k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1560' href='#L_MULDIV_1560'><pre>1560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *C = cast<Constant>(Op1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1561' href='#L_MULDIV_1561'><pre>1561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidth = C->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1562' href='#L_MULDIV_1562'><pre>1562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1563' href='#L_MULDIV_1563'><pre>1563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool hasNegative = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1564' href='#L_MULDIV_1564'><pre>1564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool hasMissing = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1565' href='#L_MULDIV_1565'><pre>1565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1566' href='#L_MULDIV_1566'><pre>1566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = C->getAggregateElement(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1567' href='#L_MULDIV_1567'><pre>1567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!Elt</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1568' href='#L_MULDIV_1568'><pre>1568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> hasMissing = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1569' href='#L_MULDIV_1569'><pre>1569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1570' href='#L_MULDIV_1570'><pre>1570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1571' href='#L_MULDIV_1571'><pre>1571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1572' href='#L_MULDIV_1572'><pre>1572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (ConstantInt *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHS</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(Elt))</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1573' href='#L_MULDIV_1573'><pre>1573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>RHS->isNegative()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1574' href='#L_MULDIV_1574'><pre>1574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>hasNegative = true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1575' href='#L_MULDIV_1575'><pre>1575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1576' href='#L_MULDIV_1576'><pre>1576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1577' href='#L_MULDIV_1577'><pre>1577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>hasNegative && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!hasMissing</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1578' href='#L_MULDIV_1578'><pre>1578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> Elts(VWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1579' href='#L_MULDIV_1579'><pre>1579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1580' href='#L_MULDIV_1580'><pre>1580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Elts[i] = C->getAggregateElement(i); // Handle undef, etc.</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1581' href='#L_MULDIV_1581'><pre>1581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (ConstantInt *</span><div class='tooltip'><span class='red'>RHS</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<ConstantInt>(Elts[i])) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1582' href='#L_MULDIV_1582'><pre>1582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>RHS->isNegative()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1583' href='#L_MULDIV_1583'><pre>1583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Elts[i] = cast<ConstantInt>(ConstantExpr::getNeg(RHS))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1584' href='#L_MULDIV_1584'><pre>1584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1585' href='#L_MULDIV_1585'><pre>1585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1586' href='#L_MULDIV_1586'><pre>1586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1587' href='#L_MULDIV_1587'><pre>1587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *NewRHSV = ConstantVector::get(Elts);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1588' href='#L_MULDIV_1588'><pre>1588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewRHSV != C</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ // Don't loop on -MININT</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1589' href='#L_MULDIV_1589'><pre>1589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.AddValue(I.getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1590' href='#L_MULDIV_1590'><pre>1590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I.setOperand(1, NewRHSV);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1591' href='#L_MULDIV_1591'><pre>1591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &I;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1592' href='#L_MULDIV_1592'><pre>1592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1593' href='#L_MULDIV_1593'><pre>1593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1594' href='#L_MULDIV_1594'><pre>1594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1595' href='#L_MULDIV_1595'><pre>1595</pre></a></td><td class='covered-line'><pre>3.23k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1596' href='#L_MULDIV_1596'><pre>1596</pre></a></td><td class='covered-line'><pre>3.23k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1597' href='#L_MULDIV_1597'><pre>1597</pre></a></td><td class='covered-line'><pre>3.23k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1598' href='#L_MULDIV_1598'><pre>1598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1599' href='#L_MULDIV_1599'><pre>1599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>Instruction *InstCombiner::visitFRem(BinaryOperator &I) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1600' href='#L_MULDIV_1600'><pre>1600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1601' href='#L_MULDIV_1601'><pre>1601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1602' href='#L_MULDIV_1602'><pre>1602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><span class='red'>V</span><span class='red'> = SimplifyVectorOp(I))</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1603' href='#L_MULDIV_1603'><pre>1603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1604' href='#L_MULDIV_1604'><pre>1604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1605' href='#L_MULDIV_1605'><pre>1605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Value *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div><span class='red'> = SimplifyFRemInst(Op0, Op1, I.getFastMathFlags(),</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1606' href='#L_MULDIV_1606'><pre>1606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DL, &TLI, &DT, &AC))</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1607' href='#L_MULDIV_1607'><pre>1607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(I, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1608' href='#L_MULDIV_1608'><pre>1608</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1609' href='#L_MULDIV_1609'><pre>1609</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle cases involving: rem X, (select Cond, Y, Z)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1610' href='#L_MULDIV_1610'><pre>1610</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<SelectInst>(Op1) && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SimplifyDivRemOfSelect(I)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1611' href='#L_MULDIV_1611'><pre>1611</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return &I</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1612' href='#L_MULDIV_1612'><pre>1612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1613' href='#L_MULDIV_1613'><pre>1613</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_MULDIV_1614' href='#L_MULDIV_1614'><pre>1614</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='PHI' href='#PHI'>lib/Transforms/InstCombine/InstCombinePHI.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_PHI_117'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1' href='#L_PHI_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombinePHI.cpp -------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_2' href='#L_PHI_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_3' href='#L_PHI_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_PHI_4' href='#L_PHI_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_5' href='#L_PHI_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_PHI_6' href='#L_PHI_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_7' href='#L_PHI_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_8' href='#L_PHI_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_9' href='#L_PHI_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_10' href='#L_PHI_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitPHINode function.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_11' href='#L_PHI_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_12' href='#L_PHI_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_13' href='#L_PHI_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_14' href='#L_PHI_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_15' href='#L_PHI_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/STLExtras.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_16' href='#L_PHI_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/SmallPtrSet.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_17' href='#L_PHI_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_18' href='#L_PHI_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ValueTracking.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_19' href='#L_PHI_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_20' href='#L_PHI_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Transforms/Utils/Local.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_21' href='#L_PHI_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/DebugInfo.h"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_22' href='#L_PHI_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_23' href='#L_PHI_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm::PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_24' href='#L_PHI_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_25' href='#L_PHI_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_PHI_26' href='#L_PHI_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_27' href='#L_PHI_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The PHI arguments will be folded into a single operation with a PHI node</pre></td></tr><tr><td class='line-number'><a name='L_PHI_28' href='#L_PHI_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// as input. The debug location of the single operation will be the merged</pre></td></tr><tr><td class='line-number'><a name='L_PHI_29' href='#L_PHI_29'><pre>29</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// locations of the original PHI node arguments.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_30' href='#L_PHI_30'><pre>30</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre>DebugLoc InstCombiner::PHIArgMergedDebugLoc(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_31' href='#L_PHI_31'><pre>31</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre> auto *FirstInst = cast<Instruction>(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_32' href='#L_PHI_32'><pre>32</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre> const DILocation *Loc = FirstInst->getDebugLoc();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_33' href='#L_PHI_33'><pre>33</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_34' href='#L_PHI_34'><pre>34</pre></a></td><td class='covered-line'><pre>8.71k</pre></td><td class='code'><pre> for (unsigned i = 1; <div class='tooltip'>i != PN.getNumIncomingValues()<span class='tooltip-content'>8.71k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>4.44k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.44k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_35' href='#L_PHI_35'><pre>35</pre></a></td><td class='covered-line'><pre>4.44k</pre></td><td class='code'><pre> auto *I = cast<Instruction>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_36' href='#L_PHI_36'><pre>36</pre></a></td><td class='covered-line'><pre>4.44k</pre></td><td class='code'><pre> Loc = DILocation::getMergedLocation(Loc, I->getDebugLoc());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_37' href='#L_PHI_37'><pre>37</pre></a></td><td class='covered-line'><pre>4.44k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_38' href='#L_PHI_38'><pre>38</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_39' href='#L_PHI_39'><pre>39</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre> return Loc;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_40' href='#L_PHI_40'><pre>40</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_41' href='#L_PHI_41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_42' href='#L_PHI_42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If we have something like phi [add (a,b), add(a,c)] and if a/b/c and the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_43' href='#L_PHI_43'><pre>43</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// adds all have a single use, turn this into a phi and a single binop.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_44' href='#L_PHI_44'><pre>44</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_45' href='#L_PHI_45'><pre>45</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_46' href='#L_PHI_46'><pre>46</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> assert(isa<BinaryOperator>(FirstInst) || isa<CmpInst>(FirstInst));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_47' href='#L_PHI_47'><pre>47</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> unsigned Opc = FirstInst->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_48' href='#L_PHI_48'><pre>48</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> Value *LHSVal = FirstInst->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_49' href='#L_PHI_49'><pre>49</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> Value *RHSVal = FirstInst->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_50' href='#L_PHI_50'><pre>50</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_51' href='#L_PHI_51'><pre>51</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> Type *LHSType = LHSVal->getType();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_52' href='#L_PHI_52'><pre>52</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> Type *RHSType = RHSVal->getType();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_53' href='#L_PHI_53'><pre>53</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_54' href='#L_PHI_54'><pre>54</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> // Scan to see if all operands are the same opcode, and all have one use.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_55' href='#L_PHI_55'><pre>55</pre></a></td><td class='covered-line'><pre>6.17k</pre></td><td class='code'><pre> for (unsigned i = 1; <div class='tooltip'>i != PN.getNumIncomingValues()<span class='tooltip-content'>6.17k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>2.47k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.35k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_56' href='#L_PHI_56'><pre>56</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_57' href='#L_PHI_57'><pre>57</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I || <span class='tooltip-content'>4.35k</span></div><div class='tooltip'>I->getOpcode() != Opc<span class='tooltip-content'>4.15k</span></div> || <div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>3.89k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_58' href='#L_PHI_58'><pre>58</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre> // Verify type of the LHS matches so we don't fold cmp's of different</pre></td></tr><tr><td class='line-number'><a name='L_PHI_59' href='#L_PHI_59'><pre>59</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre> // types.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_60' href='#L_PHI_60'><pre>60</pre></a></td><td class='covered-line'><pre>2.53k</pre></td><td class='code'><pre> I->getOperand(0)->getType() != LHSType ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_61' href='#L_PHI_61'><pre>61</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> I->getOperand(1)->getType() != RHSType)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_62' href='#L_PHI_62'><pre>62</pre></a></td><td class='covered-line'><pre>1.82k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_63' href='#L_PHI_63'><pre>63</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_64' href='#L_PHI_64'><pre>64</pre></a></td><td class='covered-line'><pre>4.35k</pre></td><td class='code'><pre> // If they are CmpInst instructions, check their predicates</pre></td></tr><tr><td class='line-number'><a name='L_PHI_65' href='#L_PHI_65'><pre>65</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> <div class='tooltip'>if (CmpInst *<span class='tooltip-content'>2.52k</span></div><div class='tooltip'>CI<span class='tooltip-content'>2.52k</span></div> = dyn_cast<CmpInst>(I))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_66' href='#L_PHI_66'><pre>66</pre></a></td><td class='covered-line'><pre>89</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>89</span></div><div class='tooltip'>CI->getPredicate() != cast<CmpInst>(FirstInst)->getPredicate()<span class='tooltip-content'>89</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_67' href='#L_PHI_67'><pre>67</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_68' href='#L_PHI_68'><pre>68</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_69' href='#L_PHI_69'><pre>69</pre></a></td><td class='covered-line'><pre>2.52k</pre></td><td class='code'><pre> // Keep track of which operand needs a phi node.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_70' href='#L_PHI_70'><pre>70</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.47k</span></div><div class='tooltip'>I->getOperand(0) != LHSVal<span class='tooltip-content'>2.47k</span></div>) <div class='tooltip'>LHSVal = nullptr<span class='tooltip-content'>2.27k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_71' href='#L_PHI_71'><pre>71</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> if (<div class='tooltip'>I->getOperand(1) != RHSVal<span class='tooltip-content'>2.47k</span></div>) <div class='tooltip'>RHSVal = nullptr<span class='tooltip-content'>2.29k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_72' href='#L_PHI_72'><pre>72</pre></a></td><td class='covered-line'><pre>2.47k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_73' href='#L_PHI_73'><pre>73</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_74' href='#L_PHI_74'><pre>74</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> // If both LHS and RHS would need a PHI, don't do this transformation,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_75' href='#L_PHI_75'><pre>75</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> // because it would increase the number of PHIs entering the block,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_76' href='#L_PHI_76'><pre>76</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> // which leads to higher register pressure. This is especially</pre></td></tr><tr><td class='line-number'><a name='L_PHI_77' href='#L_PHI_77'><pre>77</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> // bad when the PHIs are in the header of a loop.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_78' href='#L_PHI_78'><pre>78</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.81k</span></div><div class='tooltip'>!LHSVal && <span class='tooltip-content'>1.81k</span></div><div class='tooltip'>!RHSVal<span class='tooltip-content'>1.74k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_79' href='#L_PHI_79'><pre>79</pre></a></td><td class='covered-line'><pre>1.71k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_80' href='#L_PHI_80'><pre>80</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_81' href='#L_PHI_81'><pre>81</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> // Otherwise, this is safe to transform!</pre></td></tr><tr><td class='line-number'><a name='L_PHI_82' href='#L_PHI_82'><pre>82</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_83' href='#L_PHI_83'><pre>83</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> Value *InLHS = FirstInst->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_84' href='#L_PHI_84'><pre>84</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> Value *InRHS = FirstInst->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_85' href='#L_PHI_85'><pre>85</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> PHINode *NewLHS = nullptr, *NewRHS = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_86' href='#L_PHI_86'><pre>86</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHSVal<span class='tooltip-content'>97</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_87' href='#L_PHI_87'><pre>87</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> NewLHS = PHINode::Create(LHSType, PN.getNumIncomingValues(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_88' href='#L_PHI_88'><pre>88</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> FirstInst->getOperand(0)->getName() + ".pn");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_89' href='#L_PHI_89'><pre>89</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_90' href='#L_PHI_90'><pre>90</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> InsertNewInstBefore(NewLHS, PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_91' href='#L_PHI_91'><pre>91</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> LHSVal = NewLHS;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_92' href='#L_PHI_92'><pre>92</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_93' href='#L_PHI_93'><pre>93</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_94' href='#L_PHI_94'><pre>94</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> if (<div class='tooltip'>!RHSVal<span class='tooltip-content'>97</span></div>) <div class='tooltip'>{<span class='tooltip-content'>67</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_95' href='#L_PHI_95'><pre>95</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> NewRHS = PHINode::Create(RHSType, PN.getNumIncomingValues(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_96' href='#L_PHI_96'><pre>96</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> FirstInst->getOperand(1)->getName() + ".pn");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_97' href='#L_PHI_97'><pre>97</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_98' href='#L_PHI_98'><pre>98</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> InsertNewInstBefore(NewRHS, PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_99' href='#L_PHI_99'><pre>99</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> RHSVal = NewRHS;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_100' href='#L_PHI_100'><pre>100</pre></a></td><td class='covered-line'><pre>67</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_101' href='#L_PHI_101'><pre>101</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_102' href='#L_PHI_102'><pre>102</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> // Add all operands to the new PHIs.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_103' href='#L_PHI_103'><pre>103</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> if (<div class='tooltip'>NewLHS || <span class='tooltip-content'>97</span></div><div class='tooltip'>NewRHS<span class='tooltip-content'>69</span></div>) <div class='tooltip'>{<span class='tooltip-content'>95</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_104' href='#L_PHI_104'><pre>104</pre></a></td><td class='covered-line'><pre>221</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>221</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>126</span></div>) <div class='tooltip'>{<span class='tooltip-content'>126</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_105' href='#L_PHI_105'><pre>105</pre></a></td><td class='covered-line'><pre>126</pre></td><td class='code'><pre> Instruction *InInst = cast<Instruction>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_106' href='#L_PHI_106'><pre>106</pre></a></td><td class='covered-line'><pre>126</pre></td><td class='code'><pre> if (<div class='tooltip'>NewLHS<span class='tooltip-content'>126</span></div>) <div class='tooltip'>{<span class='tooltip-content'>38</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_107' href='#L_PHI_107'><pre>107</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> Value *NewInLHS = InInst->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_108' href='#L_PHI_108'><pre>108</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> NewLHS->addIncoming(NewInLHS, PN.getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_109' href='#L_PHI_109'><pre>109</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_110' href='#L_PHI_110'><pre>110</pre></a></td><td class='covered-line'><pre>126</pre></td><td class='code'><pre> if (<div class='tooltip'>NewRHS<span class='tooltip-content'>126</span></div>) <div class='tooltip'>{<span class='tooltip-content'>88</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_111' href='#L_PHI_111'><pre>111</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> Value *NewInRHS = InInst->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_112' href='#L_PHI_112'><pre>112</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> NewRHS->addIncoming(NewInRHS, PN.getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_113' href='#L_PHI_113'><pre>113</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_114' href='#L_PHI_114'><pre>114</pre></a></td><td class='covered-line'><pre>126</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_115' href='#L_PHI_115'><pre>115</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_116' href='#L_PHI_116'><pre>116</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_117' href='#L_PHI_117'><pre>117</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> if (CmpInst *<div class='tooltip'>CIOp<span class='tooltip-content'>97</span></div> = dyn_cast<CmpInst>(FirstInst)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_118' href='#L_PHI_118'><pre>118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpInst *NewCI = CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(),</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_119' href='#L_PHI_119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LHSVal, RHSVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_120' href='#L_PHI_120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCI->setDebugLoc(PHIArgMergedDebugLoc(PN));</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_121' href='#L_PHI_121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewCI;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_122' href='#L_PHI_122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_123' href='#L_PHI_123'><pre>123</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_124' href='#L_PHI_124'><pre>124</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> BinaryOperator *BinOp = cast<BinaryOperator>(FirstInst);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_125' href='#L_PHI_125'><pre>125</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> BinaryOperator *NewBinOp =</pre></td></tr><tr><td class='line-number'><a name='L_PHI_126' href='#L_PHI_126'><pre>126</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> BinaryOperator::Create(BinOp->getOpcode(), LHSVal, RHSVal);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_127' href='#L_PHI_127'><pre>127</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_128' href='#L_PHI_128'><pre>128</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> NewBinOp->copyIRFlags(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_129' href='#L_PHI_129'><pre>129</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_130' href='#L_PHI_130'><pre>130</pre></a></td><td class='covered-line'><pre>225</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>225</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>128</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_131' href='#L_PHI_131'><pre>131</pre></a></td><td class='covered-line'><pre>128</pre></td><td class='code'><pre> NewBinOp->andIRFlags(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_132' href='#L_PHI_132'><pre>132</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_133' href='#L_PHI_133'><pre>133</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> NewBinOp->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_134' href='#L_PHI_134'><pre>134</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> return NewBinOp;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_135' href='#L_PHI_135'><pre>135</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_136' href='#L_PHI_136'><pre>136</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_137' href='#L_PHI_137'><pre>137</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldPHIArgGEPIntoPHI(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_138' href='#L_PHI_138'><pre>138</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> GetElementPtrInst *FirstInst =cast<GetElementPtrInst>(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_139' href='#L_PHI_139'><pre>139</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_140' href='#L_PHI_140'><pre>140</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> SmallVector<Value*, 16> FixedOperands(FirstInst->op_begin(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_141' href='#L_PHI_141'><pre>141</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> FirstInst->op_end());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_142' href='#L_PHI_142'><pre>142</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // This is true if all GEP bases are allocas and if all indices into them are</pre></td></tr><tr><td class='line-number'><a name='L_PHI_143' href='#L_PHI_143'><pre>143</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // constants.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_144' href='#L_PHI_144'><pre>144</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> bool AllBasePointersAreAllocas = true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_145' href='#L_PHI_145'><pre>145</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_146' href='#L_PHI_146'><pre>146</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // We don't want to replace this phi if the replacement would require</pre></td></tr><tr><td class='line-number'><a name='L_PHI_147' href='#L_PHI_147'><pre>147</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // more than one phi, which leads to higher register pressure. This is</pre></td></tr><tr><td class='line-number'><a name='L_PHI_148' href='#L_PHI_148'><pre>148</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // especially bad when the PHIs are in the header of a loop.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_149' href='#L_PHI_149'><pre>149</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> bool NeededPhi = false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_150' href='#L_PHI_150'><pre>150</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_151' href='#L_PHI_151'><pre>151</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> bool AllInBounds = true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_152' href='#L_PHI_152'><pre>152</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_153' href='#L_PHI_153'><pre>153</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // Scan to see if all operands are the same opcode, and all have one use.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_154' href='#L_PHI_154'><pre>154</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> for (unsigned i = 1; <div class='tooltip'>i != PN.getNumIncomingValues()<span class='tooltip-content'>28.3k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>1.93k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>27.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_155' href='#L_PHI_155'><pre>155</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> GetElementPtrInst *GEP= dyn_cast<GetElementPtrInst>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_156' href='#L_PHI_156'><pre>156</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>!GEP || <span class='tooltip-content'>27.2k</span></div><div class='tooltip'>!GEP->hasOneUse()<span class='tooltip-content'>26.9k</span></div> || <div class='tooltip'>GEP->getType() != FirstInst->getType()<span class='tooltip-content'>16.0k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_157' href='#L_PHI_157'><pre>157</pre></a></td><td class='covered-line'><pre>16.0k</pre></td><td class='code'><pre> GEP->getNumOperands() != FirstInst->getNumOperands())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_158' href='#L_PHI_158'><pre>158</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_159' href='#L_PHI_159'><pre>159</pre></a></td><td class='covered-line'><pre>27.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_160' href='#L_PHI_160'><pre>160</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre> AllInBounds &= GEP->isInBounds();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_161' href='#L_PHI_161'><pre>161</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_162' href='#L_PHI_162'><pre>162</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre> // Keep track of whether or not all GEPs are of alloca pointers.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_163' href='#L_PHI_163'><pre>163</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre> if (AllBasePointersAreAllocas &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_164' href='#L_PHI_164'><pre>164</pre></a></td><td class='covered-line'><pre>8.34k</pre></td><td class='code'><pre> (!isa<AllocaInst>(GEP->getOperand(0)) ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_165' href='#L_PHI_165'><pre>165</pre></a></td><td class='covered-line'><pre>81</pre></td><td class='code'><pre> !GEP->hasAllConstantIndices()))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_166' href='#L_PHI_166'><pre>166</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> AllBasePointersAreAllocas = false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_167' href='#L_PHI_167'><pre>167</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_168' href='#L_PHI_168'><pre>168</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre> // Compare the operand lists.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_169' href='#L_PHI_169'><pre>169</pre></a></td><td class='covered-line'><pre>19.4k</pre></td><td class='code'><pre> for (unsigned op = 0, e = FirstInst->getNumOperands(); <div class='tooltip'>op != e<span class='tooltip-content'>19.4k</span></div>; <div class='tooltip'>++op<span class='tooltip-content'>10.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_170' href='#L_PHI_170'><pre>170</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> if (FirstInst->getOperand(op) == GEP->getOperand(op))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_171' href='#L_PHI_171'><pre>171</pre></a></td><td class='covered-line'><pre>6.52k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_172' href='#L_PHI_172'><pre>172</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_173' href='#L_PHI_173'><pre>173</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // Don't merge two GEPs when two operands differ (introducing phi nodes)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_174' href='#L_PHI_174'><pre>174</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // if one of the PHIs has a constant for the index. The index may be</pre></td></tr><tr><td class='line-number'><a name='L_PHI_175' href='#L_PHI_175'><pre>175</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // substantially cheaper to compute for the constants, so making it a</pre></td></tr><tr><td class='line-number'><a name='L_PHI_176' href='#L_PHI_176'><pre>176</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // variable index could pessimize the path. This also handles the case</pre></td></tr><tr><td class='line-number'><a name='L_PHI_177' href='#L_PHI_177'><pre>177</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // for struct indices, which must always be constant.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_178' href='#L_PHI_178'><pre>178</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>10.9k</span></div><div class='tooltip'>isa<ConstantInt>(FirstInst->getOperand(op)) ||<span class='tooltip-content'>10.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_179' href='#L_PHI_179'><pre>179</pre></a></td><td class='covered-line'><pre>8.81k</pre></td><td class='code'><pre> isa<ConstantInt>(GEP->getOperand(op)))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_180' href='#L_PHI_180'><pre>180</pre></a></td><td class='covered-line'><pre>3.23k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_181' href='#L_PHI_181'><pre>181</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_182' href='#L_PHI_182'><pre>182</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.75k</span></div><div class='tooltip'>FirstInst->getOperand(op)->getType() !=GEP->getOperand(op)->getType()<span class='tooltip-content'>7.75k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_183' href='#L_PHI_183'><pre>183</pre></a></td><td class='covered-line'><pre>3.01k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_184' href='#L_PHI_184'><pre>184</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_185' href='#L_PHI_185'><pre>185</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre> // If we already needed a PHI for an earlier operand, and another operand</pre></td></tr><tr><td class='line-number'><a name='L_PHI_186' href='#L_PHI_186'><pre>186</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre> // also requires a PHI, we'd be introducing more PHIs than we're</pre></td></tr><tr><td class='line-number'><a name='L_PHI_187' href='#L_PHI_187'><pre>187</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre> // eliminating, which increases register pressure on entry to the PHI's</pre></td></tr><tr><td class='line-number'><a name='L_PHI_188' href='#L_PHI_188'><pre>188</pre></a></td><td class='covered-line'><pre>7.75k</pre></td><td class='code'><pre> // block.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_189' href='#L_PHI_189'><pre>189</pre></a></td><td class='covered-line'><pre>4.73k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.73k</span></div><div class='tooltip'>NeededPhi<span class='tooltip-content'>4.73k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_190' href='#L_PHI_190'><pre>190</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_191' href='#L_PHI_191'><pre>191</pre></a></td><td class='covered-line'><pre>4.73k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_192' href='#L_PHI_192'><pre>192</pre></a></td><td class='covered-line'><pre>4.11k</pre></td><td class='code'><pre> FixedOperands[op] = nullptr; // Needs a PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_193' href='#L_PHI_193'><pre>193</pre></a></td><td class='covered-line'><pre>4.11k</pre></td><td class='code'><pre> NeededPhi = true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_194' href='#L_PHI_194'><pre>194</pre></a></td><td class='covered-line'><pre>4.11k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_195' href='#L_PHI_195'><pre>195</pre></a></td><td class='covered-line'><pre>8.80k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_196' href='#L_PHI_196'><pre>196</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_197' href='#L_PHI_197'><pre>197</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // If all of the base pointers of the PHI'd GEPs are from allocas, don't</pre></td></tr><tr><td class='line-number'><a name='L_PHI_198' href='#L_PHI_198'><pre>198</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // bother doing this transformation. At best, this will just save a bit of</pre></td></tr><tr><td class='line-number'><a name='L_PHI_199' href='#L_PHI_199'><pre>199</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // offset calculation, but all the predecessors will have to materialize the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_200' href='#L_PHI_200'><pre>200</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // stack address into a register anyway. We'd actually rather *clone* the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_201' href='#L_PHI_201'><pre>201</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // load up into the predecessors so that we have a load of a gep of an alloca,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_202' href='#L_PHI_202'><pre>202</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // which can usually all be folded into the load.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_203' href='#L_PHI_203'><pre>203</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.03k</span></div><div class='tooltip'>AllBasePointersAreAllocas<span class='tooltip-content'>1.03k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_204' href='#L_PHI_204'><pre>204</pre></a></td><td class='covered-line'><pre>26</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_205' href='#L_PHI_205'><pre>205</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_206' href='#L_PHI_206'><pre>206</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> // Otherwise, this is safe to transform. Insert PHI nodes for each operand</pre></td></tr><tr><td class='line-number'><a name='L_PHI_207' href='#L_PHI_207'><pre>207</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> // that is variable.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_208' href='#L_PHI_208'><pre>208</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> SmallVector<PHINode*, 16> OperandPhis(FixedOperands.size());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_209' href='#L_PHI_209'><pre>209</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_210' href='#L_PHI_210'><pre>210</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> bool HasAnyPHIs = false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_211' href='#L_PHI_211'><pre>211</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre> for (unsigned i = 0, e = FixedOperands.size(); <div class='tooltip'>i != e<span class='tooltip-content'>4.87k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>3.86k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.86k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_212' href='#L_PHI_212'><pre>212</pre></a></td><td class='covered-line'><pre>3.86k</pre></td><td class='code'><pre> if (<div class='tooltip'>FixedOperands[i]<span class='tooltip-content'>3.86k</span></div>) <div class='tooltip'>continue<span class='tooltip-content'>2.90k</span></div>; // operand doesn't need a phi.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_213' href='#L_PHI_213'><pre>213</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> Value *FirstOp = FirstInst->getOperand(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_214' href='#L_PHI_214'><pre>214</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> PHINode *NewPN = PHINode::Create(FirstOp->getType(), e,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_215' href='#L_PHI_215'><pre>215</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> FirstOp->getName()+".pn");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_216' href='#L_PHI_216'><pre>216</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> InsertNewInstBefore(NewPN, PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_217' href='#L_PHI_217'><pre>217</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_218' href='#L_PHI_218'><pre>218</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> NewPN->addIncoming(FirstOp, PN.getIncomingBlock(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_219' href='#L_PHI_219'><pre>219</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> OperandPhis[i] = NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_220' href='#L_PHI_220'><pre>220</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> FixedOperands[i] = NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_221' href='#L_PHI_221'><pre>221</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> HasAnyPHIs = true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_222' href='#L_PHI_222'><pre>222</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_223' href='#L_PHI_223'><pre>223</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_224' href='#L_PHI_224'><pre>224</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_225' href='#L_PHI_225'><pre>225</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> // Add all operands to the new PHIs.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_226' href='#L_PHI_226'><pre>226</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> if (<div class='tooltip'>HasAnyPHIs<span class='tooltip-content'>1.01k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>961</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_227' href='#L_PHI_227'><pre>227</pre></a></td><td class='covered-line'><pre>1.92k</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>1.92k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>961</span></div>) <div class='tooltip'>{<span class='tooltip-content'>961</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_228' href='#L_PHI_228'><pre>228</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> GetElementPtrInst *InGEP =cast<GetElementPtrInst>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_229' href='#L_PHI_229'><pre>229</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> BasicBlock *InBB = PN.getIncomingBlock(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_230' href='#L_PHI_230'><pre>230</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_231' href='#L_PHI_231'><pre>231</pre></a></td><td class='covered-line'><pre>4.65k</pre></td><td class='code'><pre> for (unsigned op = 0, e = OperandPhis.size(); <div class='tooltip'>op != e<span class='tooltip-content'>4.65k</span></div>; <div class='tooltip'>++op<span class='tooltip-content'>3.69k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_232' href='#L_PHI_232'><pre>232</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> <div class='tooltip'>if (PHINode *<span class='tooltip-content'>3.69k</span></div><div class='tooltip'>OpPhi<span class='tooltip-content'>3.69k</span></div> = OperandPhis[op])</pre></td></tr><tr><td class='line-number'><a name='L_PHI_233' href='#L_PHI_233'><pre>233</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> OpPhi->addIncoming(InGEP->getOperand(op), InBB);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_234' href='#L_PHI_234'><pre>234</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_235' href='#L_PHI_235'><pre>235</pre></a></td><td class='covered-line'><pre>961</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_236' href='#L_PHI_236'><pre>236</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_237' href='#L_PHI_237'><pre>237</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> Value *Base = FixedOperands[0];</pre></td></tr><tr><td class='line-number'><a name='L_PHI_238' href='#L_PHI_238'><pre>238</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> GetElementPtrInst *NewGEP =</pre></td></tr><tr><td class='line-number'><a name='L_PHI_239' href='#L_PHI_239'><pre>239</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> GetElementPtrInst::Create(FirstInst->getSourceElementType(), Base,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_240' href='#L_PHI_240'><pre>240</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> makeArrayRef(FixedOperands).slice(1));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_241' href='#L_PHI_241'><pre>241</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> if (<div class='tooltip'>AllInBounds<span class='tooltip-content'>1.01k</span></div>) <div class='tooltip'>NewGEP->setIsInBounds()<span class='tooltip-content'>1.01k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_242' href='#L_PHI_242'><pre>242</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> NewGEP->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_243' href='#L_PHI_243'><pre>243</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> return NewGEP;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_244' href='#L_PHI_244'><pre>244</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_245' href='#L_PHI_245'><pre>245</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_246' href='#L_PHI_246'><pre>246</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_247' href='#L_PHI_247'><pre>247</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we know that it is safe to sink the load out of the block</pre></td></tr><tr><td class='line-number'><a name='L_PHI_248' href='#L_PHI_248'><pre>248</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that defines it. This means that it must be obvious the value of the load is</pre></td></tr><tr><td class='line-number'><a name='L_PHI_249' href='#L_PHI_249'><pre>249</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// not changed from the point of the load to the end of the block it is in.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_250' href='#L_PHI_250'><pre>250</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_PHI_251' href='#L_PHI_251'><pre>251</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Finally, it is safe, but not profitable, to sink a load targeting a</pre></td></tr><tr><td class='line-number'><a name='L_PHI_252' href='#L_PHI_252'><pre>252</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// non-address-taken alloca. Doing so will cause us to not promote the alloca</pre></td></tr><tr><td class='line-number'><a name='L_PHI_253' href='#L_PHI_253'><pre>253</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to a register.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_254' href='#L_PHI_254'><pre>254</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre>static bool isSafeAndProfitableToSinkLoad(LoadInst *L) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_255' href='#L_PHI_255'><pre>255</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre> BasicBlock::iterator BBI = L->getIterator(), E = L->getParent()->end();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_256' href='#L_PHI_256'><pre>256</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_257' href='#L_PHI_257'><pre>257</pre></a></td><td class='covered-line'><pre>57.0k</pre></td><td class='code'><pre> for (++BBI; <div class='tooltip'>BBI != E<span class='tooltip-content'>57.0k</span></div>; <div class='tooltip'>++BBI<span class='tooltip-content'>32.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_258' href='#L_PHI_258'><pre>258</pre></a></td><td class='covered-line'><pre>32.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>32.9k</span></div><div class='tooltip'>BBI->mayWriteToMemory()<span class='tooltip-content'>32.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_259' href='#L_PHI_259'><pre>259</pre></a></td><td class='covered-line'><pre>564</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_260' href='#L_PHI_260'><pre>260</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_261' href='#L_PHI_261'><pre>261</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre> // Check for non-address taken alloca. If not address-taken already, it isn't</pre></td></tr><tr><td class='line-number'><a name='L_PHI_262' href='#L_PHI_262'><pre>262</pre></a></td><td class='covered-line'><pre>24.6k</pre></td><td class='code'><pre> // profitable to do this xform.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_263' href='#L_PHI_263'><pre>263</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (AllocaInst *<span class='tooltip-content'>24.0k</span></div><div class='tooltip'>AI<span class='tooltip-content'>24.0k</span></div> = dyn_cast<AllocaInst>(L->getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>469</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_264' href='#L_PHI_264'><pre>264</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre> bool isAddressTaken = false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_265' href='#L_PHI_265'><pre>265</pre></a></td><td class='covered-line'><pre>2.58k</pre></td><td class='code'><pre> for (User *U : AI->users()) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_266' href='#L_PHI_266'><pre>266</pre></a></td><td class='covered-line'><pre>2.58k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<LoadInst>(U)<span class='tooltip-content'>2.58k</span></div>) <div class='tooltip'>continue<span class='tooltip-content'>1.78k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_267' href='#L_PHI_267'><pre>267</pre></a></td><td class='covered-line'><pre>800</pre></td><td class='code'><pre> <div class='tooltip'>if (StoreInst *<span class='tooltip-content'>800</span></div><div class='tooltip'>SI<span class='tooltip-content'>800</span></div> = dyn_cast<StoreInst>(U)) <div class='tooltip'>{<span class='tooltip-content'>331</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_268' href='#L_PHI_268'><pre>268</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> // If storing TO the alloca, then the address isn't taken.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_269' href='#L_PHI_269'><pre>269</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> if (<div class='tooltip'>SI->getOperand(1) == AI<span class='tooltip-content'>331</span></div>) <div class='tooltip'>continue<span class='tooltip-content'>331</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_270' href='#L_PHI_270'><pre>270</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_271' href='#L_PHI_271'><pre>271</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre> isAddressTaken = true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_272' href='#L_PHI_272'><pre>272</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_273' href='#L_PHI_273'><pre>273</pre></a></td><td class='covered-line'><pre>800</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_274' href='#L_PHI_274'><pre>274</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_275' href='#L_PHI_275'><pre>275</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre> if (<div class='tooltip'>!isAddressTaken && <span class='tooltip-content'>469</span></div><div class='tooltip'><span class='red'>AI->isStaticAlloca()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_276' href='#L_PHI_276'><pre>276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_277' href='#L_PHI_277'><pre>277</pre></a></td><td class='covered-line'><pre>469</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_278' href='#L_PHI_278'><pre>278</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_279' href='#L_PHI_279'><pre>279</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // If this load is a load from a GEP with a constant offset from an alloca,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_280' href='#L_PHI_280'><pre>280</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // then we don't want to sink it. In its present form, it will be</pre></td></tr><tr><td class='line-number'><a name='L_PHI_281' href='#L_PHI_281'><pre>281</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // load [constant stack offset]. Sinking it will cause us to have to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_282' href='#L_PHI_282'><pre>282</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // materialize the stack addresses in each predecessor in a register only to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_283' href='#L_PHI_283'><pre>283</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // do a shared load from register in the successor.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_284' href='#L_PHI_284'><pre>284</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (GetElementPtrInst *<span class='tooltip-content'>24.0k</span></div><div class='tooltip'>GEP<span class='tooltip-content'>24.0k</span></div> = dyn_cast<GetElementPtrInst>(L->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_285' href='#L_PHI_285'><pre>285</pre></a></td><td class='covered-line'><pre>13.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (AllocaInst *<span class='tooltip-content'>13.6k</span></div><div class='tooltip'>AI<span class='tooltip-content'>13.6k</span></div> = dyn_cast<AllocaInst>(GEP->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_286' href='#L_PHI_286'><pre>286</pre></a></td><td class='covered-line'><pre>722</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>722</span></div><div class='tooltip'>AI->isStaticAlloca() && <span class='tooltip-content'>722</span></div><div class='tooltip'>GEP->hasAllConstantIndices()<span class='tooltip-content'>722</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_287' href='#L_PHI_287'><pre>287</pre></a></td><td class='covered-line'><pre>648</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_288' href='#L_PHI_288'><pre>288</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_289' href='#L_PHI_289'><pre>289</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_290' href='#L_PHI_290'><pre>290</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_291' href='#L_PHI_291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_292' href='#L_PHI_292'><pre>292</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldPHIArgLoadIntoPHI(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_293' href='#L_PHI_293'><pre>293</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> LoadInst *FirstLI = cast<LoadInst>(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_294' href='#L_PHI_294'><pre>294</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_295' href='#L_PHI_295'><pre>295</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // FIXME: This is overconservative; this transform is allowed in some cases</pre></td></tr><tr><td class='line-number'><a name='L_PHI_296' href='#L_PHI_296'><pre>296</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // for atomic operations.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_297' href='#L_PHI_297'><pre>297</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> if (FirstLI->isAtomic())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_298' href='#L_PHI_298'><pre>298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_299' href='#L_PHI_299'><pre>299</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_300' href='#L_PHI_300'><pre>300</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // When processing loads, we need to propagate two bits of information to the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_301' href='#L_PHI_301'><pre>301</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // sunk load: whether it is volatile, and what its alignment is. We currently</pre></td></tr><tr><td class='line-number'><a name='L_PHI_302' href='#L_PHI_302'><pre>302</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // don't sink loads when some have their alignment specified and some don't.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_303' href='#L_PHI_303'><pre>303</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // visitLoadInst will propagate an alignment onto the load when TD is around,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_304' href='#L_PHI_304'><pre>304</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // and if TD isn't around, we can't handle the mixed case.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_305' href='#L_PHI_305'><pre>305</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> bool isVolatile = FirstLI->isVolatile();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_306' href='#L_PHI_306'><pre>306</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> unsigned LoadAlignment = FirstLI->getAlignment();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_307' href='#L_PHI_307'><pre>307</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> unsigned LoadAddrSpace = FirstLI->getPointerAddressSpace();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_308' href='#L_PHI_308'><pre>308</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_309' href='#L_PHI_309'><pre>309</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // We can't sink the load if the loaded value could be modified between the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_310' href='#L_PHI_310'><pre>310</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // load and the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_311' href='#L_PHI_311'><pre>311</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> if (FirstLI->getParent() != PN.getIncomingBlock(0) ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_312' href='#L_PHI_312'><pre>312</pre></a></td><td class='covered-line'><pre>22.3k</pre></td><td class='code'><pre> !isSafeAndProfitableToSinkLoad(FirstLI))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_313' href='#L_PHI_313'><pre>313</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_314' href='#L_PHI_314'><pre>314</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_315' href='#L_PHI_315'><pre>315</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // If the PHI is of volatile loads and the load block has multiple</pre></td></tr><tr><td class='line-number'><a name='L_PHI_316' href='#L_PHI_316'><pre>316</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // successors, sinking it would remove a load of the volatile value from</pre></td></tr><tr><td class='line-number'><a name='L_PHI_317' href='#L_PHI_317'><pre>317</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> // the path through the other successor.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_318' href='#L_PHI_318'><pre>318</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.3k</span></div><div class='tooltip'>isVolatile &&<span class='tooltip-content'>21.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_319' href='#L_PHI_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>FirstLI->getParent()->getTerminator()->getNumSuccessors() != 1</span>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_320' href='#L_PHI_320'><pre>320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_321' href='#L_PHI_321'><pre>321</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_322' href='#L_PHI_322'><pre>322</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // Check to see if all arguments are the same operation.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_323' href='#L_PHI_323'><pre>323</pre></a></td><td class='covered-line'><pre>23.4k</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 1, e = PN.getNumIncomingValues(); <span class='tooltip-content'>21.3k</span></div><div class='tooltip'>i != e<span class='tooltip-content'>23.4k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>2.12k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_324' href='#L_PHI_324'><pre>324</pre></a></td><td class='covered-line'><pre>22.1k</pre></td><td class='code'><pre> LoadInst *LI = dyn_cast<LoadInst>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_325' href='#L_PHI_325'><pre>325</pre></a></td><td class='covered-line'><pre>22.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LI || <span class='tooltip-content'>22.1k</span></div><div class='tooltip'>!LI->hasOneUse()<span class='tooltip-content'>21.7k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_326' href='#L_PHI_326'><pre>326</pre></a></td><td class='covered-line'><pre>19.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_327' href='#L_PHI_327'><pre>327</pre></a></td><td class='covered-line'><pre>22.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_328' href='#L_PHI_328'><pre>328</pre></a></td><td class='covered-line'><pre>22.1k</pre></td><td class='code'><pre> // We can't sink the load if the loaded value could be modified between</pre></td></tr><tr><td class='line-number'><a name='L_PHI_329' href='#L_PHI_329'><pre>329</pre></a></td><td class='covered-line'><pre>22.1k</pre></td><td class='code'><pre> // the load and the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_330' href='#L_PHI_330'><pre>330</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.37k</span></div><div class='tooltip'>LI->isVolatile() != isVolatile ||<span class='tooltip-content'>2.37k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_331' href='#L_PHI_331'><pre>331</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> LI->getParent() != PN.getIncomingBlock(i) ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_332' href='#L_PHI_332'><pre>332</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> LI->getPointerAddressSpace() != LoadAddrSpace ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_333' href='#L_PHI_333'><pre>333</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> !isSafeAndProfitableToSinkLoad(LI))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_334' href='#L_PHI_334'><pre>334</pre></a></td><td class='covered-line'><pre>254</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_335' href='#L_PHI_335'><pre>335</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_336' href='#L_PHI_336'><pre>336</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> // If some of the loads have an alignment specified but not all of them,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_337' href='#L_PHI_337'><pre>337</pre></a></td><td class='covered-line'><pre>2.37k</pre></td><td class='code'><pre> // we can't do the transformation.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_338' href='#L_PHI_338'><pre>338</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.12k</span></div><div class='tooltip'>(LoadAlignment != 0) != (LI->getAlignment() != 0)<span class='tooltip-content'>2.12k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_339' href='#L_PHI_339'><pre>339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_340' href='#L_PHI_340'><pre>340</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_341' href='#L_PHI_341'><pre>341</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> LoadAlignment = std::min(LoadAlignment, LI->getAlignment());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_342' href='#L_PHI_342'><pre>342</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_343' href='#L_PHI_343'><pre>343</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> // If the PHI is of volatile loads and the load block has multiple</pre></td></tr><tr><td class='line-number'><a name='L_PHI_344' href='#L_PHI_344'><pre>344</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> // successors, sinking it would remove a load of the volatile value from</pre></td></tr><tr><td class='line-number'><a name='L_PHI_345' href='#L_PHI_345'><pre>345</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> // the path through the other successor.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_346' href='#L_PHI_346'><pre>346</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> if (isVolatile &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_347' href='#L_PHI_347'><pre>347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LI->getParent()->getTerminator()->getNumSuccessors() != 1</span>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_348' href='#L_PHI_348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_349' href='#L_PHI_349'><pre>349</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_350' href='#L_PHI_350'><pre>350</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_351' href='#L_PHI_351'><pre>351</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // Okay, they are all the same operation. Create a new PHI node of the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_352' href='#L_PHI_352'><pre>352</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // correct type, and PHI together all of the LHS's of the instructions.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_353' href='#L_PHI_353'><pre>353</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> PHINode *NewPN = PHINode::Create(FirstLI->getOperand(0)->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_354' href='#L_PHI_354'><pre>354</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> PN.getNumIncomingValues(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_355' href='#L_PHI_355'><pre>355</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> PN.getName()+".in");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_356' href='#L_PHI_356'><pre>356</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_357' href='#L_PHI_357'><pre>357</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> Value *InVal = FirstLI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_358' href='#L_PHI_358'><pre>358</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> NewPN->addIncoming(InVal, PN.getIncomingBlock(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_359' href='#L_PHI_359'><pre>359</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LoadInst *NewLI = new LoadInst(NewPN, "", isVolatile, LoadAlignment);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_360' href='#L_PHI_360'><pre>360</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_361' href='#L_PHI_361'><pre>361</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> unsigned KnownIDs[] = {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_362' href='#L_PHI_362'><pre>362</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_tbaa,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_363' href='#L_PHI_363'><pre>363</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_range,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_364' href='#L_PHI_364'><pre>364</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_invariant_load,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_365' href='#L_PHI_365'><pre>365</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_alias_scope,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_366' href='#L_PHI_366'><pre>366</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_noalias,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_367' href='#L_PHI_367'><pre>367</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_nonnull,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_368' href='#L_PHI_368'><pre>368</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_align,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_369' href='#L_PHI_369'><pre>369</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_dereferenceable,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_370' href='#L_PHI_370'><pre>370</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> LLVMContext::MD_dereferenceable_or_null,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_371' href='#L_PHI_371'><pre>371</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_PHI_372' href='#L_PHI_372'><pre>372</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_373' href='#L_PHI_373'><pre>373</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> for (unsigned ID : KnownIDs)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_374' href='#L_PHI_374'><pre>374</pre></a></td><td class='covered-line'><pre>11.8k</pre></td><td class='code'><pre> NewLI->setMetadata(ID, FirstLI->getMetadata(ID));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_375' href='#L_PHI_375'><pre>375</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_376' href='#L_PHI_376'><pre>376</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // Add all operands to the new PHI and combine TBAA metadata.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_377' href='#L_PHI_377'><pre>377</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>2.73k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>1.41k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.41k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_378' href='#L_PHI_378'><pre>378</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> LoadInst *LI = cast<LoadInst>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_379' href='#L_PHI_379'><pre>379</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> combineMetadata(NewLI, LI, KnownIDs);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_380' href='#L_PHI_380'><pre>380</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> Value *NewInVal = LI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_381' href='#L_PHI_381'><pre>381</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> if (NewInVal != InVal)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_382' href='#L_PHI_382'><pre>382</pre></a></td><td class='covered-line'><pre>1.36k</pre></td><td class='code'><pre> InVal = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_383' href='#L_PHI_383'><pre>383</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> NewPN->addIncoming(NewInVal, PN.getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_384' href='#L_PHI_384'><pre>384</pre></a></td><td class='covered-line'><pre>1.41k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_385' href='#L_PHI_385'><pre>385</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_386' href='#L_PHI_386'><pre>386</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> if (<div class='tooltip'>InVal<span class='tooltip-content'>1.31k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>44</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_387' href='#L_PHI_387'><pre>387</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> // The new PHI unions all of the same values together. This is really</pre></td></tr><tr><td class='line-number'><a name='L_PHI_388' href='#L_PHI_388'><pre>388</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> // common, so we handle it intelligently here for compile-time speed.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_389' href='#L_PHI_389'><pre>389</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> NewLI->setOperand(0, InVal);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_390' href='#L_PHI_390'><pre>390</pre></a></td><td class='covered-line'><pre>44</pre></td><td class='code'><pre> delete NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_391' href='#L_PHI_391'><pre>391</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_392' href='#L_PHI_392'><pre>392</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> InsertNewInstBefore(NewPN, PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_393' href='#L_PHI_393'><pre>393</pre></a></td><td class='covered-line'><pre>1.27k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_394' href='#L_PHI_394'><pre>394</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_395' href='#L_PHI_395'><pre>395</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // If this was a volatile load that we are merging, make sure to loop through</pre></td></tr><tr><td class='line-number'><a name='L_PHI_396' href='#L_PHI_396'><pre>396</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // and mark all the input loads as non-volatile. If we don't do this, we will</pre></td></tr><tr><td class='line-number'><a name='L_PHI_397' href='#L_PHI_397'><pre>397</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> // insert a new volatile load and the old ones will not be deletable.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_398' href='#L_PHI_398'><pre>398</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> if (isVolatile)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_399' href='#L_PHI_399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>for (Value *IncValue : PN.incoming_values())</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_400' href='#L_PHI_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cast<LoadInst>(IncValue)->setVolatile(false)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_401' href='#L_PHI_401'><pre>401</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_402' href='#L_PHI_402'><pre>402</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> NewLI->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_403' href='#L_PHI_403'><pre>403</pre></a></td><td class='covered-line'><pre>1.31k</pre></td><td class='code'><pre> return NewLI;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_404' href='#L_PHI_404'><pre>404</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_405' href='#L_PHI_405'><pre>405</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_406' href='#L_PHI_406'><pre>406</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// TODO: This function could handle other cast types, but then it might</pre></td></tr><tr><td class='line-number'><a name='L_PHI_407' href='#L_PHI_407'><pre>407</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// require special-casing a cast from the 'i1' type. See the comment in</pre></td></tr><tr><td class='line-number'><a name='L_PHI_408' href='#L_PHI_408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// FoldPHIArgOpIntoPHI() about pessimizing illegal integer types.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_409' href='#L_PHI_409'><pre>409</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldPHIArgZextsIntoPHI(PHINode &Phi) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_410' href='#L_PHI_410'><pre>410</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // We cannot create a new instruction after the PHI if the terminator is an</pre></td></tr><tr><td class='line-number'><a name='L_PHI_411' href='#L_PHI_411'><pre>411</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // EHPad because there is no valid insertion point.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_412' href='#L_PHI_412'><pre>412</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> if (TerminatorInst *TI = Phi.getParent()->getTerminator())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_413' href='#L_PHI_413'><pre>413</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>997k</span></div><div class='tooltip'>TI->isEHPad()<span class='tooltip-content'>997k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_414' href='#L_PHI_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_415' href='#L_PHI_415'><pre>415</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_416' href='#L_PHI_416'><pre>416</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // Early exit for the common case of a phi with two operands. These are</pre></td></tr><tr><td class='line-number'><a name='L_PHI_417' href='#L_PHI_417'><pre>417</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // handled elsewhere. See the comment below where we check the count of zexts</pre></td></tr><tr><td class='line-number'><a name='L_PHI_418' href='#L_PHI_418'><pre>418</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // and constants for more details.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_419' href='#L_PHI_419'><pre>419</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> unsigned NumIncomingValues = Phi.getNumIncomingValues();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_420' href='#L_PHI_420'><pre>420</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> if (NumIncomingValues < 3)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_421' href='#L_PHI_421'><pre>421</pre></a></td><td class='covered-line'><pre>801k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_422' href='#L_PHI_422'><pre>422</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_423' href='#L_PHI_423'><pre>423</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // Find the narrower type specified by the first zext.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_424' href='#L_PHI_424'><pre>424</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> Type *NarrowType = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_425' href='#L_PHI_425'><pre>425</pre></a></td><td class='covered-line'><pre>1.43M</pre></td><td class='code'><pre> for (Value *V : Phi.incoming_values()) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_426' href='#L_PHI_426'><pre>426</pre></a></td><td class='covered-line'><pre>1.43M</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>Zext<span class='tooltip-content'>1.43M</span></div> = dyn_cast<ZExtInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>4.59k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_427' href='#L_PHI_427'><pre>427</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> NarrowType = Zext->getSrcTy();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_428' href='#L_PHI_428'><pre>428</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_429' href='#L_PHI_429'><pre>429</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_430' href='#L_PHI_430'><pre>430</pre></a></td><td class='covered-line'><pre>1.43M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_431' href='#L_PHI_431'><pre>431</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> if (!NarrowType)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_432' href='#L_PHI_432'><pre>432</pre></a></td><td class='covered-line'><pre>191k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_433' href='#L_PHI_433'><pre>433</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_434' href='#L_PHI_434'><pre>434</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> // Walk the phi operands checking that we only have zexts or constants that</pre></td></tr><tr><td class='line-number'><a name='L_PHI_435' href='#L_PHI_435'><pre>435</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> // we can shrink for free. Store the new operands for the new phi.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_436' href='#L_PHI_436'><pre>436</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> SmallVector<Value *, 4> NewIncoming;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_437' href='#L_PHI_437'><pre>437</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> unsigned NumZexts = 0;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_438' href='#L_PHI_438'><pre>438</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> unsigned NumConsts = 0;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_439' href='#L_PHI_439'><pre>439</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> for (Value *V : Phi.incoming_values()) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_440' href='#L_PHI_440'><pre>440</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>Zext<span class='tooltip-content'>13.2k</span></div> = dyn_cast<ZExtInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>3.49k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_441' href='#L_PHI_441'><pre>441</pre></a></td><td class='covered-line'><pre>3.49k</pre></td><td class='code'><pre> // All zexts must be identical and have one use.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_442' href='#L_PHI_442'><pre>442</pre></a></td><td class='covered-line'><pre>3.49k</pre></td><td class='code'><pre> if (<div class='tooltip'>Zext->getSrcTy() != NarrowType || <span class='tooltip-content'>3.49k</span></div><div class='tooltip'>!Zext->hasOneUse()<span class='tooltip-content'>3.46k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_443' href='#L_PHI_443'><pre>443</pre></a></td><td class='covered-line'><pre>332</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_444' href='#L_PHI_444'><pre>444</pre></a></td><td class='covered-line'><pre>3.16k</pre></td><td class='code'><pre> NewIncoming.push_back(Zext->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_445' href='#L_PHI_445'><pre>445</pre></a></td><td class='covered-line'><pre>3.16k</pre></td><td class='code'><pre> NumZexts++;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_446' href='#L_PHI_446'><pre>446</pre></a></td><td class='covered-line'><pre>9.79k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (auto *<span class='tooltip-content'>9.79k</span></div><div class='tooltip'>C<span class='tooltip-content'>9.79k</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'>{<span class='tooltip-content'>7.94k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_447' href='#L_PHI_447'><pre>447</pre></a></td><td class='covered-line'><pre>7.94k</pre></td><td class='code'><pre> // Make sure that constants can fit in the new type.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_448' href='#L_PHI_448'><pre>448</pre></a></td><td class='covered-line'><pre>7.94k</pre></td><td class='code'><pre> Constant *Trunc = ConstantExpr::getTrunc(C, NarrowType);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_449' href='#L_PHI_449'><pre>449</pre></a></td><td class='covered-line'><pre>7.94k</pre></td><td class='code'><pre> if (ConstantExpr::getZExt(Trunc, C->getType()) != C)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_450' href='#L_PHI_450'><pre>450</pre></a></td><td class='covered-line'><pre>355</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_451' href='#L_PHI_451'><pre>451</pre></a></td><td class='covered-line'><pre>7.58k</pre></td><td class='code'><pre> NewIncoming.push_back(Trunc);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_452' href='#L_PHI_452'><pre>452</pre></a></td><td class='covered-line'><pre>7.58k</pre></td><td class='code'><pre> NumConsts++;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_453' href='#L_PHI_453'><pre>453</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_454' href='#L_PHI_454'><pre>454</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> // If it's not a cast or a constant, bail out.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_455' href='#L_PHI_455'><pre>455</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_456' href='#L_PHI_456'><pre>456</pre></a></td><td class='covered-line'><pre>1.84k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_457' href='#L_PHI_457'><pre>457</pre></a></td><td class='covered-line'><pre>13.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_458' href='#L_PHI_458'><pre>458</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_459' href='#L_PHI_459'><pre>459</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // The more common cases of a phi with no constant operands or just one</pre></td></tr><tr><td class='line-number'><a name='L_PHI_460' href='#L_PHI_460'><pre>460</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // variable operand are handled by FoldPHIArgOpIntoPHI() and FoldOpIntoPhi()</pre></td></tr><tr><td class='line-number'><a name='L_PHI_461' href='#L_PHI_461'><pre>461</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // respectively. FoldOpIntoPhi() wants to do the opposite transform that is</pre></td></tr><tr><td class='line-number'><a name='L_PHI_462' href='#L_PHI_462'><pre>462</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // performed here. It tries to replicate a cast in the phi operand's basic</pre></td></tr><tr><td class='line-number'><a name='L_PHI_463' href='#L_PHI_463'><pre>463</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // block to expose other folding opportunities. Thus, InstCombine will</pre></td></tr><tr><td class='line-number'><a name='L_PHI_464' href='#L_PHI_464'><pre>464</pre></a></td><td class='covered-line'><pre>4.59k</pre></td><td class='code'><pre> // infinite loop without this check.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_465' href='#L_PHI_465'><pre>465</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.06k</span></div><div class='tooltip'>NumConsts == 0 || <span class='tooltip-content'>2.06k</span></div><div class='tooltip'>NumZexts < 2<span class='tooltip-content'>2.05k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_466' href='#L_PHI_466'><pre>466</pre></a></td><td class='covered-line'><pre>2.04k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_467' href='#L_PHI_467'><pre>467</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_468' href='#L_PHI_468'><pre>468</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre> // All incoming values are zexts or constants that are safe to truncate.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_469' href='#L_PHI_469'><pre>469</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre> // Create a new phi node of the narrow type, phi together all of the new</pre></td></tr><tr><td class='line-number'><a name='L_PHI_470' href='#L_PHI_470'><pre>470</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre> // operands, and zext the result back to the original type.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_471' href='#L_PHI_471'><pre>471</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> PHINode *NewPhi = PHINode::Create(NarrowType, NumIncomingValues,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_472' href='#L_PHI_472'><pre>472</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Phi.getName() + ".shrunk");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_473' href='#L_PHI_473'><pre>473</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i != NumIncomingValues<span class='tooltip-content'>151</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>131</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_474' href='#L_PHI_474'><pre>474</pre></a></td><td class='covered-line'><pre>131</pre></td><td class='code'><pre> NewPhi->addIncoming(NewIncoming[i], Phi.getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_475' href='#L_PHI_475'><pre>475</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_476' href='#L_PHI_476'><pre>476</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> InsertNewInstBefore(NewPhi, Phi);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_477' href='#L_PHI_477'><pre>477</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return CastInst::CreateZExtOrBitCast(NewPhi, Phi.getType());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_478' href='#L_PHI_478'><pre>478</pre></a></td><td class='covered-line'><pre>2.06k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_479' href='#L_PHI_479'><pre>479</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_480' href='#L_PHI_480'><pre>480</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If all operands to a PHI node are the same "unary" operator and they all are</pre></td></tr><tr><td class='line-number'><a name='L_PHI_481' href='#L_PHI_481'><pre>481</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// only used by the PHI, PHI together their inputs, and do the operation once,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_482' href='#L_PHI_482'><pre>482</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// to the result of the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_483' href='#L_PHI_483'><pre>483</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre>Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_484' href='#L_PHI_484'><pre>484</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> // We cannot create a new instruction after the PHI if the terminator is an</pre></td></tr><tr><td class='line-number'><a name='L_PHI_485' href='#L_PHI_485'><pre>485</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> // EHPad because there is no valid insertion point.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_486' href='#L_PHI_486'><pre>486</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> if (TerminatorInst *TI = PN.getParent()->getTerminator())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_487' href='#L_PHI_487'><pre>487</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>125k</span></div><div class='tooltip'>TI->isEHPad()<span class='tooltip-content'>125k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_488' href='#L_PHI_488'><pre>488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_489' href='#L_PHI_489'><pre>489</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_490' href='#L_PHI_490'><pre>490</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_491' href='#L_PHI_491'><pre>491</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_492' href='#L_PHI_492'><pre>492</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> if (isa<GetElementPtrInst>(FirstInst))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_493' href='#L_PHI_493'><pre>493</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> return FoldPHIArgGEPIntoPHI(PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_494' href='#L_PHI_494'><pre>494</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>99.0k</span></div><div class='tooltip'>isa<LoadInst>(FirstInst)<span class='tooltip-content'>99.0k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_495' href='#L_PHI_495'><pre>495</pre></a></td><td class='covered-line'><pre>22.4k</pre></td><td class='code'><pre> return FoldPHIArgLoadIntoPHI(PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_496' href='#L_PHI_496'><pre>496</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_497' href='#L_PHI_497'><pre>497</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre> // Scan the instruction, looking for input operations that can be folded away.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_498' href='#L_PHI_498'><pre>498</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre> // If all input operands to the phi are the same instruction (e.g. a cast from</pre></td></tr><tr><td class='line-number'><a name='L_PHI_499' href='#L_PHI_499'><pre>499</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre> // the same type or "+42") we can pull the operation through the PHI, reducing</pre></td></tr><tr><td class='line-number'><a name='L_PHI_500' href='#L_PHI_500'><pre>500</pre></a></td><td class='covered-line'><pre>99.0k</pre></td><td class='code'><pre> // code size and simplifying code.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_501' href='#L_PHI_501'><pre>501</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre> Constant *ConstantOp = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_502' href='#L_PHI_502'><pre>502</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre> Type *CastSrcTy = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_503' href='#L_PHI_503'><pre>503</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_504' href='#L_PHI_504'><pre>504</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<CastInst>(FirstInst)<span class='tooltip-content'>76.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_505' href='#L_PHI_505'><pre>505</pre></a></td><td class='covered-line'><pre>7.12k</pre></td><td class='code'><pre> CastSrcTy = FirstInst->getOperand(0)->getType();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_506' href='#L_PHI_506'><pre>506</pre></a></td><td class='covered-line'><pre>7.12k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_507' href='#L_PHI_507'><pre>507</pre></a></td><td class='covered-line'><pre>7.12k</pre></td><td class='code'><pre> // Be careful about transforming integer PHIs. We don't want to pessimize</pre></td></tr><tr><td class='line-number'><a name='L_PHI_508' href='#L_PHI_508'><pre>508</pre></a></td><td class='covered-line'><pre>7.12k</pre></td><td class='code'><pre> // the code by turning an i32 into an i1293.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_509' href='#L_PHI_509'><pre>509</pre></a></td><td class='covered-line'><pre>7.12k</pre></td><td class='code'><pre> if (<div class='tooltip'>PN.getType()->isIntegerTy() && <span class='tooltip-content'>7.12k</span></div><div class='tooltip'>CastSrcTy->isIntegerTy()<span class='tooltip-content'>1.61k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.34k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_510' href='#L_PHI_510'><pre>510</pre></a></td><td class='covered-line'><pre>1.34k</pre></td><td class='code'><pre> if (!shouldChangeType(PN.getType(), CastSrcTy))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_511' href='#L_PHI_511'><pre>511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_512' href='#L_PHI_512'><pre>512</pre></a></td><td class='covered-line'><pre>1.34k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_513' href='#L_PHI_513'><pre>513</pre></a></td><td class='covered-line'><pre>69.4k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>69.4k</span></div><div class='tooltip'>isa<BinaryOperator>(FirstInst) || <span class='tooltip-content'>69.4k</span></div><div class='tooltip'>isa<CmpInst>(FirstInst)<span class='tooltip-content'>62.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7.89k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_514' href='#L_PHI_514'><pre>514</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> // Can fold binop, compare or shift here if the RHS is a constant,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_515' href='#L_PHI_515'><pre>515</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> // otherwise call FoldPHIArgBinOpIntoPHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_516' href='#L_PHI_516'><pre>516</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> ConstantOp = dyn_cast<Constant>(FirstInst->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_517' href='#L_PHI_517'><pre>517</pre></a></td><td class='covered-line'><pre>7.89k</pre></td><td class='code'><pre> if (!ConstantOp)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_518' href='#L_PHI_518'><pre>518</pre></a></td><td class='covered-line'><pre>3.69k</pre></td><td class='code'><pre> return FoldPHIArgBinOpIntoPHI(PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_519' href='#L_PHI_519'><pre>519</pre></a></td><td class='covered-line'><pre>61.5k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_520' href='#L_PHI_520'><pre>520</pre></a></td><td class='covered-line'><pre>61.5k</pre></td><td class='code'><pre> return nullptr; // Cannot fold this operation.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_521' href='#L_PHI_521'><pre>521</pre></a></td><td class='covered-line'><pre>61.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_522' href='#L_PHI_522'><pre>522</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_523' href='#L_PHI_523'><pre>523</pre></a></td><td class='covered-line'><pre>76.5k</pre></td><td class='code'><pre> // Check to see if all arguments are the same operation.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_524' href='#L_PHI_524'><pre>524</pre></a></td><td class='covered-line'><pre>14.6k</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 1, e = PN.getNumIncomingValues(); <span class='tooltip-content'>11.3k</span></div><div class='tooltip'>i != e<span class='tooltip-content'>14.6k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>3.33k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_525' href='#L_PHI_525'><pre>525</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_526' href='#L_PHI_526'><pre>526</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I || <span class='tooltip-content'>12.8k</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>12.5k</span></div> || <div class='tooltip'>!I->isSameOperationAs(FirstInst)<span class='tooltip-content'>6.52k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_527' href='#L_PHI_527'><pre>527</pre></a></td><td class='covered-line'><pre>8.10k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_528' href='#L_PHI_528'><pre>528</pre></a></td><td class='covered-line'><pre>4.71k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.71k</span></div><div class='tooltip'>CastSrcTy<span class='tooltip-content'>4.71k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.38k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_529' href='#L_PHI_529'><pre>529</pre></a></td><td class='covered-line'><pre>2.38k</pre></td><td class='code'><pre> if (I->getOperand(0)->getType() != CastSrcTy)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_530' href='#L_PHI_530'><pre>530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>; // Cast operation must match.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_531' href='#L_PHI_531'><pre>531</pre></a></td><td class='covered-line'><pre>2.33k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>2.33k</span></div><div class='tooltip'>I->getOperand(1) != ConstantOp<span class='tooltip-content'>2.33k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.38k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_532' href='#L_PHI_532'><pre>532</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_533' href='#L_PHI_533'><pre>533</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_534' href='#L_PHI_534'><pre>534</pre></a></td><td class='covered-line'><pre>4.71k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_535' href='#L_PHI_535'><pre>535</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_536' href='#L_PHI_536'><pre>536</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> // Okay, they are all the same operation. Create a new PHI node of the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_537' href='#L_PHI_537'><pre>537</pre></a></td><td class='covered-line'><pre>11.3k</pre></td><td class='code'><pre> // correct type, and PHI together all of the LHS's of the instructions.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_538' href='#L_PHI_538'><pre>538</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> PHINode *NewPN = PHINode::Create(FirstInst->getOperand(0)->getType(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_539' href='#L_PHI_539'><pre>539</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> PN.getNumIncomingValues(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_540' href='#L_PHI_540'><pre>540</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> PN.getName()+".in");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_541' href='#L_PHI_541'><pre>541</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_542' href='#L_PHI_542'><pre>542</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> Value *InVal = FirstInst->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_543' href='#L_PHI_543'><pre>543</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> NewPN->addIncoming(InVal, PN.getIncomingBlock(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_544' href='#L_PHI_544'><pre>544</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_545' href='#L_PHI_545'><pre>545</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> // Add all operands to the new PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_546' href='#L_PHI_546'><pre>546</pre></a></td><td class='covered-line'><pre>3.71k</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>3.71k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>1.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.87k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_547' href='#L_PHI_547'><pre>547</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> Value *NewInVal = cast<Instruction>(PN.getIncomingValue(i))->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_548' href='#L_PHI_548'><pre>548</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> if (NewInVal != InVal)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_549' href='#L_PHI_549'><pre>549</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> InVal = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_550' href='#L_PHI_550'><pre>550</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> NewPN->addIncoming(NewInVal, PN.getIncomingBlock(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_551' href='#L_PHI_551'><pre>551</pre></a></td><td class='covered-line'><pre>1.87k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_552' href='#L_PHI_552'><pre>552</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_553' href='#L_PHI_553'><pre>553</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> Value *PhiVal;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_554' href='#L_PHI_554'><pre>554</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> if (<div class='tooltip'>InVal<span class='tooltip-content'>1.83k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>46</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_555' href='#L_PHI_555'><pre>555</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> // The new PHI unions all of the same values together. This is really</pre></td></tr><tr><td class='line-number'><a name='L_PHI_556' href='#L_PHI_556'><pre>556</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> // common, so we handle it intelligently here for compile-time speed.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_557' href='#L_PHI_557'><pre>557</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> PhiVal = InVal;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_558' href='#L_PHI_558'><pre>558</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> delete NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_559' href='#L_PHI_559'><pre>559</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_560' href='#L_PHI_560'><pre>560</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> InsertNewInstBefore(NewPN, PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_561' href='#L_PHI_561'><pre>561</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> PhiVal = NewPN;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_562' href='#L_PHI_562'><pre>562</pre></a></td><td class='covered-line'><pre>1.78k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_563' href='#L_PHI_563'><pre>563</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_564' href='#L_PHI_564'><pre>564</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> // Insert and return the new operation.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_565' href='#L_PHI_565'><pre>565</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre> if (CastInst *<div class='tooltip'>FirstCI<span class='tooltip-content'>1.83k</span></div> = dyn_cast<CastInst>(FirstInst)) <div class='tooltip'>{<span class='tooltip-content'>1.47k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_566' href='#L_PHI_566'><pre>566</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> CastInst *NewCI = CastInst::Create(FirstCI->getOpcode(), PhiVal,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_567' href='#L_PHI_567'><pre>567</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> PN.getType());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_568' href='#L_PHI_568'><pre>568</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> NewCI->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_569' href='#L_PHI_569'><pre>569</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> return NewCI;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_570' href='#L_PHI_570'><pre>570</pre></a></td><td class='covered-line'><pre>1.47k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_571' href='#L_PHI_571'><pre>571</pre></a></td><td class='covered-line'><pre>1.83k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_572' href='#L_PHI_572'><pre>572</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> <div class='tooltip'>if (BinaryOperator *<span class='tooltip-content'>362</span></div><div class='tooltip'>BinOp<span class='tooltip-content'>362</span></div> = dyn_cast<BinaryOperator>(FirstInst)) <div class='tooltip'>{<span class='tooltip-content'>315</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_573' href='#L_PHI_573'><pre>573</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre> BinOp = BinaryOperator::Create(BinOp->getOpcode(), PhiVal, ConstantOp);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_574' href='#L_PHI_574'><pre>574</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre> BinOp->copyIRFlags(PN.getIncomingValue(0));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_575' href='#L_PHI_575'><pre>575</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_576' href='#L_PHI_576'><pre>576</pre></a></td><td class='covered-line'><pre>639</pre></td><td class='code'><pre> for (unsigned i = 1, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>639</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>324</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_577' href='#L_PHI_577'><pre>577</pre></a></td><td class='covered-line'><pre>324</pre></td><td class='code'><pre> BinOp->andIRFlags(PN.getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_578' href='#L_PHI_578'><pre>578</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_579' href='#L_PHI_579'><pre>579</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre> BinOp->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_580' href='#L_PHI_580'><pre>580</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre> return BinOp;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_581' href='#L_PHI_581'><pre>581</pre></a></td><td class='covered-line'><pre>315</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_582' href='#L_PHI_582'><pre>582</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_583' href='#L_PHI_583'><pre>583</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> CmpInst *CIOp = cast<CmpInst>(FirstInst);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_584' href='#L_PHI_584'><pre>584</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> CmpInst *NewCI = CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(),</pre></td></tr><tr><td class='line-number'><a name='L_PHI_585' href='#L_PHI_585'><pre>585</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> PhiVal, ConstantOp);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_586' href='#L_PHI_586'><pre>586</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> NewCI->setDebugLoc(PHIArgMergedDebugLoc(PN));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_587' href='#L_PHI_587'><pre>587</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> return NewCI;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_588' href='#L_PHI_588'><pre>588</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_589' href='#L_PHI_589'><pre>589</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_590' href='#L_PHI_590'><pre>590</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if this PHI node is only used by a PHI node cycle that is dead.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_591' href='#L_PHI_591'><pre>591</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool DeadPHICycle(PHINode *PN,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_592' href='#L_PHI_592'><pre>592</pre></a></td><td class='covered-line'><pre>278k</pre></td><td class='code'><pre> SmallPtrSetImpl<PHINode*> &PotentiallyDeadPHIs) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_593' href='#L_PHI_593'><pre>593</pre></a></td><td class='covered-line'><pre>278k</pre></td><td class='code'><pre> if (<div class='tooltip'>PN->use_empty()<span class='tooltip-content'>278k</span></div>) <div class='tooltip'>return true<span class='tooltip-content'>159</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_594' href='#L_PHI_594'><pre>594</pre></a></td><td class='covered-line'><pre>277k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>277k</span></div><div class='tooltip'>!PN->hasOneUse()<span class='tooltip-content'>277k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>84.9k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_595' href='#L_PHI_595'><pre>595</pre></a></td><td class='covered-line'><pre>277k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_596' href='#L_PHI_596'><pre>596</pre></a></td><td class='covered-line'><pre>277k</pre></td><td class='code'><pre> // Remember this node, and if we find the cycle, return.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_597' href='#L_PHI_597'><pre>597</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>192k</span></div><div class='tooltip'>!PotentiallyDeadPHIs.insert(PN).second<span class='tooltip-content'>192k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_598' href='#L_PHI_598'><pre>598</pre></a></td><td class='covered-line'><pre>90</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_599' href='#L_PHI_599'><pre>599</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_600' href='#L_PHI_600'><pre>600</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> // Don't scan crazily complex things.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_601' href='#L_PHI_601'><pre>601</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>192k</span></div><div class='tooltip'>PotentiallyDeadPHIs.size() == 16<span class='tooltip-content'>192k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_602' href='#L_PHI_602'><pre>602</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_603' href='#L_PHI_603'><pre>603</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_604' href='#L_PHI_604'><pre>604</pre></a></td><td class='covered-line'><pre>191k</pre></td><td class='code'><pre> <div class='tooltip'>if (PHINode *<span class='tooltip-content'>191k</span></div><div class='tooltip'>PU<span class='tooltip-content'>191k</span></div> = dyn_cast<PHINode>(PN->user_back()))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_605' href='#L_PHI_605'><pre>605</pre></a></td><td class='covered-line'><pre>135k</pre></td><td class='code'><pre> return DeadPHICycle(PU, PotentiallyDeadPHIs);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_606' href='#L_PHI_606'><pre>606</pre></a></td><td class='covered-line'><pre>191k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_607' href='#L_PHI_607'><pre>607</pre></a></td><td class='covered-line'><pre>56.4k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_608' href='#L_PHI_608'><pre>608</pre></a></td><td class='covered-line'><pre>191k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_609' href='#L_PHI_609'><pre>609</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_610' href='#L_PHI_610'><pre>610</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if this phi node is always equal to NonPhiInVal.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_611' href='#L_PHI_611'><pre>611</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This happens with mutually cyclic phi nodes like:</pre></td></tr><tr><td class='line-number'><a name='L_PHI_612' href='#L_PHI_612'><pre>612</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// z = some value; x = phi (y, z); y = phi (x, z)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_613' href='#L_PHI_613'><pre>613</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool PHIsEqualValue(PHINode *PN, Value *NonPhiInVal,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_614' href='#L_PHI_614'><pre>614</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> SmallPtrSetImpl<PHINode*> &ValueEqualPHIs) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_615' href='#L_PHI_615'><pre>615</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> // See if we already saw this PHI node.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_616' href='#L_PHI_616'><pre>616</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> if (!ValueEqualPHIs.insert(PN).second)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_617' href='#L_PHI_617'><pre>617</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_618' href='#L_PHI_618'><pre>618</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_619' href='#L_PHI_619'><pre>619</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> // Don't scan crazily complex things.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_620' href='#L_PHI_620'><pre>620</pre></a></td><td class='covered-line'><pre>821k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>821k</span></div><div class='tooltip'>ValueEqualPHIs.size() == 16<span class='tooltip-content'>821k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_621' href='#L_PHI_621'><pre>621</pre></a></td><td class='covered-line'><pre>3.91k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_622' href='#L_PHI_622'><pre>622</pre></a></td><td class='covered-line'><pre>821k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_623' href='#L_PHI_623'><pre>623</pre></a></td><td class='covered-line'><pre>821k</pre></td><td class='code'><pre> // Scan the operands to see if they are either phi nodes or are equal to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_624' href='#L_PHI_624'><pre>624</pre></a></td><td class='covered-line'><pre>821k</pre></td><td class='code'><pre> // the value.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_625' href='#L_PHI_625'><pre>625</pre></a></td><td class='covered-line'><pre>1.26M</pre></td><td class='code'><pre> <div class='tooltip'>for (Value *Op : PN->incoming_values()) <span class='tooltip-content'>817k</span></div><div class='tooltip'>{<span class='tooltip-content'>1.26M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_626' href='#L_PHI_626'><pre>626</pre></a></td><td class='covered-line'><pre>1.26M</pre></td><td class='code'><pre> if (PHINode *<div class='tooltip'>OpPN<span class='tooltip-content'>1.26M</span></div> = dyn_cast<PHINode>(Op)) <div class='tooltip'>{<span class='tooltip-content'>740k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_627' href='#L_PHI_627'><pre>627</pre></a></td><td class='covered-line'><pre>740k</pre></td><td class='code'><pre> if (!PHIsEqualValue(OpPN, NonPhiInVal, ValueEqualPHIs))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_628' href='#L_PHI_628'><pre>628</pre></a></td><td class='covered-line'><pre>482k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_629' href='#L_PHI_629'><pre>629</pre></a></td><td class='covered-line'><pre>523k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>523k</span></div><div class='tooltip'>Op != NonPhiInVal<span class='tooltip-content'>523k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_630' href='#L_PHI_630'><pre>630</pre></a></td><td class='covered-line'><pre>266k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_631' href='#L_PHI_631'><pre>631</pre></a></td><td class='covered-line'><pre>1.26M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_632' href='#L_PHI_632'><pre>632</pre></a></td><td class='covered-line'><pre>817k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_633' href='#L_PHI_633'><pre>633</pre></a></td><td class='covered-line'><pre>68.5k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_634' href='#L_PHI_634'><pre>634</pre></a></td><td class='covered-line'><pre>817k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_635' href='#L_PHI_635'><pre>635</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_636' href='#L_PHI_636'><pre>636</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return an existing non-zero constant if this phi node has one, otherwise</pre></td></tr><tr><td class='line-number'><a name='L_PHI_637' href='#L_PHI_637'><pre>637</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// return constant 1.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_638' href='#L_PHI_638'><pre>638</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre>static ConstantInt *GetAnyNonZeroConstInt(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_639' href='#L_PHI_639'><pre>639</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> assert(isa<IntegerType>(PN.getType()) && "Expect only intger type phi");</pre></td></tr><tr><td class='line-number'><a name='L_PHI_640' href='#L_PHI_640'><pre>640</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> for (Value *V : PN.operands())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_641' href='#L_PHI_641'><pre>641</pre></a></td><td class='covered-line'><pre>6.51k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>6.51k</span></div><div class='tooltip'>ConstVA<span class='tooltip-content'>6.51k</span></div> = dyn_cast<ConstantInt>(V))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_642' href='#L_PHI_642'><pre>642</pre></a></td><td class='covered-line'><pre>5.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.26k</span></div><div class='tooltip'>!ConstVA->isZeroValue()<span class='tooltip-content'>5.26k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_643' href='#L_PHI_643'><pre>643</pre></a></td><td class='covered-line'><pre>3.99k</pre></td><td class='code'><pre> return ConstVA;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_644' href='#L_PHI_644'><pre>644</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return ConstantInt::get(cast<IntegerType>(PN.getType()), 1);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_645' href='#L_PHI_645'><pre>645</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_646' href='#L_PHI_646'><pre>646</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_647' href='#L_PHI_647'><pre>647</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>namespace {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_648' href='#L_PHI_648'><pre>648</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct PHIUsageRecord {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_649' href='#L_PHI_649'><pre>649</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned PHIId; // The ID # of the PHI (something determinstic to sort on)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_650' href='#L_PHI_650'><pre>650</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned Shift; // The amount shifted.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_651' href='#L_PHI_651'><pre>651</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *Inst; // The trunc instruction.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_652' href='#L_PHI_652'><pre>652</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_653' href='#L_PHI_653'><pre>653</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> PHIUsageRecord(unsigned pn, unsigned Sh, Instruction *User)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_654' href='#L_PHI_654'><pre>654</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : PHIId(pn), Shift(Sh), Inst(User) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_655' href='#L_PHI_655'><pre>655</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_656' href='#L_PHI_656'><pre>656</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> bool operator<(const PHIUsageRecord &RHS) const <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_657' href='#L_PHI_657'><pre>657</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>PHIId < RHS.PHIId</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return true</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_658' href='#L_PHI_658'><pre>658</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PHIId > RHS.PHIId</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_659' href='#L_PHI_659'><pre>659</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Shift < RHS.Shift</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return true</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_660' href='#L_PHI_660'><pre>660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Shift > RHS.Shift</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_661' href='#L_PHI_661'><pre>661</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return Inst->getType()->getPrimitiveSizeInBits() <</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_662' href='#L_PHI_662'><pre>662</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> RHS.Inst->getType()->getPrimitiveSizeInBits()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_663' href='#L_PHI_663'><pre>663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_664' href='#L_PHI_664'><pre>664</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L_PHI_665' href='#L_PHI_665'><pre>665</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_666' href='#L_PHI_666'><pre>666</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>struct LoweredPHIRecord {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_667' href='#L_PHI_667'><pre>667</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> PHINode *PN; // The PHI that was lowered.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_668' href='#L_PHI_668'><pre>668</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned Shift; // The amount shifted.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_669' href='#L_PHI_669'><pre>669</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned Width; // The width extracted.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_670' href='#L_PHI_670'><pre>670</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_671' href='#L_PHI_671'><pre>671</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LoweredPHIRecord(PHINode *pn, unsigned Sh, Type *Ty)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_672' href='#L_PHI_672'><pre>672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : PN(pn), Shift(Sh), Width(Ty->getPrimitiveSizeInBits()) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_673' href='#L_PHI_673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_674' href='#L_PHI_674'><pre>674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // Ctor form used by DenseMap.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_675' href='#L_PHI_675'><pre>675</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> LoweredPHIRecord(PHINode *pn, unsigned Sh)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_676' href='#L_PHI_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> : PN(pn), Shift(Sh), Width(0) <span class='red'>{}</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_677' href='#L_PHI_677'><pre>677</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>};</pre></td></tr><tr><td class='line-number'><a name='L_PHI_678' href='#L_PHI_678'><pre>678</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_679' href='#L_PHI_679'><pre>679</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_680' href='#L_PHI_680'><pre>680</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>namespace llvm {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_681' href='#L_PHI_681'><pre>681</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> template<></pre></td></tr><tr><td class='line-number'><a name='L_PHI_682' href='#L_PHI_682'><pre>682</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> struct DenseMapInfo<LoweredPHIRecord> {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_683' href='#L_PHI_683'><pre>683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> static inline LoweredPHIRecord getEmptyKey() <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_684' href='#L_PHI_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LoweredPHIRecord(nullptr, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_685' href='#L_PHI_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_686' href='#L_PHI_686'><pre>686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> static inline LoweredPHIRecord getTombstoneKey() <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_687' href='#L_PHI_687'><pre>687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LoweredPHIRecord(nullptr, 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_688' href='#L_PHI_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_689' href='#L_PHI_689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> static unsigned getHashValue(const LoweredPHIRecord &Val) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_690' href='#L_PHI_690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return DenseMapInfo<PHINode*>::getHashValue(Val.PN) ^ (Val.Shift>>3) ^</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_691' href='#L_PHI_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> (Val.Width>>3);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_692' href='#L_PHI_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_693' href='#L_PHI_693'><pre>693</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> static bool isEqual(const LoweredPHIRecord &LHS,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_694' href='#L_PHI_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> const LoweredPHIRecord &RHS) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_695' href='#L_PHI_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return LHS.PN == RHS.PN && </span><span class='red'>LHS.Shift == RHS.Shift</span><span class='red'> &&</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_696' href='#L_PHI_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LHS.Width == RHS.Width</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_697' href='#L_PHI_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_698' href='#L_PHI_698'><pre>698</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_PHI_699' href='#L_PHI_699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_PHI_700' href='#L_PHI_700'><pre>700</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_701' href='#L_PHI_701'><pre>701</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_702' href='#L_PHI_702'><pre>702</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is an integer PHI and we know that it has an illegal type: see if it is</pre></td></tr><tr><td class='line-number'><a name='L_PHI_703' href='#L_PHI_703'><pre>703</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// only used by trunc or trunc(lshr) operations. If so, we split the PHI into</pre></td></tr><tr><td class='line-number'><a name='L_PHI_704' href='#L_PHI_704'><pre>704</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the various pieces being extracted. This sort of thing is introduced when</pre></td></tr><tr><td class='line-number'><a name='L_PHI_705' href='#L_PHI_705'><pre>705</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// SROA promotes an aggregate to large integer values.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_706' href='#L_PHI_706'><pre>706</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_PHI_707' href='#L_PHI_707'><pre>707</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// TODO: The user of the trunc may be an bitcast to float/double/vector or an</pre></td></tr><tr><td class='line-number'><a name='L_PHI_708' href='#L_PHI_708'><pre>708</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// inttoptr. We should produce new PHIs in the right type.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_709' href='#L_PHI_709'><pre>709</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_PHI_710' href='#L_PHI_710'><pre>710</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre>Instruction *InstCombiner::SliceUpIllegalIntegerPHI(PHINode &FirstPhi) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_711' href='#L_PHI_711'><pre>711</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // PHIUsers - Keep track of all of the truncated values extracted from a set</pre></td></tr><tr><td class='line-number'><a name='L_PHI_712' href='#L_PHI_712'><pre>712</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // of PHIs, along with their offset. These are the things we want to rewrite.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_713' href='#L_PHI_713'><pre>713</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> SmallVector<PHIUsageRecord, 16> PHIUsers;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_714' href='#L_PHI_714'><pre>714</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_715' href='#L_PHI_715'><pre>715</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // PHIs are often mutually cyclic, so we keep track of a whole set of PHI</pre></td></tr><tr><td class='line-number'><a name='L_PHI_716' href='#L_PHI_716'><pre>716</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // nodes which are extracted from. PHIsToSlice is a set we use to avoid</pre></td></tr><tr><td class='line-number'><a name='L_PHI_717' href='#L_PHI_717'><pre>717</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // revisiting PHIs, PHIsInspected is a ordered list of PHIs that we need to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_718' href='#L_PHI_718'><pre>718</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // check the uses of (to ensure they are all extracts).</pre></td></tr><tr><td class='line-number'><a name='L_PHI_719' href='#L_PHI_719'><pre>719</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> SmallVector<PHINode*, 8> PHIsToSlice;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_720' href='#L_PHI_720'><pre>720</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> SmallPtrSet<PHINode*, 8> PHIsInspected;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_721' href='#L_PHI_721'><pre>721</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_722' href='#L_PHI_722'><pre>722</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> PHIsToSlice.push_back(&FirstPhi);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_723' href='#L_PHI_723'><pre>723</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> PHIsInspected.insert(&FirstPhi);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_724' href='#L_PHI_724'><pre>724</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_725' href='#L_PHI_725'><pre>725</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> for (unsigned PHIId = 0; <div class='tooltip'>PHIId != PHIsToSlice.size()<span class='tooltip-content'>18.7k</span></div>; <div class='tooltip'>++PHIId<span class='tooltip-content'>1.82k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_726' href='#L_PHI_726'><pre>726</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> PHINode *PN = PHIsToSlice[PHIId];</pre></td></tr><tr><td class='line-number'><a name='L_PHI_727' href='#L_PHI_727'><pre>727</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_728' href='#L_PHI_728'><pre>728</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // Scan the input list of the PHI. If any input is an invoke, and if the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_729' href='#L_PHI_729'><pre>729</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // input is defined in the predecessor, then we won't be split the critical</pre></td></tr><tr><td class='line-number'><a name='L_PHI_730' href='#L_PHI_730'><pre>730</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // edge which is required to insert a truncate. Because of this, we have to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_731' href='#L_PHI_731'><pre>731</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> // bail out.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_732' href='#L_PHI_732'><pre>732</pre></a></td><td class='covered-line'><pre>70.8k</pre></td><td class='code'><pre> for (unsigned i = 0, e = PN->getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>70.8k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>52.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>52.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_733' href='#L_PHI_733'><pre>733</pre></a></td><td class='covered-line'><pre>52.1k</pre></td><td class='code'><pre> InvokeInst *II = dyn_cast<InvokeInst>(PN->getIncomingValue(i));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_734' href='#L_PHI_734'><pre>734</pre></a></td><td class='covered-line'><pre>52.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!II<span class='tooltip-content'>52.1k</span></div>) <div class='tooltip'>continue<span class='tooltip-content'>52.0k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_735' href='#L_PHI_735'><pre>735</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>142</span></div><div class='tooltip'>II->getParent() != PN->getIncomingBlock(i)<span class='tooltip-content'>142</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_736' href='#L_PHI_736'><pre>736</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_737' href='#L_PHI_737'><pre>737</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_738' href='#L_PHI_738'><pre>738</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> // If we have a phi, and if it's directly in the predecessor, then we have</pre></td></tr><tr><td class='line-number'><a name='L_PHI_739' href='#L_PHI_739'><pre>739</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> // a critical edge where we need to put the truncate. Since we can't</pre></td></tr><tr><td class='line-number'><a name='L_PHI_740' href='#L_PHI_740'><pre>740</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> // split the edge in instcombine, we have to bail out.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_741' href='#L_PHI_741'><pre>741</pre></a></td><td class='covered-line'><pre>51</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_742' href='#L_PHI_742'><pre>742</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_743' href='#L_PHI_743'><pre>743</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_744' href='#L_PHI_744'><pre>744</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> <div class='tooltip'>for (User *U : PN->users()) <span class='tooltip-content'>18.7k</span></div><div class='tooltip'>{<span class='tooltip-content'>19.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_745' href='#L_PHI_745'><pre>745</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> Instruction *UserI = cast<Instruction>(U);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_746' href='#L_PHI_746'><pre>746</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_747' href='#L_PHI_747'><pre>747</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> // If the user is a PHI, inspect its uses recursively.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_748' href='#L_PHI_748'><pre>748</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> if (PHINode *<div class='tooltip'>UserPN<span class='tooltip-content'>19.1k</span></div> = dyn_cast<PHINode>(UserI)) <div class='tooltip'>{<span class='tooltip-content'>2.27k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_749' href='#L_PHI_749'><pre>749</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> if (PHIsInspected.insert(UserPN).second)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_750' href='#L_PHI_750'><pre>750</pre></a></td><td class='covered-line'><pre>1.91k</pre></td><td class='code'><pre> PHIsToSlice.push_back(UserPN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_751' href='#L_PHI_751'><pre>751</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_752' href='#L_PHI_752'><pre>752</pre></a></td><td class='covered-line'><pre>2.27k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_753' href='#L_PHI_753'><pre>753</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_754' href='#L_PHI_754'><pre>754</pre></a></td><td class='covered-line'><pre>19.1k</pre></td><td class='code'><pre> // Truncates are always ok.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_755' href='#L_PHI_755'><pre>755</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.8k</span></div><div class='tooltip'>isa<TruncInst>(UserI)<span class='tooltip-content'>16.8k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_756' href='#L_PHI_756'><pre>756</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHIUsers.push_back(PHIUsageRecord(PHIId, 0, UserI));</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_757' href='#L_PHI_757'><pre>757</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_758' href='#L_PHI_758'><pre>758</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_759' href='#L_PHI_759'><pre>759</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_760' href='#L_PHI_760'><pre>760</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre> // Otherwise it must be a lshr which can only be used by one trunc.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_761' href='#L_PHI_761'><pre>761</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>16.8k</span></div><div class='tooltip'>UserI->getOpcode() != Instruction::LShr ||<span class='tooltip-content'>16.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_762' href='#L_PHI_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>!UserI->hasOneUse()</span><span class='tooltip-content'>0</span></div> || <div class='tooltip'><span class='red'>!isa<TruncInst>(UserI->user_back())</span><span class='tooltip-content'>0</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_PHI_763' href='#L_PHI_763'><pre>763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!isa<ConstantInt>(UserI->getOperand(1))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_764' href='#L_PHI_764'><pre>764</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_765' href='#L_PHI_765'><pre>765</pre></a></td><td class='covered-line'><pre>16.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_766' href='#L_PHI_766'><pre>766</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsigned Shift = cast<ConstantInt>(UserI->getOperand(1))->getZExtValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_767' href='#L_PHI_767'><pre>767</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHIUsers.push_back(PHIUsageRecord(PHIId, Shift, UserI->user_back()));</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_768' href='#L_PHI_768'><pre>768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_769' href='#L_PHI_769'><pre>769</pre></a></td><td class='covered-line'><pre>18.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_770' href='#L_PHI_770'><pre>770</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_771' href='#L_PHI_771'><pre>771</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If we have no users, they must be all self uses, just nuke the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_772' href='#L_PHI_772'><pre>772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PHIUsers.empty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_773' href='#L_PHI_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(FirstPhi, UndefValue::get(FirstPhi.getType()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_774' href='#L_PHI_774'><pre>774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_775' href='#L_PHI_775'><pre>775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If this phi node is transformable, create new PHIs for all the pieces</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_776' href='#L_PHI_776'><pre>776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // extracted out of it. First, sort the users by their offset and size.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_777' href='#L_PHI_777'><pre>777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>array_pod_sort(PHIUsers.begin(), PHIUsers.end());</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_778' href='#L_PHI_778'><pre>778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_779' href='#L_PHI_779'><pre>779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DEBUG</span><span class='red'>(dbgs() << "SLICING UP PHI: " << FirstPhi << '\n';</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_780' href='#L_PHI_780'><pre>780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 1, e = PHIsToSlice.size(); i != e; ++i)</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_781' href='#L_PHI_781'><pre>781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> dbgs() << "AND USER PHI #" << i << ": " << *PHIsToSlice[i] << '\n';</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_782' href='#L_PHI_782'><pre>782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> );</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_783' href='#L_PHI_783'><pre>783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_784' href='#L_PHI_784'><pre>784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PredValues - This is a temporary used when rewriting PHI nodes. It is</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_785' href='#L_PHI_785'><pre>785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // hoisted out here to avoid construction/destruction thrashing.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_786' href='#L_PHI_786'><pre>786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DenseMap<BasicBlock*, Value*> PredValues;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_787' href='#L_PHI_787'><pre>787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_788' href='#L_PHI_788'><pre>788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ExtractedVals - Each new PHI we introduce is saved here so we don't</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_789' href='#L_PHI_789'><pre>789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // introduce redundant PHIs.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_790' href='#L_PHI_790'><pre>790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DenseMap<LoweredPHIRecord, PHINode*> ExtractedVals;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_791' href='#L_PHI_791'><pre>791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_792' href='#L_PHI_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned UserI = 0, UserE = PHIUsers.size(); </span><div class='tooltip'><span class='red'>UserI != UserE</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++UserI</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_793' href='#L_PHI_793'><pre>793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned PHIId = PHIUsers[UserI].PHIId;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_794' href='#L_PHI_794'><pre>794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHINode *PN = PHIsToSlice[PHIId];</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_795' href='#L_PHI_795'><pre>795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Offset = PHIUsers[UserI].Shift;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_796' href='#L_PHI_796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Ty = PHIUsers[UserI].Inst->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_797' href='#L_PHI_797'><pre>797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_798' href='#L_PHI_798'><pre>798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHINode *EltPHI;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_799' href='#L_PHI_799'><pre>799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_800' href='#L_PHI_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we've already lowered a user like this, reuse the previously lowered</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_801' href='#L_PHI_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // value.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_802' href='#L_PHI_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>(EltPHI = ExtractedVals[LoweredPHIRecord(PN, Offset, Ty)]) == nullptr</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_803' href='#L_PHI_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_804' href='#L_PHI_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, Create the new PHI node for this user.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_805' href='#L_PHI_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltPHI = PHINode::Create(Ty, PN->getNumIncomingValues(),</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_806' href='#L_PHI_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PN->getName()+".off"+Twine(Offset), PN);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_807' href='#L_PHI_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(EltPHI->getType() != PN->getType() &&</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_808' href='#L_PHI_808'><pre>808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Truncate didn't shrink phi?");</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_809' href='#L_PHI_809'><pre>809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_810' href='#L_PHI_810'><pre>810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0, e = PN->getNumIncomingValues(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_811' href='#L_PHI_811'><pre>811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock *Pred = PN->getIncomingBlock(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_812' href='#L_PHI_812'><pre>812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *&PredVal = PredValues[Pred];</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_813' href='#L_PHI_813'><pre>813</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_814' href='#L_PHI_814'><pre>814</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we already have a value for this predecessor, reuse it.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_815' href='#L_PHI_815'><pre>815</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>PredVal</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_816' href='#L_PHI_816'><pre>816</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltPHI->addIncoming(PredVal, Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_817' href='#L_PHI_817'><pre>817</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_818' href='#L_PHI_818'><pre>818</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_819' href='#L_PHI_819'><pre>819</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_820' href='#L_PHI_820'><pre>820</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Handle the PHI self-reuse case.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_821' href='#L_PHI_821'><pre>821</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *InVal = PN->getIncomingValue(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_822' href='#L_PHI_822'><pre>822</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>InVal == PN</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_823' href='#L_PHI_823'><pre>823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PredVal = EltPHI;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_824' href='#L_PHI_824'><pre>824</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltPHI->addIncoming(PredVal, Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_825' href='#L_PHI_825'><pre>825</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_826' href='#L_PHI_826'><pre>826</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_827' href='#L_PHI_827'><pre>827</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_828' href='#L_PHI_828'><pre>828</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (PHINode *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>InPHI</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<PHINode>(PN)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_829' href='#L_PHI_829'><pre>829</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the incoming value was a PHI, and if it was one of the PHIs we</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_830' href='#L_PHI_830'><pre>830</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // already rewrote it, just use the lowered value.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_831' href='#L_PHI_831'><pre>831</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (Value *</span><div class='tooltip'><span class='red'>Res</span><span class='tooltip-content'>0</span></div><span class='red'> = ExtractedVals[LoweredPHIRecord(InPHI, Offset, Ty)]) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_832' href='#L_PHI_832'><pre>832</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PredVal = Res;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_833' href='#L_PHI_833'><pre>833</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltPHI->addIncoming(PredVal, Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_834' href='#L_PHI_834'><pre>834</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> continue;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_835' href='#L_PHI_835'><pre>835</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_836' href='#L_PHI_836'><pre>836</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_837' href='#L_PHI_837'><pre>837</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_838' href='#L_PHI_838'><pre>838</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Otherwise, do an extract in the predecessor.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_839' href='#L_PHI_839'><pre>839</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Builder->SetInsertPoint(Pred->getTerminator());</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_840' href='#L_PHI_840'><pre>840</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Res = InVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_841' href='#L_PHI_841'><pre>841</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Offset</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_842' href='#L_PHI_842'><pre>842</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Res = Builder->CreateLShr(Res, ConstantInt::get(InVal->getType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_843' href='#L_PHI_843'><pre>843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Offset), "extract")</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_844' href='#L_PHI_844'><pre>844</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Res = Builder->CreateTrunc(Res, Ty, "extract.t");</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_845' href='#L_PHI_845'><pre>845</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PredVal = Res;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_846' href='#L_PHI_846'><pre>846</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EltPHI->addIncoming(Res, Pred);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_847' href='#L_PHI_847'><pre>847</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_848' href='#L_PHI_848'><pre>848</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the incoming value was a PHI, and if it was one of the PHIs we are</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_849' href='#L_PHI_849'><pre>849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // rewriting, we will ultimately delete the code we inserted. This</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_850' href='#L_PHI_850'><pre>850</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // means we need to revisit that PHI to make sure we extract out the</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_851' href='#L_PHI_851'><pre>851</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // needed piece.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_852' href='#L_PHI_852'><pre>852</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (PHINode *</span><span class='red'>OldInVal</span><span class='red'> = dyn_cast<PHINode>(PN->getIncomingValue(i)))</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_853' href='#L_PHI_853'><pre>853</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>PHIsInspected.count(OldInVal)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_854' href='#L_PHI_854'><pre>854</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned RefPHIId =</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_855' href='#L_PHI_855'><pre>855</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> find(PHIsToSlice, OldInVal) - PHIsToSlice.begin();</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_856' href='#L_PHI_856'><pre>856</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHIUsers.push_back(PHIUsageRecord(RefPHIId, Offset,</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_857' href='#L_PHI_857'><pre>857</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> cast<Instruction>(Res)));</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_858' href='#L_PHI_858'><pre>858</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ++UserE;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_859' href='#L_PHI_859'><pre>859</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_860' href='#L_PHI_860'><pre>860</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_861' href='#L_PHI_861'><pre>861</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PredValues.clear();</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_862' href='#L_PHI_862'><pre>862</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_863' href='#L_PHI_863'><pre>863</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DEBUG</span><span class='red'>(dbgs() << " Made element PHI for offset " << Offset << ": "</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_864' href='#L_PHI_864'><pre>864</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> << *EltPHI << '\n');</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_865' href='#L_PHI_865'><pre>865</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ExtractedVals[LoweredPHIRecord(PN, Offset, Ty)] = EltPHI;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_866' href='#L_PHI_866'><pre>866</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_867' href='#L_PHI_867'><pre>867</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_868' href='#L_PHI_868'><pre>868</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace the use of this piece with the PHI node.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_869' href='#L_PHI_869'><pre>869</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replaceInstUsesWith(*PHIUsers[UserI].Inst, EltPHI);</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_870' href='#L_PHI_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_871' href='#L_PHI_871'><pre>871</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_872' href='#L_PHI_872'><pre>872</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace all the remaining uses of the PHI nodes (self uses and the lshrs)</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_873' href='#L_PHI_873'><pre>873</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // with undefs.</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_874' href='#L_PHI_874'><pre>874</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Undef = UndefValue::get(FirstPhi.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_875' href='#L_PHI_875'><pre>875</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 1, e = PHIsToSlice.size(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_876' href='#L_PHI_876'><pre>876</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>replaceInstUsesWith(*PHIsToSlice[i], Undef)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_877' href='#L_PHI_877'><pre>877</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(FirstPhi, Undef)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_878' href='#L_PHI_878'><pre>878</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_PHI_879' href='#L_PHI_879'><pre>879</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_880' href='#L_PHI_880'><pre>880</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// PHINode simplification</pre></td></tr><tr><td class='line-number'><a name='L_PHI_881' href='#L_PHI_881'><pre>881</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_PHI_882' href='#L_PHI_882'><pre>882</pre></a></td><td class='covered-line'><pre>1.05M</pre></td><td class='code'><pre>Instruction *InstCombiner::visitPHINode(PHINode &PN) {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_883' href='#L_PHI_883'><pre>883</pre></a></td><td class='covered-line'><pre>1.05M</pre></td><td class='code'><pre> if (Value *V = SimplifyInstruction(&PN, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_884' href='#L_PHI_884'><pre>884</pre></a></td><td class='covered-line'><pre>54.3k</pre></td><td class='code'><pre> return replaceInstUsesWith(PN, V);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_885' href='#L_PHI_885'><pre>885</pre></a></td><td class='covered-line'><pre>1.05M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_886' href='#L_PHI_886'><pre>886</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>997k</span></div><div class='tooltip'>Result<span class='tooltip-content'>997k</span></div> = FoldPHIArgZextsIntoPHI(PN))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_887' href='#L_PHI_887'><pre>887</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> return Result;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_888' href='#L_PHI_888'><pre>888</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_889' href='#L_PHI_889'><pre>889</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // If all PHI operands are the same operation, pull them through the PHI,</pre></td></tr><tr><td class='line-number'><a name='L_PHI_890' href='#L_PHI_890'><pre>890</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // reducing code size.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_891' href='#L_PHI_891'><pre>891</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>997k</span></div><div class='tooltip'>isa<Instruction>(PN.getIncomingValue(0)) &&<span class='tooltip-content'>997k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_892' href='#L_PHI_892'><pre>892</pre></a></td><td class='covered-line'><pre>742k</pre></td><td class='code'><pre> isa<Instruction>(PN.getIncomingValue(1)) &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_893' href='#L_PHI_893'><pre>893</pre></a></td><td class='covered-line'><pre>614k</pre></td><td class='code'><pre> cast<Instruction>(PN.getIncomingValue(0))->getOpcode() ==</pre></td></tr><tr><td class='line-number'><a name='L_PHI_894' href='#L_PHI_894'><pre>894</pre></a></td><td class='covered-line'><pre>614k</pre></td><td class='code'><pre> cast<Instruction>(PN.getIncomingValue(1))->getOpcode() &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_895' href='#L_PHI_895'><pre>895</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // FIXME: The hasOneUse check will fail for PHIs that use the value more</pre></td></tr><tr><td class='line-number'><a name='L_PHI_896' href='#L_PHI_896'><pre>896</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // than themselves more than once.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_897' href='#L_PHI_897'><pre>897</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> PN.getIncomingValue(0)->hasOneUse())</pre></td></tr><tr><td class='line-number'><a name='L_PHI_898' href='#L_PHI_898'><pre>898</pre></a></td><td class='covered-line'><pre>125k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>125k</span></div><div class='tooltip'>Result<span class='tooltip-content'>125k</span></div> = FoldPHIArgOpIntoPHI(PN))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_899' href='#L_PHI_899'><pre>899</pre></a></td><td class='covered-line'><pre>4.26k</pre></td><td class='code'><pre> return Result;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_900' href='#L_PHI_900'><pre>900</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_901' href='#L_PHI_901'><pre>901</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // If this is a trivial cycle in the PHI node graph, remove it. Basically, if</pre></td></tr><tr><td class='line-number'><a name='L_PHI_902' href='#L_PHI_902'><pre>902</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // this PHI only has a single use (a PHI), and if that PHI only has one use (a</pre></td></tr><tr><td class='line-number'><a name='L_PHI_903' href='#L_PHI_903'><pre>903</pre></a></td><td class='covered-line'><pre>997k</pre></td><td class='code'><pre> // PHI)... break the cycle.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_904' href='#L_PHI_904'><pre>904</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>993k</span></div><div class='tooltip'>PN.hasOneUse()<span class='tooltip-content'>993k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>433k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_905' href='#L_PHI_905'><pre>905</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> Instruction *PHIUser = cast<Instruction>(PN.user_back());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_906' href='#L_PHI_906'><pre>906</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> if (PHINode *<div class='tooltip'>PU<span class='tooltip-content'>433k</span></div> = dyn_cast<PHINode>(PHIUser)) <div class='tooltip'>{<span class='tooltip-content'>142k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_907' href='#L_PHI_907'><pre>907</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> SmallPtrSet<PHINode*, 16> PotentiallyDeadPHIs;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_908' href='#L_PHI_908'><pre>908</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> PotentiallyDeadPHIs.insert(&PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_909' href='#L_PHI_909'><pre>909</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> if (DeadPHICycle(PU, PotentiallyDeadPHIs))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_910' href='#L_PHI_910'><pre>910</pre></a></td><td class='covered-line'><pre>249</pre></td><td class='code'><pre> return replaceInstUsesWith(PN, UndefValue::get(PN.getType()));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_911' href='#L_PHI_911'><pre>911</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_912' href='#L_PHI_912'><pre>912</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_913' href='#L_PHI_913'><pre>913</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // If this phi has a single use, and if that use just computes a value for</pre></td></tr><tr><td class='line-number'><a name='L_PHI_914' href='#L_PHI_914'><pre>914</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // the next iteration of a loop, delete the phi. This occurs with unused</pre></td></tr><tr><td class='line-number'><a name='L_PHI_915' href='#L_PHI_915'><pre>915</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // induction variables, e.g. "for (int j = 0; ; ++j);". Detecting this</pre></td></tr><tr><td class='line-number'><a name='L_PHI_916' href='#L_PHI_916'><pre>916</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // common case here is good because the only other things that catch this</pre></td></tr><tr><td class='line-number'><a name='L_PHI_917' href='#L_PHI_917'><pre>917</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // are induction variable analysis (sometimes) and ADCE, which is only run</pre></td></tr><tr><td class='line-number'><a name='L_PHI_918' href='#L_PHI_918'><pre>918</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // late.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_919' href='#L_PHI_919'><pre>919</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>433k</span></div><div class='tooltip'>PHIUser->hasOneUse() &&<span class='tooltip-content'>433k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_920' href='#L_PHI_920'><pre>920</pre></a></td><td class='covered-line'><pre>192k</pre></td><td class='code'><pre> <div class='tooltip'>(isa<BinaryOperator>(PHIUser) || <span class='tooltip-content'>192k</span></div><div class='tooltip'>isa<GetElementPtrInst>(PHIUser)<span class='tooltip-content'>169k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_921' href='#L_PHI_921'><pre>921</pre></a></td><td class='covered-line'><pre>46.6k</pre></td><td class='code'><pre> <div class='tooltip'>PHIUser->user_back() == &PN<span class='tooltip-content'>46.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>46</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_922' href='#L_PHI_922'><pre>922</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> return replaceInstUsesWith(PN, UndefValue::get(PN.getType()));</pre></td></tr><tr><td class='line-number'><a name='L_PHI_923' href='#L_PHI_923'><pre>923</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_924' href='#L_PHI_924'><pre>924</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // When a PHI is used only to be compared with zero, it is safe to replace</pre></td></tr><tr><td class='line-number'><a name='L_PHI_925' href='#L_PHI_925'><pre>925</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // an incoming value proved as known nonzero with any non-zero constant.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_926' href='#L_PHI_926'><pre>926</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // For example, in the code below, the incoming value %v can be replaced</pre></td></tr><tr><td class='line-number'><a name='L_PHI_927' href='#L_PHI_927'><pre>927</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // with any non-zero constant based on the fact that the PHI is only used to</pre></td></tr><tr><td class='line-number'><a name='L_PHI_928' href='#L_PHI_928'><pre>928</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // be compared with zero and %v is a known non-zero value:</pre></td></tr><tr><td class='line-number'><a name='L_PHI_929' href='#L_PHI_929'><pre>929</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // %v = select %cond, 1, 2</pre></td></tr><tr><td class='line-number'><a name='L_PHI_930' href='#L_PHI_930'><pre>930</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // %p = phi [%v, BB] ...</pre></td></tr><tr><td class='line-number'><a name='L_PHI_931' href='#L_PHI_931'><pre>931</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // icmp eq, %p, 0</pre></td></tr><tr><td class='line-number'><a name='L_PHI_932' href='#L_PHI_932'><pre>932</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> auto *CmpInst = dyn_cast<ICmpInst>(PHIUser);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_933' href='#L_PHI_933'><pre>933</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> // FIXME: To be simple, handle only integer type for now.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_934' href='#L_PHI_934'><pre>934</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> if (<div class='tooltip'>CmpInst && <span class='tooltip-content'>433k</span></div><div class='tooltip'>isa<IntegerType>(PN.getType())<span class='tooltip-content'>21.6k</span></div> && <div class='tooltip'>CmpInst->isEquality()<span class='tooltip-content'>19.7k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_935' href='#L_PHI_935'><pre>935</pre></a></td><td class='covered-line'><pre>16.1k</pre></td><td class='code'><pre> <div class='tooltip'>match(CmpInst->getOperand(1), m_Zero())<span class='tooltip-content'>16.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_936' href='#L_PHI_936'><pre>936</pre></a></td><td class='covered-line'><pre>10.2k</pre></td><td class='code'><pre> ConstantInt *NonZeroConst = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_937' href='#L_PHI_937'><pre>937</pre></a></td><td class='covered-line'><pre>38.3k</pre></td><td class='code'><pre> for (unsigned i = 0, e = PN.getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>38.3k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>28.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>28.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_938' href='#L_PHI_938'><pre>938</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> Instruction *CtxI = PN.getIncomingBlock(i)->getTerminator();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_939' href='#L_PHI_939'><pre>939</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> Value *VA = PN.getIncomingValue(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_940' href='#L_PHI_940'><pre>940</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>isKnownNonZero(VA, DL, 0, &AC, CtxI, &DT)<span class='tooltip-content'>28.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.68k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_941' href='#L_PHI_941'><pre>941</pre></a></td><td class='covered-line'><pre>6.68k</pre></td><td class='code'><pre> if (!NonZeroConst)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_942' href='#L_PHI_942'><pre>942</pre></a></td><td class='covered-line'><pre>4.00k</pre></td><td class='code'><pre> NonZeroConst = GetAnyNonZeroConstInt(PN);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_943' href='#L_PHI_943'><pre>943</pre></a></td><td class='covered-line'><pre>6.68k</pre></td><td class='code'><pre> PN.setIncomingValue(i, NonZeroConst);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_944' href='#L_PHI_944'><pre>944</pre></a></td><td class='covered-line'><pre>6.68k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_945' href='#L_PHI_945'><pre>945</pre></a></td><td class='covered-line'><pre>28.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_946' href='#L_PHI_946'><pre>946</pre></a></td><td class='covered-line'><pre>10.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_947' href='#L_PHI_947'><pre>947</pre></a></td><td class='covered-line'><pre>433k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_948' href='#L_PHI_948'><pre>948</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_949' href='#L_PHI_949'><pre>949</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // We sometimes end up with phi cycles that non-obviously end up being the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_950' href='#L_PHI_950'><pre>950</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // same value, for example:</pre></td></tr><tr><td class='line-number'><a name='L_PHI_951' href='#L_PHI_951'><pre>951</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // z = some value; x = phi (y, z); y = phi (x, z)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_952' href='#L_PHI_952'><pre>952</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // where the phi nodes don't necessarily need to be in the same block. Do a</pre></td></tr><tr><td class='line-number'><a name='L_PHI_953' href='#L_PHI_953'><pre>953</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // quick check to see if the PHI node only contains a single non-phi value, if</pre></td></tr><tr><td class='line-number'><a name='L_PHI_954' href='#L_PHI_954'><pre>954</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // so, scan to see if the phi cycle is actually equal to that value.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_955' href='#L_PHI_955'><pre>955</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_PHI_956' href='#L_PHI_956'><pre>956</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> unsigned InValNo = 0, NumIncomingVals = PN.getNumIncomingValues();</pre></td></tr><tr><td class='line-number'><a name='L_PHI_957' href='#L_PHI_957'><pre>957</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // Scan for the first non-phi operand.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_958' href='#L_PHI_958'><pre>958</pre></a></td><td class='covered-line'><pre>1.48M</pre></td><td class='code'><pre> while (InValNo != NumIncomingVals &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_959' href='#L_PHI_959'><pre>959</pre></a></td><td class='covered-line'><pre>1.39M</pre></td><td class='code'><pre> isa<PHINode>(PN.getIncomingValue(InValNo)))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_960' href='#L_PHI_960'><pre>960</pre></a></td><td class='covered-line'><pre>490k</pre></td><td class='code'><pre> ++InValNo;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_961' href='#L_PHI_961'><pre>961</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_962' href='#L_PHI_962'><pre>962</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> if (<div class='tooltip'>InValNo != NumIncomingVals<span class='tooltip-content'>993k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>900k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_963' href='#L_PHI_963'><pre>963</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> Value *NonPhiInVal = PN.getIncomingValue(InValNo);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_964' href='#L_PHI_964'><pre>964</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_965' href='#L_PHI_965'><pre>965</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> // Scan the rest of the operands to see if there are any conflicts, if so</pre></td></tr><tr><td class='line-number'><a name='L_PHI_966' href='#L_PHI_966'><pre>966</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> // there is no need to recursively scan other phis.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_967' href='#L_PHI_967'><pre>967</pre></a></td><td class='covered-line'><pre>1.25M</pre></td><td class='code'><pre> for (++InValNo; <div class='tooltip'>InValNo != NumIncomingVals<span class='tooltip-content'>1.25M</span></div>; <div class='tooltip'>++InValNo<span class='tooltip-content'>349k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>977k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_968' href='#L_PHI_968'><pre>968</pre></a></td><td class='covered-line'><pre>977k</pre></td><td class='code'><pre> Value *OpVal = PN.getIncomingValue(InValNo);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_969' href='#L_PHI_969'><pre>969</pre></a></td><td class='covered-line'><pre>977k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpVal != NonPhiInVal && <span class='tooltip-content'>977k</span></div><div class='tooltip'>!isa<PHINode>(OpVal)<span class='tooltip-content'>905k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_970' href='#L_PHI_970'><pre>970</pre></a></td><td class='covered-line'><pre>627k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_971' href='#L_PHI_971'><pre>971</pre></a></td><td class='covered-line'><pre>977k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_972' href='#L_PHI_972'><pre>972</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_973' href='#L_PHI_973'><pre>973</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> // If we scanned over all operands, then we have one unique value plus</pre></td></tr><tr><td class='line-number'><a name='L_PHI_974' href='#L_PHI_974'><pre>974</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> // phi values. Scan PHI nodes to see if they all merge in each other or</pre></td></tr><tr><td class='line-number'><a name='L_PHI_975' href='#L_PHI_975'><pre>975</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> // the value.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_976' href='#L_PHI_976'><pre>976</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> if (<div class='tooltip'>InValNo == NumIncomingVals<span class='tooltip-content'>900k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>273k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_977' href='#L_PHI_977'><pre>977</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> SmallPtrSet<PHINode*, 16> ValueEqualPHIs;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_978' href='#L_PHI_978'><pre>978</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> if (PHIsEqualValue(&PN, NonPhiInVal, ValueEqualPHIs))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_979' href='#L_PHI_979'><pre>979</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> return replaceInstUsesWith(PN, NonPhiInVal);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_980' href='#L_PHI_980'><pre>980</pre></a></td><td class='covered-line'><pre>273k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_981' href='#L_PHI_981'><pre>981</pre></a></td><td class='covered-line'><pre>900k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_982' href='#L_PHI_982'><pre>982</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_983' href='#L_PHI_983'><pre>983</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_984' href='#L_PHI_984'><pre>984</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // If there are multiple PHIs, sort their operands so that they all list</pre></td></tr><tr><td class='line-number'><a name='L_PHI_985' href='#L_PHI_985'><pre>985</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // the blocks in the same order. This will help identical PHIs be eliminated</pre></td></tr><tr><td class='line-number'><a name='L_PHI_986' href='#L_PHI_986'><pre>986</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // by other passes. Other passes shouldn't depend on this for correctness</pre></td></tr><tr><td class='line-number'><a name='L_PHI_987' href='#L_PHI_987'><pre>987</pre></a></td><td class='covered-line'><pre>993k</pre></td><td class='code'><pre> // however.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_988' href='#L_PHI_988'><pre>988</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> PHINode *FirstPN = cast<PHINode>(PN.getParent()->begin());</pre></td></tr><tr><td class='line-number'><a name='L_PHI_989' href='#L_PHI_989'><pre>989</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> if (&PN != FirstPN)</pre></td></tr><tr><td class='line-number'><a name='L_PHI_990' href='#L_PHI_990'><pre>990</pre></a></td><td class='covered-line'><pre>1.52M</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 0, e = FirstPN->getNumIncomingValues(); <span class='tooltip-content'>388k</span></div><div class='tooltip'>i != e<span class='tooltip-content'>1.52M</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>1.13M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.13M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_991' href='#L_PHI_991'><pre>991</pre></a></td><td class='covered-line'><pre>1.13M</pre></td><td class='code'><pre> BasicBlock *BBA = PN.getIncomingBlock(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_992' href='#L_PHI_992'><pre>992</pre></a></td><td class='covered-line'><pre>1.13M</pre></td><td class='code'><pre> BasicBlock *BBB = FirstPN->getIncomingBlock(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_993' href='#L_PHI_993'><pre>993</pre></a></td><td class='covered-line'><pre>1.13M</pre></td><td class='code'><pre> if (<div class='tooltip'>BBA != BBB<span class='tooltip-content'>1.13M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_PHI_994' href='#L_PHI_994'><pre>994</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> Value *VA = PN.getIncomingValue(i);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_995' href='#L_PHI_995'><pre>995</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> unsigned j = PN.getBasicBlockIndex(BBB);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_996' href='#L_PHI_996'><pre>996</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> Value *VB = PN.getIncomingValue(j);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_997' href='#L_PHI_997'><pre>997</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> PN.setIncomingBlock(i, BBB);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_998' href='#L_PHI_998'><pre>998</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> PN.setIncomingValue(i, VB);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_999' href='#L_PHI_999'><pre>999</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> PN.setIncomingBlock(j, BBA);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1000' href='#L_PHI_1000'><pre>1000</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> PN.setIncomingValue(j, VA);</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1001' href='#L_PHI_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> // NOTE: Instcombine normally would want us to "return &PN" if we</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1002' href='#L_PHI_1002'><pre>1002</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> // modified any of the operands of an instruction. However, since we</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1003' href='#L_PHI_1003'><pre>1003</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> // aren't adding or removing uses (just rearranging them) we don't do</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1004' href='#L_PHI_1004'><pre>1004</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> // this in this case.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1005' href='#L_PHI_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>5.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1006' href='#L_PHI_1006'><pre>1006</pre></a></td><td class='covered-line'><pre>1.13M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1007' href='#L_PHI_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_1008' href='#L_PHI_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> // If this is an integer PHI and we know that it has an illegal type, see if</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1009' href='#L_PHI_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> // it is only used by trunc or trunc(lshr) operations. If so, we split the</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1010' href='#L_PHI_1010'><pre>1010</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> // PHI into the various pieces being extracted. This sort of thing is</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1011' href='#L_PHI_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> // introduced when SROA promotes an aggregate to a single large integer type.</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1012' href='#L_PHI_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> if (PN.getType()->isIntegerTy() &&</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1013' href='#L_PHI_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>590k</pre></td><td class='code'><pre> !DL.isLegalInteger(PN.getType()->getPrimitiveSizeInBits()))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1014' href='#L_PHI_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>16.9k</span></div><div class='tooltip'>Res<span class='tooltip-content'>16.9k</span></div> = SliceUpIllegalIntegerPHI(PN))</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1015' href='#L_PHI_1015'><pre>1015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Res</span>;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1016' href='#L_PHI_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_PHI_1017' href='#L_PHI_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_PHI_1018' href='#L_PHI_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>990k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='SELECT' href='#SELECT'>lib/Transforms/InstCombine/InstCombineSelect.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_SELECT_26'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1' href='#L_SELECT_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineSelect.cpp ----------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_2' href='#L_SELECT_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_3' href='#L_SELECT_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_4' href='#L_SELECT_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_5' href='#L_SELECT_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_6' href='#L_SELECT_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_7' href='#L_SELECT_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_8' href='#L_SELECT_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_9' href='#L_SELECT_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_10' href='#L_SELECT_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitSelect function.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_11' href='#L_SELECT_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_12' href='#L_SELECT_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_13' href='#L_SELECT_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_14' href='#L_SELECT_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_15' href='#L_SELECT_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ConstantFolding.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_16' href='#L_SELECT_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_17' href='#L_SELECT_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ValueTracking.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_18' href='#L_SELECT_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/MDBuilder.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_19' href='#L_SELECT_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_20' href='#L_SELECT_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_21' href='#L_SELECT_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_22' href='#L_SELECT_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_23' href='#L_SELECT_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_24' href='#L_SELECT_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_25' href='#L_SELECT_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static SelectPatternFlavor</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_26' href='#L_SELECT_26'><pre>26</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>getInverseMinMaxSelectPattern(SelectPatternFlavor SPF) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_27' href='#L_SELECT_27'><pre>27</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (SPF) {</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_28' href='#L_SELECT_28'><pre>28</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_29' href='#L_SELECT_29'><pre>29</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("unhandled!");</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_30' href='#L_SELECT_30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_31' href='#L_SELECT_31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_SMIN:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_32' href='#L_SELECT_32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SPF_SMAX</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_33' href='#L_SELECT_33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_UMIN:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_34' href='#L_SELECT_34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SPF_UMAX</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_35' href='#L_SELECT_35'><pre>35</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_SMAX:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_36' href='#L_SELECT_36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SPF_SMIN</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_37' href='#L_SELECT_37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_UMAX:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_38' href='#L_SELECT_38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SPF_UMIN</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_39' href='#L_SELECT_39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_40' href='#L_SELECT_40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_41' href='#L_SELECT_41'><pre>41</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_42' href='#L_SELECT_42'><pre>42</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static CmpInst::Predicate getCmpPredicateForMinMax(SelectPatternFlavor SPF,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_43' href='#L_SELECT_43'><pre>43</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> bool Ordered=false) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_44' href='#L_SELECT_44'><pre>44</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> switch (SPF) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_45' href='#L_SELECT_45'><pre>45</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>default:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_46' href='#L_SELECT_46'><pre>46</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("unhandled!");</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_47' href='#L_SELECT_47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_48' href='#L_SELECT_48'><pre>48</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre><span class='red'> </span>case SPF_SMIN:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_49' href='#L_SELECT_49'><pre>49</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return ICmpInst::ICMP_SLT<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_50' href='#L_SELECT_50'><pre>50</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre><span class='red'> </span>case SPF_UMIN:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_51' href='#L_SELECT_51'><pre>51</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return ICmpInst::ICMP_ULT<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_52' href='#L_SELECT_52'><pre>52</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre><span class='red'> </span>case SPF_SMAX:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_53' href='#L_SELECT_53'><pre>53</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return ICmpInst::ICMP_SGT<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_54' href='#L_SELECT_54'><pre>54</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre><span class='red'> </span>case SPF_UMAX:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_55' href='#L_SELECT_55'><pre>55</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return ICmpInst::ICMP_UGT<span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_56' href='#L_SELECT_56'><pre>56</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_FMINNUM:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_57' href='#L_SELECT_57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Ordered ? </span><div class='tooltip'><span class='red'>FCmpInst::FCMP_OLT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>FCmpInst::FCMP_ULT</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_58' href='#L_SELECT_58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case SPF_FMAXNUM:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_59' href='#L_SELECT_59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Ordered ? </span><div class='tooltip'><span class='red'>FCmpInst::FCMP_OGT</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>FCmpInst::FCMP_UGT</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_60' href='#L_SELECT_60'><pre>60</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_61' href='#L_SELECT_61'><pre>61</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_62' href='#L_SELECT_62'><pre>62</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_63' href='#L_SELECT_63'><pre>63</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *generateMinMaxSelectPattern(InstCombiner::BuilderTy *Builder,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_64' href='#L_SELECT_64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SelectPatternFlavor SPF, Value *A,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_65' href='#L_SELECT_65'><pre>65</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> Value *B) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_66' href='#L_SELECT_66'><pre>66</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpInst::Predicate Pred = getCmpPredicateForMinMax(SPF);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_67' href='#L_SELECT_67'><pre>67</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(CmpInst::isIntPredicate(Pred));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_68' href='#L_SELECT_68'><pre>68</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateSelect(Builder->CreateICmp(Pred, A, B), A, B);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_69' href='#L_SELECT_69'><pre>69</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_70' href='#L_SELECT_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_71' href='#L_SELECT_71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We want to turn code that looks like this:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_72' href='#L_SELECT_72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %C = or %A, %B</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_73' href='#L_SELECT_73'><pre>73</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %D = select %cond, %C, %A</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_74' href='#L_SELECT_74'><pre>74</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_75' href='#L_SELECT_75'><pre>75</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %C = select %cond, %B, 0</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_76' href='#L_SELECT_76'><pre>76</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %D = or %A, %C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_77' href='#L_SELECT_77'><pre>77</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_78' href='#L_SELECT_78'><pre>78</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Assuming that the specified instruction is an operand to the select, return</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_79' href='#L_SELECT_79'><pre>79</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// a bitmask indicating which operands of this instruction are foldable if they</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_80' href='#L_SELECT_80'><pre>80</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// equal the other incoming value of the select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_81' href='#L_SELECT_81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_82' href='#L_SELECT_82'><pre>82</pre></a></td><td class='covered-line'><pre>14.8k</pre></td><td class='code'><pre>static unsigned getSelectFoldableOperands(Instruction *I) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_83' href='#L_SELECT_83'><pre>83</pre></a></td><td class='covered-line'><pre>14.8k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_84' href='#L_SELECT_84'><pre>84</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_85' href='#L_SELECT_85'><pre>85</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_86' href='#L_SELECT_86'><pre>86</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_87' href='#L_SELECT_87'><pre>87</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_88' href='#L_SELECT_88'><pre>88</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_89' href='#L_SELECT_89'><pre>89</pre></a></td><td class='covered-line'><pre>2.35k</pre></td><td class='code'><pre> return 3; // Can fold through either operand.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_90' href='#L_SELECT_90'><pre>90</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> case Instruction::Sub: // Can only fold on the amount subtracted.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_91' href='#L_SELECT_91'><pre>91</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> case Instruction::Shl: // Can only fold on the shift amount.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_92' href='#L_SELECT_92'><pre>92</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_93' href='#L_SELECT_93'><pre>93</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_94' href='#L_SELECT_94'><pre>94</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> return 1;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_95' href='#L_SELECT_95'><pre>95</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_96' href='#L_SELECT_96'><pre>96</pre></a></td><td class='covered-line'><pre>4.13k</pre></td><td class='code'><pre> return 0; // Cannot fold</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_97' href='#L_SELECT_97'><pre>97</pre></a></td><td class='covered-line'><pre>14.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_98' href='#L_SELECT_98'><pre>98</pre></a></td><td class='covered-line'><pre>14.8k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_99' href='#L_SELECT_99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_100' href='#L_SELECT_100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For the same transformation as the previous function, return the identity</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_101' href='#L_SELECT_101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant that goes into the select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_102' href='#L_SELECT_102'><pre>102</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre>static Constant *getSelectFoldableConstant(Instruction *I) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_103' href='#L_SELECT_103'><pre>103</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_104' href='#L_SELECT_104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("This cannot happen!");</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_105' href='#L_SELECT_105'><pre>105</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre><span class='red'> </span>case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_106' href='#L_SELECT_106'><pre>106</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_107' href='#L_SELECT_107'><pre>107</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_108' href='#L_SELECT_108'><pre>108</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_109' href='#L_SELECT_109'><pre>109</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_110' href='#L_SELECT_110'><pre>110</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_111' href='#L_SELECT_111'><pre>111</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_112' href='#L_SELECT_112'><pre>112</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> return Constant::getNullValue(I->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_113' href='#L_SELECT_113'><pre>113</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_114' href='#L_SELECT_114'><pre>114</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return Constant::getAllOnesValue(I->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_115' href='#L_SELECT_115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Instruction::Mul:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_116' href='#L_SELECT_116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantInt::get(I->getType(), 1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_117' href='#L_SELECT_117'><pre>117</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_118' href='#L_SELECT_118'><pre>118</pre></a></td><td class='covered-line'><pre>1.04k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_119' href='#L_SELECT_119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_120' href='#L_SELECT_120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We have (select c, TI, FI), and we know that TI and FI have the same opcode.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_121' href='#L_SELECT_121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_122' href='#L_SELECT_122'><pre>122</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> Instruction *FI) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_123' href='#L_SELECT_123'><pre>123</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> // If this is a cast from the same type, merge.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_124' href='#L_SELECT_124'><pre>124</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>TI->getNumOperands() == 1 && <span class='tooltip-content'>21.6k</span></div><div class='tooltip'>TI->isCast()<span class='tooltip-content'>4.54k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>622</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_125' href='#L_SELECT_125'><pre>125</pre></a></td><td class='covered-line'><pre>622</pre></td><td class='code'><pre> Type *FIOpndTy = FI->getOperand(0)->getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_126' href='#L_SELECT_126'><pre>126</pre></a></td><td class='covered-line'><pre>622</pre></td><td class='code'><pre> if (TI->getOperand(0)->getType() != FIOpndTy)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_127' href='#L_SELECT_127'><pre>127</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_128' href='#L_SELECT_128'><pre>128</pre></a></td><td class='covered-line'><pre>622</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_129' href='#L_SELECT_129'><pre>129</pre></a></td><td class='covered-line'><pre>622</pre></td><td class='code'><pre> // The select condition may be a vector. We may only change the operand</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_130' href='#L_SELECT_130'><pre>130</pre></a></td><td class='covered-line'><pre>622</pre></td><td class='code'><pre> // type if the vector width remains the same (and matches the condition).</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_131' href='#L_SELECT_131'><pre>131</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> Type *CondTy = SI.getCondition()->getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_132' href='#L_SELECT_132'><pre>132</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> if (<div class='tooltip'>CondTy->isVectorTy()<span class='tooltip-content'>594</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_133' href='#L_SELECT_133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!FIOpndTy->isVectorTy()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_134' href='#L_SELECT_134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_135' href='#L_SELECT_135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CondTy->getVectorNumElements() != FIOpndTy->getVectorNumElements()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_136' href='#L_SELECT_136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_137' href='#L_SELECT_137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_138' href='#L_SELECT_138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: If the backend knew how to deal with casts better, we could</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_139' href='#L_SELECT_139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // remove this limitation. For now, there's too much potential to create</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_140' href='#L_SELECT_140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // worse codegen by promoting the select ahead of size-altering casts</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_141' href='#L_SELECT_141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (PR28160).</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_142' href='#L_SELECT_142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> //</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_143' href='#L_SELECT_143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that ValueTracking's matchSelectPattern() looks through casts</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_144' href='#L_SELECT_144'><pre>144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // without checking 'hasOneUse' when it matches min/max patterns, so this</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_145' href='#L_SELECT_145'><pre>145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // transform may end up happening anyway.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_146' href='#L_SELECT_146'><pre>146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>TI->getOpcode() != Instruction::BitCast &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_147' href='#L_SELECT_147'><pre>147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(!TI->hasOneUse() || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!FI->hasOneUse()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_148' href='#L_SELECT_148'><pre>148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_149' href='#L_SELECT_149'><pre>149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_150' href='#L_SELECT_150'><pre>150</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>594</span></div><div class='tooltip'>!TI->hasOneUse() || <span class='tooltip-content'>594</span></div><div class='tooltip'>!FI->hasOneUse()<span class='tooltip-content'>54</span></div>) <div class='tooltip'>{<span class='tooltip-content'>555</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_151' href='#L_SELECT_151'><pre>151</pre></a></td><td class='covered-line'><pre>555</pre></td><td class='code'><pre> // TODO: The one-use restrictions for a scalar select could be eased if</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_152' href='#L_SELECT_152'><pre>152</pre></a></td><td class='covered-line'><pre>555</pre></td><td class='code'><pre> // the fold of a select in visitLoadInst() was enhanced to match a pattern</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_153' href='#L_SELECT_153'><pre>153</pre></a></td><td class='covered-line'><pre>555</pre></td><td class='code'><pre> // that includes a cast.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_154' href='#L_SELECT_154'><pre>154</pre></a></td><td class='covered-line'><pre>555</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_155' href='#L_SELECT_155'><pre>155</pre></a></td><td class='covered-line'><pre>555</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_156' href='#L_SELECT_156'><pre>156</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_157' href='#L_SELECT_157'><pre>157</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> // Fold this by inserting a select from the input values.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_158' href='#L_SELECT_158'><pre>158</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> Value *NewSI =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_159' href='#L_SELECT_159'><pre>159</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> Builder->CreateSelect(SI.getCondition(), TI->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_160' href='#L_SELECT_160'><pre>160</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> FI->getOperand(0), SI.getName() + ".v", &SI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_161' href='#L_SELECT_161'><pre>161</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> return CastInst::Create(Instruction::CastOps(TI->getOpcode()), NewSI,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_162' href='#L_SELECT_162'><pre>162</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> TI->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_163' href='#L_SELECT_163'><pre>163</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_164' href='#L_SELECT_164'><pre>164</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_165' href='#L_SELECT_165'><pre>165</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> // Only handle binary operators with one-use here. As with the cast case</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_166' href='#L_SELECT_166'><pre>166</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> // above, it may be possible to relax the one-use constraint, but that needs</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_167' href='#L_SELECT_167'><pre>167</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> // be examined carefully since it may not reduce the total number of</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_168' href='#L_SELECT_168'><pre>168</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> // instructions.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_169' href='#L_SELECT_169'><pre>169</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> BinaryOperator *BO = dyn_cast<BinaryOperator>(TI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_170' href='#L_SELECT_170'><pre>170</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>!BO || <span class='tooltip-content'>21.0k</span></div><div class='tooltip'>!TI->hasOneUse()<span class='tooltip-content'>3.85k</span></div> || <div class='tooltip'>!FI->hasOneUse()<span class='tooltip-content'>2.59k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_171' href='#L_SELECT_171'><pre>171</pre></a></td><td class='covered-line'><pre>20.9k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_172' href='#L_SELECT_172'><pre>172</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_173' href='#L_SELECT_173'><pre>173</pre></a></td><td class='covered-line'><pre>21.0k</pre></td><td class='code'><pre> // Figure out if the operations have any operands in common.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_174' href='#L_SELECT_174'><pre>174</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> Value *MatchOp, *OtherOpT, *OtherOpF;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_175' href='#L_SELECT_175'><pre>175</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> bool MatchIsOpZero;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_176' href='#L_SELECT_176'><pre>176</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> if (<div class='tooltip'>TI->getOperand(0) == FI->getOperand(0)<span class='tooltip-content'>53</span></div>) <div class='tooltip'>{<span class='tooltip-content'>14</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_177' href='#L_SELECT_177'><pre>177</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> MatchOp = TI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_178' href='#L_SELECT_178'><pre>178</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> OtherOpT = TI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_179' href='#L_SELECT_179'><pre>179</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> OtherOpF = FI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_180' href='#L_SELECT_180'><pre>180</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> MatchIsOpZero = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_181' href='#L_SELECT_181'><pre>181</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>39</span></div><div class='tooltip'>TI->getOperand(1) == FI->getOperand(1)<span class='tooltip-content'>39</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_182' href='#L_SELECT_182'><pre>182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MatchOp = TI->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_183' href='#L_SELECT_183'><pre>183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OtherOpT = TI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_184' href='#L_SELECT_184'><pre>184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OtherOpF = FI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_185' href='#L_SELECT_185'><pre>185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MatchIsOpZero = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_186' href='#L_SELECT_186'><pre>186</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>39</span></div><div class='tooltip'>!TI->isCommutative()<span class='tooltip-content'>39</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_187' href='#L_SELECT_187'><pre>187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_188' href='#L_SELECT_188'><pre>188</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>39</span></div><div class='tooltip'>TI->getOperand(0) == FI->getOperand(1)<span class='tooltip-content'>39</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_189' href='#L_SELECT_189'><pre>189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MatchOp = TI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_190' href='#L_SELECT_190'><pre>190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OtherOpT = TI->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_191' href='#L_SELECT_191'><pre>191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OtherOpF = FI->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_192' href='#L_SELECT_192'><pre>192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MatchIsOpZero = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_193' href='#L_SELECT_193'><pre>193</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>39</span></div><div class='tooltip'>TI->getOperand(1) == FI->getOperand(0)<span class='tooltip-content'>39</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_194' href='#L_SELECT_194'><pre>194</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> MatchOp = TI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_195' href='#L_SELECT_195'><pre>195</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> OtherOpT = TI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_196' href='#L_SELECT_196'><pre>196</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> OtherOpF = FI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_197' href='#L_SELECT_197'><pre>197</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> MatchIsOpZero = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_198' href='#L_SELECT_198'><pre>198</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_199' href='#L_SELECT_199'><pre>199</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_200' href='#L_SELECT_200'><pre>200</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_201' href='#L_SELECT_201'><pre>201</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_202' href='#L_SELECT_202'><pre>202</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> // If we reach here, they do have operations in common.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_203' href='#L_SELECT_203'><pre>203</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *NewSI = Builder->CreateSelect(SI.getCondition(), OtherOpT, OtherOpF,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_204' href='#L_SELECT_204'><pre>204</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> SI.getName() + ".v", &SI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_205' href='#L_SELECT_205'><pre>205</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *Op0 = MatchIsOpZero ? <div class='tooltip'>MatchOp<span class='tooltip-content'>15</span></div> : <div class='tooltip'><span class='red'>NewSI</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_206' href='#L_SELECT_206'><pre>206</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Value *Op1 = MatchIsOpZero ? <div class='tooltip'>NewSI<span class='tooltip-content'>15</span></div> : <div class='tooltip'><span class='red'>MatchOp</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_207' href='#L_SELECT_207'><pre>207</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return BinaryOperator::Create(BO->getOpcode(), Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_208' href='#L_SELECT_208'><pre>208</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_209' href='#L_SELECT_209'><pre>209</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_210' href='#L_SELECT_210'><pre>210</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre>static bool isSelect01(Constant *C1, Constant *C2) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_211' href='#L_SELECT_211'><pre>211</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre> ConstantInt *C1I = dyn_cast<ConstantInt>(C1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_212' href='#L_SELECT_212'><pre>212</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre> if (!C1I)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_213' href='#L_SELECT_213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_214' href='#L_SELECT_214'><pre>214</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre> ConstantInt *C2I = dyn_cast<ConstantInt>(C2);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_215' href='#L_SELECT_215'><pre>215</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre> if (!C2I)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_216' href='#L_SELECT_216'><pre>216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_217' href='#L_SELECT_217'><pre>217</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>956</span></div><div class='tooltip'>!C1I->isZero() && <span class='tooltip-content'>956</span></div><div class='tooltip'>!C2I->isZero()<span class='tooltip-content'>25</span></div>) // One side must be zero.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_218' href='#L_SELECT_218'><pre>218</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_219' href='#L_SELECT_219'><pre>219</pre></a></td><td class='covered-line'><pre>931</pre></td><td class='code'><pre> <div class='tooltip'>return C1I->isOne() || <span class='tooltip-content'>931</span></div><div class='tooltip'>C1I->isAllOnesValue()<span class='tooltip-content'>931</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_220' href='#L_SELECT_220'><pre>220</pre></a></td><td class='covered-line'><pre>931</pre></td><td class='code'><pre> <div class='tooltip'>C2I->isOne()<span class='tooltip-content'>931</span></div> || <div class='tooltip'>C2I->isAllOnesValue()<span class='tooltip-content'>702</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_221' href='#L_SELECT_221'><pre>221</pre></a></td><td class='covered-line'><pre>956</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_222' href='#L_SELECT_222'><pre>222</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_223' href='#L_SELECT_223'><pre>223</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to fold the select into one of the operands to allow further</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_224' href='#L_SELECT_224'><pre>224</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// optimization.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_225' href='#L_SELECT_225'><pre>225</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldSelectIntoOp(SelectInst &SI, Value *TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_226' href='#L_SELECT_226'><pre>226</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre> Value *FalseVal) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_227' href='#L_SELECT_227'><pre>227</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre> // See the comment above GetSelectFoldableOperands for a description of the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_228' href='#L_SELECT_228'><pre>228</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre> // transformation we are doing here.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_229' href='#L_SELECT_229'><pre>229</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre> if (Instruction *<div class='tooltip'>TVI<span class='tooltip-content'>81.1k</span></div> = dyn_cast<Instruction>(TrueVal)) <div class='tooltip'>{<span class='tooltip-content'>54.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_230' href='#L_SELECT_230'><pre>230</pre></a></td><td class='covered-line'><pre>54.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>TVI->hasOneUse() && <span class='tooltip-content'>54.3k</span></div><div class='tooltip'>TVI->getNumOperands() == 2<span class='tooltip-content'>17.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_231' href='#L_SELECT_231'><pre>231</pre></a></td><td class='covered-line'><pre>14.2k</pre></td><td class='code'><pre> <div class='tooltip'>!isa<Constant>(FalseVal)<span class='tooltip-content'>14.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_232' href='#L_SELECT_232'><pre>232</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> if (unsigned <div class='tooltip'>SFO<span class='tooltip-content'>10.9k</span></div> = getSelectFoldableOperands(TVI)) <div class='tooltip'>{<span class='tooltip-content'>9.17k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_233' href='#L_SELECT_233'><pre>233</pre></a></td><td class='covered-line'><pre>9.17k</pre></td><td class='code'><pre> unsigned OpToFold = 0;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_234' href='#L_SELECT_234'><pre>234</pre></a></td><td class='covered-line'><pre>9.17k</pre></td><td class='code'><pre> if (<div class='tooltip'>(SFO & 1) && <span class='tooltip-content'>9.17k</span></div><div class='tooltip'>FalseVal == TVI->getOperand(0)<span class='tooltip-content'>9.17k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>613</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_235' href='#L_SELECT_235'><pre>235</pre></a></td><td class='covered-line'><pre>613</pre></td><td class='code'><pre> OpToFold = 1;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_236' href='#L_SELECT_236'><pre>236</pre></a></td><td class='covered-line'><pre>8.56k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>8.56k</span></div><div class='tooltip'>(SFO & 2) && <span class='tooltip-content'>8.56k</span></div><div class='tooltip'>FalseVal == TVI->getOperand(1)<span class='tooltip-content'>840</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_237' href='#L_SELECT_237'><pre>237</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> OpToFold = 2;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_238' href='#L_SELECT_238'><pre>238</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_239' href='#L_SELECT_239'><pre>239</pre></a></td><td class='covered-line'><pre>9.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_240' href='#L_SELECT_240'><pre>240</pre></a></td><td class='covered-line'><pre>9.17k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpToFold<span class='tooltip-content'>9.17k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>615</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_241' href='#L_SELECT_241'><pre>241</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> Constant *C = getSelectFoldableConstant(TVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_242' href='#L_SELECT_242'><pre>242</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> Value *OOp = TVI->getOperand(2-OpToFold);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_243' href='#L_SELECT_243'><pre>243</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> // Avoid creating select between 2 constants unless it's selecting</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_244' href='#L_SELECT_244'><pre>244</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> // between 0, 1 and -1.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_245' href='#L_SELECT_245'><pre>245</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<Constant>(OOp) || <span class='tooltip-content'>615</span></div><div class='tooltip'>isSelect01(C, cast<Constant>(OOp))<span class='tooltip-content'>596</span></div>) <div class='tooltip'>{<span class='tooltip-content'>162</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_246' href='#L_SELECT_246'><pre>246</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> Value *NewSel = Builder->CreateSelect(SI.getCondition(), OOp, C);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_247' href='#L_SELECT_247'><pre>247</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> NewSel->takeName(TVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_248' href='#L_SELECT_248'><pre>248</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> BinaryOperator *TVI_BO = cast<BinaryOperator>(TVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_249' href='#L_SELECT_249'><pre>249</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::Create(TVI_BO->getOpcode(),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_250' href='#L_SELECT_250'><pre>250</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> FalseVal, NewSel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_251' href='#L_SELECT_251'><pre>251</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> BO->copyIRFlags(TVI_BO);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_252' href='#L_SELECT_252'><pre>252</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_253' href='#L_SELECT_253'><pre>253</pre></a></td><td class='covered-line'><pre>162</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_254' href='#L_SELECT_254'><pre>254</pre></a></td><td class='covered-line'><pre>615</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_255' href='#L_SELECT_255'><pre>255</pre></a></td><td class='covered-line'><pre>9.17k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_256' href='#L_SELECT_256'><pre>256</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_257' href='#L_SELECT_257'><pre>257</pre></a></td><td class='covered-line'><pre>54.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_258' href='#L_SELECT_258'><pre>258</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_259' href='#L_SELECT_259'><pre>259</pre></a></td><td class='covered-line'><pre>81.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>81.0k</span></div><div class='tooltip'>FVI<span class='tooltip-content'>81.0k</span></div> = dyn_cast<Instruction>(FalseVal)) <div class='tooltip'>{<span class='tooltip-content'>51.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_260' href='#L_SELECT_260'><pre>260</pre></a></td><td class='covered-line'><pre>51.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>FVI->hasOneUse() && <span class='tooltip-content'>51.3k</span></div><div class='tooltip'>FVI->getNumOperands() == 2<span class='tooltip-content'>13.6k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_261' href='#L_SELECT_261'><pre>261</pre></a></td><td class='covered-line'><pre>7.34k</pre></td><td class='code'><pre> <div class='tooltip'>!isa<Constant>(TrueVal)<span class='tooltip-content'>7.34k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.96k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_262' href='#L_SELECT_262'><pre>262</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> if (unsigned <div class='tooltip'>SFO<span class='tooltip-content'>3.96k</span></div> = getSelectFoldableOperands(FVI)) <div class='tooltip'>{<span class='tooltip-content'>1.56k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_263' href='#L_SELECT_263'><pre>263</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> unsigned OpToFold = 0;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_264' href='#L_SELECT_264'><pre>264</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> if (<div class='tooltip'>(SFO & 1) && <span class='tooltip-content'>1.56k</span></div><div class='tooltip'>TrueVal == FVI->getOperand(0)<span class='tooltip-content'>1.56k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>393</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_265' href='#L_SELECT_265'><pre>265</pre></a></td><td class='covered-line'><pre>393</pre></td><td class='code'><pre> OpToFold = 1;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_266' href='#L_SELECT_266'><pre>266</pre></a></td><td class='covered-line'><pre>1.17k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>1.17k</span></div><div class='tooltip'>(SFO & 2) && <span class='tooltip-content'>1.17k</span></div><div class='tooltip'>TrueVal == FVI->getOperand(1)<span class='tooltip-content'>652</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_267' href='#L_SELECT_267'><pre>267</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> OpToFold = 2;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_268' href='#L_SELECT_268'><pre>268</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_269' href='#L_SELECT_269'><pre>269</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_270' href='#L_SELECT_270'><pre>270</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> if (<div class='tooltip'>OpToFold<span class='tooltip-content'>1.56k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>427</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_271' href='#L_SELECT_271'><pre>271</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> Constant *C = getSelectFoldableConstant(FVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_272' href='#L_SELECT_272'><pre>272</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> Value *OOp = FVI->getOperand(2-OpToFold);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_273' href='#L_SELECT_273'><pre>273</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> // Avoid creating select between 2 constants unless it's selecting</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_274' href='#L_SELECT_274'><pre>274</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> // between 0, 1 and -1.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_275' href='#L_SELECT_275'><pre>275</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> if (<div class='tooltip'>!isa<Constant>(OOp) || <span class='tooltip-content'>427</span></div><div class='tooltip'>isSelect01(C, cast<Constant>(OOp))<span class='tooltip-content'>360</span></div>) <div class='tooltip'>{<span class='tooltip-content'>209</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_276' href='#L_SELECT_276'><pre>276</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> Value *NewSel = Builder->CreateSelect(SI.getCondition(), C, OOp);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_277' href='#L_SELECT_277'><pre>277</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> NewSel->takeName(FVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_278' href='#L_SELECT_278'><pre>278</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> BinaryOperator *FVI_BO = cast<BinaryOperator>(FVI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_279' href='#L_SELECT_279'><pre>279</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> BinaryOperator *BO = BinaryOperator::Create(FVI_BO->getOpcode(),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_280' href='#L_SELECT_280'><pre>280</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> TrueVal, NewSel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_281' href='#L_SELECT_281'><pre>281</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> BO->copyIRFlags(FVI_BO);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_282' href='#L_SELECT_282'><pre>282</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> return BO;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_283' href='#L_SELECT_283'><pre>283</pre></a></td><td class='covered-line'><pre>209</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_284' href='#L_SELECT_284'><pre>284</pre></a></td><td class='covered-line'><pre>427</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_285' href='#L_SELECT_285'><pre>285</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_286' href='#L_SELECT_286'><pre>286</pre></a></td><td class='covered-line'><pre>3.96k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_287' href='#L_SELECT_287'><pre>287</pre></a></td><td class='covered-line'><pre>51.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_288' href='#L_SELECT_288'><pre>288</pre></a></td><td class='covered-line'><pre>81.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_289' href='#L_SELECT_289'><pre>289</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_290' href='#L_SELECT_290'><pre>290</pre></a></td><td class='covered-line'><pre>81.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_291' href='#L_SELECT_291'><pre>291</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_292' href='#L_SELECT_292'><pre>292</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We want to turn:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_293' href='#L_SELECT_293'><pre>293</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (select (icmp eq (and X, C1), 0), Y, (or Y, C2))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_294' href='#L_SELECT_294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_295' href='#L_SELECT_295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// (or (shl (and X, C1), C3), y)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_296' href='#L_SELECT_296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// iff:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_297' href='#L_SELECT_297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// C1 and C2 are both powers of 2</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_298' href='#L_SELECT_298'><pre>298</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_299' href='#L_SELECT_299'><pre>299</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// C3 = Log(C2) - Log(C1)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_300' href='#L_SELECT_300'><pre>300</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_301' href='#L_SELECT_301'><pre>301</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This transform handles cases where:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_302' href='#L_SELECT_302'><pre>302</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 1. The icmp predicate is inverted</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_303' href='#L_SELECT_303'><pre>303</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 2. The select operands are reversed</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_304' href='#L_SELECT_304'><pre>304</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 3. The magnitude of C2 and C1 are flipped</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_305' href='#L_SELECT_305'><pre>305</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *foldSelectICmpAndOr(const SelectInst &SI, Value *TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_306' href='#L_SELECT_306'><pre>306</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *FalseVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_307' href='#L_SELECT_307'><pre>307</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_308' href='#L_SELECT_308'><pre>308</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> const ICmpInst *IC = dyn_cast<ICmpInst>(SI.getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_309' href='#L_SELECT_309'><pre>309</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>!IC || <span class='tooltip-content'>85.3k</span></div><div class='tooltip'>!IC->isEquality()<span class='tooltip-content'>85.3k</span></div> || <div class='tooltip'>!SI.getType()->isIntegerTy()<span class='tooltip-content'>38.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_310' href='#L_SELECT_310'><pre>310</pre></a></td><td class='covered-line'><pre>59.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_311' href='#L_SELECT_311'><pre>311</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_312' href='#L_SELECT_312'><pre>312</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> Value *CmpLHS = IC->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_313' href='#L_SELECT_313'><pre>313</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> Value *CmpRHS = IC->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_314' href='#L_SELECT_314'><pre>314</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_315' href='#L_SELECT_315'><pre>315</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre> if (!match(CmpRHS, m_Zero()))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_316' href='#L_SELECT_316'><pre>316</pre></a></td><td class='covered-line'><pre>7.03k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_317' href='#L_SELECT_317'><pre>317</pre></a></td><td class='covered-line'><pre>25.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_318' href='#L_SELECT_318'><pre>318</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_319' href='#L_SELECT_319'><pre>319</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> const APInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_320' href='#L_SELECT_320'><pre>320</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre> if (!match(CmpLHS, m_And(m_Value(X), m_Power2(C1))))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_321' href='#L_SELECT_321'><pre>321</pre></a></td><td class='covered-line'><pre>16.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_322' href='#L_SELECT_322'><pre>322</pre></a></td><td class='covered-line'><pre>18.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_323' href='#L_SELECT_323'><pre>323</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> const APInt *C2;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_324' href='#L_SELECT_324'><pre>324</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> bool OrOnTrueVal = false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_325' href='#L_SELECT_325'><pre>325</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> bool OrOnFalseVal = match(FalseVal, m_Or(m_Specific(TrueVal), m_Power2(C2)));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_326' href='#L_SELECT_326'><pre>326</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> if (!OrOnFalseVal)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_327' href='#L_SELECT_327'><pre>327</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> OrOnTrueVal = match(TrueVal, m_Or(m_Specific(FalseVal), m_Power2(C2)));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_328' href='#L_SELECT_328'><pre>328</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_329' href='#L_SELECT_329'><pre>329</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> if (<div class='tooltip'>!OrOnFalseVal && <span class='tooltip-content'>1.86k</span></div><div class='tooltip'>!OrOnTrueVal<span class='tooltip-content'>1.86k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_330' href='#L_SELECT_330'><pre>330</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_331' href='#L_SELECT_331'><pre>331</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_332' href='#L_SELECT_332'><pre>332</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> Value *V = CmpLHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_333' href='#L_SELECT_333'><pre>333</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *Y = OrOnFalseVal ? <div class='tooltip'>TrueVal<span class='tooltip-content'>3</span></div> : <div class='tooltip'>FalseVal<span class='tooltip-content'>1</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_334' href='#L_SELECT_334'><pre>334</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_335' href='#L_SELECT_335'><pre>335</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> unsigned C1Log = C1->logBase2();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_336' href='#L_SELECT_336'><pre>336</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> unsigned C2Log = C2->logBase2();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_337' href='#L_SELECT_337'><pre>337</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (<div class='tooltip'>C2Log > C1Log<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_338' href='#L_SELECT_338'><pre>338</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> V = Builder->CreateZExtOrTrunc(V, Y->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_339' href='#L_SELECT_339'><pre>339</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> V = Builder->CreateShl(V, C2Log - C1Log);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_340' href='#L_SELECT_340'><pre>340</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>C1Log > C2Log<span class='tooltip-content'>1</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_341' href='#L_SELECT_341'><pre>341</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> V = Builder->CreateLShr(V, C1Log - C2Log);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_342' href='#L_SELECT_342'><pre>342</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> V = Builder->CreateZExtOrTrunc(V, Y->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_343' href='#L_SELECT_343'><pre>343</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> } else</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_344' href='#L_SELECT_344'><pre>344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateZExtOrTrunc(V, Y->getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_345' href='#L_SELECT_345'><pre>345</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_346' href='#L_SELECT_346'><pre>346</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = IC->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_347' href='#L_SELECT_347'><pre>347</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (<div class='tooltip'>(Pred == ICmpInst::ICMP_NE && <span class='tooltip-content'>4</span></div><div class='tooltip'>OrOnFalseVal<span class='tooltip-content'>1</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_348' href='#L_SELECT_348'><pre>348</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> <div class='tooltip'>(Pred == ICmpInst::ICMP_EQ && <span class='tooltip-content'>4</span></div><div class='tooltip'>OrOnTrueVal<span class='tooltip-content'>3</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_349' href='#L_SELECT_349'><pre>349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateXor(V, *C2)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_350' href='#L_SELECT_350'><pre>350</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_351' href='#L_SELECT_351'><pre>351</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return Builder->CreateOr(V, Y);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_352' href='#L_SELECT_352'><pre>352</pre></a></td><td class='covered-line'><pre>1.86k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_353' href='#L_SELECT_353'><pre>353</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_354' href='#L_SELECT_354'><pre>354</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Attempt to fold a cttz/ctlz followed by a icmp plus select into a single</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_355' href='#L_SELECT_355'><pre>355</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// call to cttz/ctlz with flag 'is_zero_undef' cleared.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_356' href='#L_SELECT_356'><pre>356</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_357' href='#L_SELECT_357'><pre>357</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// For example, we can fold the following code sequence:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_358' href='#L_SELECT_358'><pre>358</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \code</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_359' href='#L_SELECT_359'><pre>359</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 true)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_360' href='#L_SELECT_360'><pre>360</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %1 = icmp ne i32 %x, 0</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_361' href='#L_SELECT_361'><pre>361</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %2 = select i1 %1, i32 %0, i32 32</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_362' href='#L_SELECT_362'><pre>362</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// \code</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_363' href='#L_SELECT_363'><pre>363</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_364' href='#L_SELECT_364'><pre>364</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// into:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_365' href='#L_SELECT_365'><pre>365</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %0 = tail call i32 @llvm.cttz.i32(i32 %x, i1 false)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_366' href='#L_SELECT_366'><pre>366</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *foldSelectCttzCtlz(ICmpInst *ICI, Value *TrueVal, Value *FalseVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_367' href='#L_SELECT_367'><pre>367</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_368' href='#L_SELECT_368'><pre>368</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = ICI->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_369' href='#L_SELECT_369'><pre>369</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpLHS = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_370' href='#L_SELECT_370'><pre>370</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpRHS = ICI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_371' href='#L_SELECT_371'><pre>371</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_372' href='#L_SELECT_372'><pre>372</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // Check if the condition value compares a value for equality against zero.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_373' href='#L_SELECT_373'><pre>373</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>!ICI->isEquality() || <span class='tooltip-content'>85.3k</span></div><div class='tooltip'>!match(CmpRHS, m_Zero())<span class='tooltip-content'>38.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_374' href='#L_SELECT_374'><pre>374</pre></a></td><td class='covered-line'><pre>57.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_375' href='#L_SELECT_375'><pre>375</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_376' href='#L_SELECT_376'><pre>376</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> Value *Count = FalseVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_377' href='#L_SELECT_377'><pre>377</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> Value *ValueOnZero = TrueVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_378' href='#L_SELECT_378'><pre>378</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> if (Pred == ICmpInst::ICMP_NE)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_379' href='#L_SELECT_379'><pre>379</pre></a></td><td class='covered-line'><pre>8.30k</pre></td><td class='code'><pre> std::swap(Count, ValueOnZero);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_380' href='#L_SELECT_380'><pre>380</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_381' href='#L_SELECT_381'><pre>381</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // Skip zero extend/truncate.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_382' href='#L_SELECT_382'><pre>382</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> Value *V = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_383' href='#L_SELECT_383'><pre>383</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> if (match(Count, m_ZExt(m_Value(V))) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_384' href='#L_SELECT_384'><pre>384</pre></a></td><td class='covered-line'><pre>27.8k</pre></td><td class='code'><pre> match(Count, m_Trunc(m_Value(V))))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_385' href='#L_SELECT_385'><pre>385</pre></a></td><td class='covered-line'><pre>497</pre></td><td class='code'><pre> Count = V;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_386' href='#L_SELECT_386'><pre>386</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_387' href='#L_SELECT_387'><pre>387</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // Check if the value propagated on zero is a constant number equal to the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_388' href='#L_SELECT_388'><pre>388</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // sizeof in bits of 'Count'.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_389' href='#L_SELECT_389'><pre>389</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> unsigned SizeOfInBits = Count->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_390' href='#L_SELECT_390'><pre>390</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> if (!match(ValueOnZero, m_SpecificInt(SizeOfInBits)))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_391' href='#L_SELECT_391'><pre>391</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_392' href='#L_SELECT_392'><pre>392</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_393' href='#L_SELECT_393'><pre>393</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // Check that 'Count' is a call to intrinsic cttz/ctlz. Also check that the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_394' href='#L_SELECT_394'><pre>394</pre></a></td><td class='covered-line'><pre>28.3k</pre></td><td class='code'><pre> // input to the cttz/ctlz is used as LHS for the compare instruction.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_395' href='#L_SELECT_395'><pre>395</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7</span></div><div class='tooltip'>match(Count, m_Intrinsic<Intrinsic::cttz>(m_Specific(CmpLHS))) ||<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_396' href='#L_SELECT_396'><pre>396</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> <div class='tooltip'>match(Count, m_Intrinsic<Intrinsic::ctlz>(m_Specific(CmpLHS)))<span class='tooltip-content'>7</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_397' href='#L_SELECT_397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntrinsicInst *II = cast<IntrinsicInst>(Count);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_398' href='#L_SELECT_398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Explicitly clear the 'undef_on_zero' flag.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_399' href='#L_SELECT_399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntrinsicInst *NewI = cast<IntrinsicInst>(II->clone());</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_400' href='#L_SELECT_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Ty = NewI->getArgOperand(1)->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_401' href='#L_SELECT_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewI->setArgOperand(1, Constant::getNullValue(Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_402' href='#L_SELECT_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->Insert(NewI);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_403' href='#L_SELECT_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateZExtOrTrunc(NewI, ValueOnZero->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_404' href='#L_SELECT_404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_405' href='#L_SELECT_405'><pre>405</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_406' href='#L_SELECT_406'><pre>406</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_407' href='#L_SELECT_407'><pre>407</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_408' href='#L_SELECT_408'><pre>408</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_409' href='#L_SELECT_409'><pre>409</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we find and adjust an icmp+select pattern where the compare</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_410' href='#L_SELECT_410'><pre>410</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// is with a constant that can be incremented or decremented to match the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_411' href='#L_SELECT_411'><pre>411</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// minimum or maximum idiom.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_412' href='#L_SELECT_412'><pre>412</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre>static bool adjustMinMax(SelectInst &Sel, ICmpInst &Cmp) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_413' href='#L_SELECT_413'><pre>413</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = Cmp.getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_414' href='#L_SELECT_414'><pre>414</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpLHS = Cmp.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_415' href='#L_SELECT_415'><pre>415</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpRHS = Cmp.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_416' href='#L_SELECT_416'><pre>416</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *TrueVal = Sel.getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_417' href='#L_SELECT_417'><pre>417</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *FalseVal = Sel.getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_418' href='#L_SELECT_418'><pre>418</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_419' href='#L_SELECT_419'><pre>419</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // We may move or edit the compare, so make sure the select is the only user.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_420' href='#L_SELECT_420'><pre>420</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> const APInt *CmpC;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_421' href='#L_SELECT_421'><pre>421</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.hasOneUse() || <span class='tooltip-content'>85.3k</span></div><div class='tooltip'>!match(CmpRHS, m_APInt(CmpC))<span class='tooltip-content'>65.3k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_422' href='#L_SELECT_422'><pre>422</pre></a></td><td class='covered-line'><pre>41.9k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_423' href='#L_SELECT_423'><pre>423</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_424' href='#L_SELECT_424'><pre>424</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // These transforms only work for selects of integers or vector selects of</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_425' href='#L_SELECT_425'><pre>425</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // integer vectors.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_426' href='#L_SELECT_426'><pre>426</pre></a></td><td class='covered-line'><pre>43.4k</pre></td><td class='code'><pre> Type *SelTy = Sel.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_427' href='#L_SELECT_427'><pre>427</pre></a></td><td class='covered-line'><pre>43.4k</pre></td><td class='code'><pre> auto *SelEltTy = dyn_cast<IntegerType>(SelTy->getScalarType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_428' href='#L_SELECT_428'><pre>428</pre></a></td><td class='covered-line'><pre>43.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>!SelEltTy || <span class='tooltip-content'>43.4k</span></div><div class='tooltip'>SelTy->isVectorTy() != Cmp.getType()->isVectorTy()<span class='tooltip-content'>32.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_429' href='#L_SELECT_429'><pre>429</pre></a></td><td class='covered-line'><pre>10.7k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_430' href='#L_SELECT_430'><pre>430</pre></a></td><td class='covered-line'><pre>43.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_431' href='#L_SELECT_431'><pre>431</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> Constant *AdjustedRHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_432' href='#L_SELECT_432'><pre>432</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_UGT || <span class='tooltip-content'>32.6k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SGT<span class='tooltip-content'>31.8k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_433' href='#L_SELECT_433'><pre>433</pre></a></td><td class='covered-line'><pre>7.18k</pre></td><td class='code'><pre> AdjustedRHS = ConstantInt::get(CmpRHS->getType(), *CmpC + 1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_434' href='#L_SELECT_434'><pre>434</pre></a></td><td class='covered-line'><pre>25.4k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>25.4k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_ULT || <span class='tooltip-content'>25.4k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT<span class='tooltip-content'>23.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_435' href='#L_SELECT_435'><pre>435</pre></a></td><td class='covered-line'><pre>9.87k</pre></td><td class='code'><pre> AdjustedRHS = ConstantInt::get(CmpRHS->getType(), *CmpC - 1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_436' href='#L_SELECT_436'><pre>436</pre></a></td><td class='covered-line'><pre>25.4k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_437' href='#L_SELECT_437'><pre>437</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_438' href='#L_SELECT_438'><pre>438</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_439' href='#L_SELECT_439'><pre>439</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> // X > C ? X : C+1 --> X < C+1 ? C+1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_440' href='#L_SELECT_440'><pre>440</pre></a></td><td class='covered-line'><pre>32.6k</pre></td><td class='code'><pre> // X < C ? X : C-1 --> X > C-1 ? C-1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_441' href='#L_SELECT_441'><pre>441</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>17.0k</span></div><div class='tooltip'>(CmpLHS == TrueVal && <span class='tooltip-content'>17.0k</span></div><div class='tooltip'>AdjustedRHS == FalseVal<span class='tooltip-content'>8.44k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_442' href='#L_SELECT_442'><pre>442</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> <div class='tooltip'>(CmpLHS == FalseVal && <span class='tooltip-content'>17.0k</span></div><div class='tooltip'>AdjustedRHS == TrueVal<span class='tooltip-content'>3.42k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_443' href='#L_SELECT_443'><pre>443</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> ; // Nothing to do here. Values match without any sign/zero extension.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_444' href='#L_SELECT_444'><pre>444</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_445' href='#L_SELECT_445'><pre>445</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> // Types do not match. Instead of calculating this with mixed types, promote</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_446' href='#L_SELECT_446'><pre>446</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> // all to the larger type. This enables scalar evolution to analyze this</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_447' href='#L_SELECT_447'><pre>447</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> // expression.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_448' href='#L_SELECT_448'><pre>448</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>17.0k</span></div><div class='tooltip'>CmpRHS->getType()->getScalarSizeInBits() < SelEltTy->getBitWidth()<span class='tooltip-content'>17.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.38k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_449' href='#L_SELECT_449'><pre>449</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> Constant *SextRHS = ConstantExpr::getSExt(AdjustedRHS, SelTy);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_450' href='#L_SELECT_450'><pre>450</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_451' href='#L_SELECT_451'><pre>451</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_452' href='#L_SELECT_452'><pre>452</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_453' href='#L_SELECT_453'><pre>453</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_454' href='#L_SELECT_454'><pre>454</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_455' href='#L_SELECT_455'><pre>455</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(TrueVal, m_SExt(m_Specific(CmpLHS))) && <span class='tooltip-content'>1.38k</span></div><div class='tooltip'>SextRHS == FalseVal<span class='tooltip-content'>82</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_456' href='#L_SELECT_456'><pre>456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpLHS = TrueVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_457' href='#L_SELECT_457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AdjustedRHS = SextRHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_458' href='#L_SELECT_458'><pre>458</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>1.38k</span></div><div class='tooltip'>match(FalseVal, m_SExt(m_Specific(CmpLHS))) &&<span class='tooltip-content'>1.38k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_459' href='#L_SELECT_459'><pre>459</pre></a></td><td class='covered-line'><pre>308</pre></td><td class='code'><pre> <div class='tooltip'>SextRHS == TrueVal<span class='tooltip-content'>308</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_460' href='#L_SELECT_460'><pre>460</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> CmpLHS = FalseVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_461' href='#L_SELECT_461'><pre>461</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> AdjustedRHS = SextRHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_462' href='#L_SELECT_462'><pre>462</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>1.38k</span></div><div class='tooltip'>Cmp.isUnsigned()<span class='tooltip-content'>1.38k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>268</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_463' href='#L_SELECT_463'><pre>463</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> Constant *ZextRHS = ConstantExpr::getZExt(AdjustedRHS, SelTy);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_464' href='#L_SELECT_464'><pre>464</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> // X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_465' href='#L_SELECT_465'><pre>465</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> // X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_466' href='#L_SELECT_466'><pre>466</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> // zext + signed compare cannot be changed:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_467' href='#L_SELECT_467'><pre>467</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> // 0xff <s 0x00, but 0x00ff >s 0x0000</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_468' href='#L_SELECT_468'><pre>468</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> if (<div class='tooltip'>match(TrueVal, m_ZExt(m_Specific(CmpLHS))) && <span class='tooltip-content'>268</span></div><div class='tooltip'>ZextRHS == FalseVal<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_469' href='#L_SELECT_469'><pre>469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpLHS = TrueVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_470' href='#L_SELECT_470'><pre>470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AdjustedRHS = ZextRHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_471' href='#L_SELECT_471'><pre>471</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>268</span></div><div class='tooltip'>match(FalseVal, m_ZExt(m_Specific(CmpLHS))) &&<span class='tooltip-content'>268</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_472' href='#L_SELECT_472'><pre>472</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>ZextRHS == TrueVal<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_473' href='#L_SELECT_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CmpLHS = FalseVal;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_474' href='#L_SELECT_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> AdjustedRHS = ZextRHS;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_475' href='#L_SELECT_475'><pre>475</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_476' href='#L_SELECT_476'><pre>476</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_477' href='#L_SELECT_477'><pre>477</pre></a></td><td class='covered-line'><pre>268</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_478' href='#L_SELECT_478'><pre>478</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_479' href='#L_SELECT_479'><pre>479</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_480' href='#L_SELECT_480'><pre>480</pre></a></td><td class='covered-line'><pre>1.11k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_481' href='#L_SELECT_481'><pre>481</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_482' href='#L_SELECT_482'><pre>482</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_483' href='#L_SELECT_483'><pre>483</pre></a></td><td class='covered-line'><pre>15.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_484' href='#L_SELECT_484'><pre>484</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_485' href='#L_SELECT_485'><pre>485</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Pred = ICmpInst::getSwappedPredicate(Pred);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_486' href='#L_SELECT_486'><pre>486</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> CmpRHS = AdjustedRHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_487' href='#L_SELECT_487'><pre>487</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> std::swap(FalseVal, TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_488' href='#L_SELECT_488'><pre>488</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Cmp.setPredicate(Pred);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_489' href='#L_SELECT_489'><pre>489</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Cmp.setOperand(0, CmpLHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_490' href='#L_SELECT_490'><pre>490</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Cmp.setOperand(1, CmpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_491' href='#L_SELECT_491'><pre>491</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Sel.setOperand(1, TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_492' href='#L_SELECT_492'><pre>492</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Sel.setOperand(2, FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_493' href='#L_SELECT_493'><pre>493</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Sel.swapProfMetadata();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_494' href='#L_SELECT_494'><pre>494</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_495' href='#L_SELECT_495'><pre>495</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // Move the compare instruction right before the select instruction. Otherwise</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_496' href='#L_SELECT_496'><pre>496</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // the sext/zext value may be defined after the compare instruction uses it.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_497' href='#L_SELECT_497'><pre>497</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Cmp.moveBefore(&Sel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_498' href='#L_SELECT_498'><pre>498</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_499' href='#L_SELECT_499'><pre>499</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_500' href='#L_SELECT_500'><pre>500</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_501' href='#L_SELECT_501'><pre>501</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_502' href='#L_SELECT_502'><pre>502</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If this is an integer min/max (icmp + select) with a constant operand,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_503' href='#L_SELECT_503'><pre>503</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// create the canonical icmp for the min/max operation and canonicalize the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_504' href='#L_SELECT_504'><pre>504</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant to the 'false' operand of the select:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_505' href='#L_SELECT_505'><pre>505</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// select (icmp Pred X, C1), C2, X --> select (icmp Pred' X, C2), X, C2</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_506' href='#L_SELECT_506'><pre>506</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Note: if C1 != C2, this will change the icmp constant to the existing</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_507' href='#L_SELECT_507'><pre>507</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant operand of the select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_508' href='#L_SELECT_508'><pre>508</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_509' href='#L_SELECT_509'><pre>509</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>canonicalizeMinMaxWithConstant(SelectInst &Sel, ICmpInst &Cmp,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_510' href='#L_SELECT_510'><pre>510</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_511' href='#L_SELECT_511'><pre>511</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Cmp.hasOneUse() || <span class='tooltip-content'>85.5k</span></div><div class='tooltip'>!isa<Constant>(Cmp.getOperand(1))<span class='tooltip-content'>65.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_512' href='#L_SELECT_512'><pre>512</pre></a></td><td class='covered-line'><pre>39.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_513' href='#L_SELECT_513'><pre>513</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_514' href='#L_SELECT_514'><pre>514</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> // Canonicalize the compare predicate based on whether we have min or max.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_515' href='#L_SELECT_515'><pre>515</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> Value *LHS, *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_516' href='#L_SELECT_516'><pre>516</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> ICmpInst::Predicate NewPred;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_517' href='#L_SELECT_517'><pre>517</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> SelectPatternResult SPR = matchSelectPattern(&Sel, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_518' href='#L_SELECT_518'><pre>518</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> switch (SPR.Flavor) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_519' href='#L_SELECT_519'><pre>519</pre></a></td><td class='covered-line'><pre>2.56k</pre></td><td class='code'><pre> case SPF_SMIN: NewPred = ICmpInst::ICMP_SLT; break;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_520' href='#L_SELECT_520'><pre>520</pre></a></td><td class='covered-line'><pre>942</pre></td><td class='code'><pre> case SPF_UMIN: NewPred = ICmpInst::ICMP_ULT; break;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_521' href='#L_SELECT_521'><pre>521</pre></a></td><td class='covered-line'><pre>4.77k</pre></td><td class='code'><pre> case SPF_SMAX: NewPred = ICmpInst::ICMP_SGT; break;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_522' href='#L_SELECT_522'><pre>522</pre></a></td><td class='covered-line'><pre>206</pre></td><td class='code'><pre> case SPF_UMAX: NewPred = ICmpInst::ICMP_UGT; break;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_523' href='#L_SELECT_523'><pre>523</pre></a></td><td class='covered-line'><pre>37.9k</pre></td><td class='code'><pre> default: return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_524' href='#L_SELECT_524'><pre>524</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_525' href='#L_SELECT_525'><pre>525</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_526' href='#L_SELECT_526'><pre>526</pre></a></td><td class='covered-line'><pre>46.4k</pre></td><td class='code'><pre> // Is this already canonical?</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_527' href='#L_SELECT_527'><pre>527</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8.49k</span></div><div class='tooltip'>Cmp.getOperand(0) == LHS && <span class='tooltip-content'>8.49k</span></div><div class='tooltip'>Cmp.getOperand(1) == RHS<span class='tooltip-content'>8.48k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_528' href='#L_SELECT_528'><pre>528</pre></a></td><td class='covered-line'><pre>8.48k</pre></td><td class='code'><pre> Cmp.getPredicate() == NewPred)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_529' href='#L_SELECT_529'><pre>529</pre></a></td><td class='covered-line'><pre>8.29k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_530' href='#L_SELECT_530'><pre>530</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_531' href='#L_SELECT_531'><pre>531</pre></a></td><td class='covered-line'><pre>8.49k</pre></td><td class='code'><pre> // Create the canonical compare and plug it into the select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_532' href='#L_SELECT_532'><pre>532</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> Sel.setCondition(Builder.CreateICmp(NewPred, LHS, RHS));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_533' href='#L_SELECT_533'><pre>533</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_534' href='#L_SELECT_534'><pre>534</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> // If the select operands did not change, we're done.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_535' href='#L_SELECT_535'><pre>535</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> if (<div class='tooltip'>Sel.getTrueValue() == LHS && <span class='tooltip-content'>199</span></div><div class='tooltip'>Sel.getFalseValue() == RHS<span class='tooltip-content'>8</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_536' href='#L_SELECT_536'><pre>536</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return &Sel;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_537' href='#L_SELECT_537'><pre>537</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_538' href='#L_SELECT_538'><pre>538</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> // If we are swapping the select operands, swap the metadata too.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_539' href='#L_SELECT_539'><pre>539</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> assert(Sel.getTrueValue() == RHS && Sel.getFalseValue() == LHS &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_540' href='#L_SELECT_540'><pre>540</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> "Unexpected results from matchSelectPattern");</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_541' href='#L_SELECT_541'><pre>541</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> Sel.setTrueValue(LHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_542' href='#L_SELECT_542'><pre>542</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> Sel.setFalseValue(RHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_543' href='#L_SELECT_543'><pre>543</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> Sel.swapProfMetadata();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_544' href='#L_SELECT_544'><pre>544</pre></a></td><td class='covered-line'><pre>191</pre></td><td class='code'><pre> return &Sel;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_545' href='#L_SELECT_545'><pre>545</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_546' href='#L_SELECT_546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_547' href='#L_SELECT_547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Visit a SelectInst that has an ICmpInst as its first operand.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_548' href='#L_SELECT_548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldSelectInstWithICmp(SelectInst &SI,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_549' href='#L_SELECT_549'><pre>549</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> ICmpInst *ICI) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_550' href='#L_SELECT_550'><pre>550</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> if (Instruction *NewSel = canonicalizeMinMaxWithConstant(SI, *ICI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_551' href='#L_SELECT_551'><pre>551</pre></a></td><td class='covered-line'><pre>199</pre></td><td class='code'><pre> return NewSel;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_552' href='#L_SELECT_552'><pre>552</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_553' href='#L_SELECT_553'><pre>553</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> bool Changed = adjustMinMax(SI, *ICI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_554' href='#L_SELECT_554'><pre>554</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_555' href='#L_SELECT_555'><pre>555</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> ICmpInst::Predicate Pred = ICI->getPredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_556' href='#L_SELECT_556'><pre>556</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpLHS = ICI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_557' href='#L_SELECT_557'><pre>557</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *CmpRHS = ICI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_558' href='#L_SELECT_558'><pre>558</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *TrueVal = SI.getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_559' href='#L_SELECT_559'><pre>559</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *FalseVal = SI.getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_560' href='#L_SELECT_560'><pre>560</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_561' href='#L_SELECT_561'><pre>561</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // Transform (X >s -1) ? C1 : C2 --> ((X >>s 31) & (C2 - C1)) + C1</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_562' href='#L_SELECT_562'><pre>562</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // and (X <s 0) ? C2 : C1 --> ((X >>s 31) & (C2 - C1)) + C1</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_563' href='#L_SELECT_563'><pre>563</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // FIXME: Type and constness constraints could be lifted, but we have to</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_564' href='#L_SELECT_564'><pre>564</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // watch code size carefully. We should consider xor instead of</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_565' href='#L_SELECT_565'><pre>565</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // sub/add when we decide to do that.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_566' href='#L_SELECT_566'><pre>566</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (IntegerType *<div class='tooltip'>Ty<span class='tooltip-content'>85.3k</span></div> = dyn_cast<IntegerType>(CmpLHS->getType())) <div class='tooltip'>{<span class='tooltip-content'>80.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_567' href='#L_SELECT_567'><pre>567</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>TrueVal->getType() == Ty<span class='tooltip-content'>80.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>55.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_568' href='#L_SELECT_568'><pre>568</pre></a></td><td class='covered-line'><pre>55.8k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Cmp<span class='tooltip-content'>55.8k</span></div> = dyn_cast<ConstantInt>(CmpRHS)) <div class='tooltip'>{<span class='tooltip-content'>33.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_569' href='#L_SELECT_569'><pre>569</pre></a></td><td class='covered-line'><pre>33.6k</pre></td><td class='code'><pre> ConstantInt *C1 = nullptr, *C2 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_570' href='#L_SELECT_570'><pre>570</pre></a></td><td class='covered-line'><pre>33.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>33.6k</span></div><div class='tooltip'>Cmp->isAllOnesValue()<span class='tooltip-content'>6.21k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>331</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_571' href='#L_SELECT_571'><pre>571</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> C1 = dyn_cast<ConstantInt>(TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_572' href='#L_SELECT_572'><pre>572</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> C2 = dyn_cast<ConstantInt>(FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_573' href='#L_SELECT_573'><pre>573</pre></a></td><td class='covered-line'><pre>33.3k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>33.3k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>33.3k</span></div><div class='tooltip'>Cmp->isNullValue()<span class='tooltip-content'>7.93k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.65k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_574' href='#L_SELECT_574'><pre>574</pre></a></td><td class='covered-line'><pre>4.65k</pre></td><td class='code'><pre> C1 = dyn_cast<ConstantInt>(FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_575' href='#L_SELECT_575'><pre>575</pre></a></td><td class='covered-line'><pre>4.65k</pre></td><td class='code'><pre> C2 = dyn_cast<ConstantInt>(TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_576' href='#L_SELECT_576'><pre>576</pre></a></td><td class='covered-line'><pre>4.65k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_577' href='#L_SELECT_577'><pre>577</pre></a></td><td class='covered-line'><pre>33.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>C1 && <span class='tooltip-content'>33.6k</span></div><div class='tooltip'>C2<span class='tooltip-content'>140</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_578' href='#L_SELECT_578'><pre>578</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // This shift results in either -1 or 0.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_579' href='#L_SELECT_579'><pre>579</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *AShr = Builder->CreateAShr(CmpLHS, Ty->getBitWidth()-1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_580' href='#L_SELECT_580'><pre>580</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_581' href='#L_SELECT_581'><pre>581</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Check if we can express the operation with a single or.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_582' href='#L_SELECT_582'><pre>582</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (C2->isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_583' href='#L_SELECT_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SI, Builder->CreateOr(AShr, C1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_584' href='#L_SELECT_584'><pre>584</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_585' href='#L_SELECT_585'><pre>585</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(AShr, C2->getValue()-C1->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_586' href='#L_SELECT_586'><pre>586</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, Builder->CreateAdd(And, C1));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_587' href='#L_SELECT_587'><pre>587</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_588' href='#L_SELECT_588'><pre>588</pre></a></td><td class='covered-line'><pre>33.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_589' href='#L_SELECT_589'><pre>589</pre></a></td><td class='covered-line'><pre>55.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_590' href='#L_SELECT_590'><pre>590</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_591' href='#L_SELECT_591'><pre>591</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_592' href='#L_SELECT_592'><pre>592</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // NOTE: if we wanted to, this is where to detect integer MIN/MAX</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_593' href='#L_SELECT_593'><pre>593</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_594' href='#L_SELECT_594'><pre>594</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>85.3k</span></div><div class='tooltip'>CmpRHS != CmpLHS && <span class='tooltip-content'>85.3k</span></div><div class='tooltip'>isa<Constant>(CmpRHS)<span class='tooltip-content'>85.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>59.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_595' href='#L_SELECT_595'><pre>595</pre></a></td><td class='covered-line'><pre>59.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>CmpLHS == TrueVal && <span class='tooltip-content'>59.1k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_EQ<span class='tooltip-content'>8.92k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_596' href='#L_SELECT_596'><pre>596</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // Transform (X == C) ? X : Y -> (X == C) ? C : Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_597' href='#L_SELECT_597'><pre>597</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> SI.setOperand(1, CmpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_598' href='#L_SELECT_598'><pre>598</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_599' href='#L_SELECT_599'><pre>599</pre></a></td><td class='covered-line'><pre>59.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>59.1k</span></div><div class='tooltip'>CmpLHS == FalseVal && <span class='tooltip-content'>59.1k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_NE<span class='tooltip-content'>10.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_600' href='#L_SELECT_600'><pre>600</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Transform (X != C) ? Y : X -> (X != C) ? Y : C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_601' href='#L_SELECT_601'><pre>601</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> SI.setOperand(2, CmpRHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_602' href='#L_SELECT_602'><pre>602</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Changed = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_603' href='#L_SELECT_603'><pre>603</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_604' href='#L_SELECT_604'><pre>604</pre></a></td><td class='covered-line'><pre>59.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_605' href='#L_SELECT_605'><pre>605</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_606' href='#L_SELECT_606'><pre>606</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // FIXME: This code is nearly duplicated in InstSimplify. Using/refactoring</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_607' href='#L_SELECT_607'><pre>607</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> // decomposeBitTestICmp() might help.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_608' href='#L_SELECT_608'><pre>608</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_609' href='#L_SELECT_609'><pre>609</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> unsigned BitWidth =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_610' href='#L_SELECT_610'><pre>610</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> DL.getTypeSizeInBits(TrueVal->getType()->getScalarType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_611' href='#L_SELECT_611'><pre>611</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> APInt MinSignedValue = APInt::getSignBit(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_612' href='#L_SELECT_612'><pre>612</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_613' href='#L_SELECT_613'><pre>613</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> const APInt *Y, *C;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_614' href='#L_SELECT_614'><pre>614</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> bool TrueWhenUnset;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_615' href='#L_SELECT_615'><pre>615</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> bool IsBitTest = false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_616' href='#L_SELECT_616'><pre>616</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (ICmpInst::isEquality(Pred) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_617' href='#L_SELECT_617'><pre>617</pre></a></td><td class='covered-line'><pre>38.5k</pre></td><td class='code'><pre> match(CmpLHS, m_And(m_Value(X), m_Power2(Y))) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_618' href='#L_SELECT_618'><pre>618</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> <div class='tooltip'>match(CmpRHS, m_Zero())<span class='tooltip-content'>3.98k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.98k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_619' href='#L_SELECT_619'><pre>619</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> IsBitTest = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_620' href='#L_SELECT_620'><pre>620</pre></a></td><td class='covered-line'><pre>3.98k</pre></td><td class='code'><pre> TrueWhenUnset = Pred == ICmpInst::ICMP_EQ;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_621' href='#L_SELECT_621'><pre>621</pre></a></td><td class='covered-line'><pre>81.3k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>81.3k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SLT && <span class='tooltip-content'>81.3k</span></div><div class='tooltip'>match(CmpRHS, m_Zero())<span class='tooltip-content'>20.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5.29k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_622' href='#L_SELECT_622'><pre>622</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> X = CmpLHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_623' href='#L_SELECT_623'><pre>623</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> Y = &MinSignedValue;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_624' href='#L_SELECT_624'><pre>624</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> IsBitTest = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_625' href='#L_SELECT_625'><pre>625</pre></a></td><td class='covered-line'><pre>5.29k</pre></td><td class='code'><pre> TrueWhenUnset = false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_626' href='#L_SELECT_626'><pre>626</pre></a></td><td class='covered-line'><pre>76.0k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>76.0k</span></div><div class='tooltip'>Pred == ICmpInst::ICMP_SGT && <span class='tooltip-content'>76.0k</span></div><div class='tooltip'>match(CmpRHS, m_AllOnes())<span class='tooltip-content'>13.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>571</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_627' href='#L_SELECT_627'><pre>627</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> X = CmpLHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_628' href='#L_SELECT_628'><pre>628</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> Y = &MinSignedValue;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_629' href='#L_SELECT_629'><pre>629</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> IsBitTest = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_630' href='#L_SELECT_630'><pre>630</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> TrueWhenUnset = true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_631' href='#L_SELECT_631'><pre>631</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_632' href='#L_SELECT_632'><pre>632</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>IsBitTest<span class='tooltip-content'>85.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.84k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_633' href='#L_SELECT_633'><pre>633</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> Value *V = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_634' href='#L_SELECT_634'><pre>634</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> // (X & Y) == 0 ? X : X ^ Y --> X & ~Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_635' href='#L_SELECT_635'><pre>635</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> if (<div class='tooltip'>TrueWhenUnset && <span class='tooltip-content'>9.84k</span></div><div class='tooltip'>TrueVal == X<span class='tooltip-content'>3.94k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_636' href='#L_SELECT_636'><pre>636</pre></a></td><td class='covered-line'><pre>62</pre></td><td class='code'><pre> <div class='tooltip'>match(FalseVal, m_Xor(m_Specific(X), m_APInt(C)))<span class='tooltip-content'>62</span></div> && <div class='tooltip'><span class='red'>*Y == *C</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_637' href='#L_SELECT_637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateAnd(X, ~(*Y))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_638' href='#L_SELECT_638'><pre>638</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> // (X & Y) != 0 ? X ^ Y : X --> X & ~Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_639' href='#L_SELECT_639'><pre>639</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>9.84k</span></div><div class='tooltip'>!TrueWhenUnset && <span class='tooltip-content'>9.84k</span></div><div class='tooltip'>FalseVal == X<span class='tooltip-content'>5.90k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_640' href='#L_SELECT_640'><pre>640</pre></a></td><td class='covered-line'><pre>3.66k</pre></td><td class='code'><pre> <div class='tooltip'>match(TrueVal, m_Xor(m_Specific(X), m_APInt(C)))<span class='tooltip-content'>3.66k</span></div> && <div class='tooltip'>*Y == *C<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_641' href='#L_SELECT_641'><pre>641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateAnd(X, ~(*Y))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_642' href='#L_SELECT_642'><pre>642</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> // (X & Y) == 0 ? X ^ Y : X --> X | Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_643' href='#L_SELECT_643'><pre>643</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>9.84k</span></div><div class='tooltip'>TrueWhenUnset && <span class='tooltip-content'>9.84k</span></div><div class='tooltip'>FalseVal == X<span class='tooltip-content'>3.94k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_644' href='#L_SELECT_644'><pre>644</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> <div class='tooltip'>match(TrueVal, m_Xor(m_Specific(X), m_APInt(C)))<span class='tooltip-content'>13</span></div> && <div class='tooltip'><span class='red'>*Y == *C</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_645' href='#L_SELECT_645'><pre>645</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateOr(X, *Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_646' href='#L_SELECT_646'><pre>646</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> // (X & Y) != 0 ? X : X ^ Y --> X | Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_647' href='#L_SELECT_647'><pre>647</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>9.84k</span></div><div class='tooltip'>!TrueWhenUnset && <span class='tooltip-content'>9.84k</span></div><div class='tooltip'>TrueVal == X<span class='tooltip-content'>5.90k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_648' href='#L_SELECT_648'><pre>648</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> <div class='tooltip'>match(FalseVal, m_Xor(m_Specific(X), m_APInt(C)))<span class='tooltip-content'>25</span></div> && <div class='tooltip'><span class='red'>*Y == *C</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_649' href='#L_SELECT_649'><pre>649</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = Builder->CreateOr(X, *Y)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_650' href='#L_SELECT_650'><pre>650</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_651' href='#L_SELECT_651'><pre>651</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> if (V)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_652' href='#L_SELECT_652'><pre>652</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SI, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_653' href='#L_SELECT_653'><pre>653</pre></a></td><td class='covered-line'><pre>9.84k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_654' href='#L_SELECT_654'><pre>654</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_655' href='#L_SELECT_655'><pre>655</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_656' href='#L_SELECT_656'><pre>656</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>85.3k</span></div><div class='tooltip'>V<span class='tooltip-content'>85.3k</span></div> = foldSelectICmpAndOr(SI, TrueVal, FalseVal, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_657' href='#L_SELECT_657'><pre>657</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, V);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_658' href='#L_SELECT_658'><pre>658</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_659' href='#L_SELECT_659'><pre>659</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>85.3k</span></div><div class='tooltip'>V<span class='tooltip-content'>85.3k</span></div> = foldSelectCttzCtlz(ICI, TrueVal, FalseVal, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_660' href='#L_SELECT_660'><pre>660</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SI, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_661' href='#L_SELECT_661'><pre>661</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_662' href='#L_SELECT_662'><pre>662</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre> <div class='tooltip'>return Changed ? <span class='tooltip-content'>85.3k</span></div><div class='tooltip'>&SI<span class='tooltip-content'>28</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>85.2k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_663' href='#L_SELECT_663'><pre>663</pre></a></td><td class='covered-line'><pre>85.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_664' href='#L_SELECT_664'><pre>664</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_665' href='#L_SELECT_665'><pre>665</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_666' href='#L_SELECT_666'><pre>666</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// SI is a select whose condition is a PHI node (but the two may be in</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_667' href='#L_SELECT_667'><pre>667</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// different blocks). See if the true/false values (V) are live in all of the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_668' href='#L_SELECT_668'><pre>668</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// predecessor blocks of the PHI. For example, cases like this can't be mapped:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_669' href='#L_SELECT_669'><pre>669</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_670' href='#L_SELECT_670'><pre>670</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// X = phi [ C1, BB1], [C2, BB2]</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_671' href='#L_SELECT_671'><pre>671</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Y = add</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_672' href='#L_SELECT_672'><pre>672</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Z = select X, Y, 0</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_673' href='#L_SELECT_673'><pre>673</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_674' href='#L_SELECT_674'><pre>674</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// because Y is not live in BB1/BB2.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_675' href='#L_SELECT_675'><pre>675</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_676' href='#L_SELECT_676'><pre>676</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canSelectOperandBeMappingIntoPredBlock(const Value *V,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_677' href='#L_SELECT_677'><pre>677</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> const SelectInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_678' href='#L_SELECT_678'><pre>678</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> // If the value is a non-instruction value like a constant or argument, it</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_679' href='#L_SELECT_679'><pre>679</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> // can always be mapped.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_680' href='#L_SELECT_680'><pre>680</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> const Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_681' href='#L_SELECT_681'><pre>681</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>1.65k</span></div>) <div class='tooltip'>return true<span class='tooltip-content'>1.07k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_682' href='#L_SELECT_682'><pre>682</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_683' href='#L_SELECT_683'><pre>683</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> // If V is a PHI node defined in the same block as the condition PHI, we can</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_684' href='#L_SELECT_684'><pre>684</pre></a></td><td class='covered-line'><pre>1.65k</pre></td><td class='code'><pre> // map the arguments.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_685' href='#L_SELECT_685'><pre>685</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre> const PHINode *CondPHI = cast<PHINode>(SI.getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_686' href='#L_SELECT_686'><pre>686</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_687' href='#L_SELECT_687'><pre>687</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre> if (const PHINode *VP = dyn_cast<PHINode>(I))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_688' href='#L_SELECT_688'><pre>688</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>252</span></div><div class='tooltip'>VP->getParent() == CondPHI->getParent()<span class='tooltip-content'>252</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_689' href='#L_SELECT_689'><pre>689</pre></a></td><td class='covered-line'><pre>149</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_690' href='#L_SELECT_690'><pre>690</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_691' href='#L_SELECT_691'><pre>691</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre> // Otherwise, if the PHI and select are defined in the same block and if V is</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_692' href='#L_SELECT_692'><pre>692</pre></a></td><td class='covered-line'><pre>574</pre></td><td class='code'><pre> // defined in a different block, then we can transform it.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_693' href='#L_SELECT_693'><pre>693</pre></a></td><td class='covered-line'><pre>425</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>425</span></div><div class='tooltip'>SI.getParent() == CondPHI->getParent() &&<span class='tooltip-content'>425</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_694' href='#L_SELECT_694'><pre>694</pre></a></td><td class='covered-line'><pre>253</pre></td><td class='code'><pre> I->getParent() != CondPHI->getParent())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_695' href='#L_SELECT_695'><pre>695</pre></a></td><td class='covered-line'><pre>142</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_696' href='#L_SELECT_696'><pre>696</pre></a></td><td class='covered-line'><pre>425</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_697' href='#L_SELECT_697'><pre>697</pre></a></td><td class='covered-line'><pre>425</pre></td><td class='code'><pre> // Otherwise we have a 'hard' case and we can't tell without doing more</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_698' href='#L_SELECT_698'><pre>698</pre></a></td><td class='covered-line'><pre>425</pre></td><td class='code'><pre> // detailed dominator based analysis, punt.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_699' href='#L_SELECT_699'><pre>699</pre></a></td><td class='covered-line'><pre>283</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_700' href='#L_SELECT_700'><pre>700</pre></a></td><td class='covered-line'><pre>425</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_701' href='#L_SELECT_701'><pre>701</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_702' href='#L_SELECT_702'><pre>702</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We have an SPF (e.g. a min or max) of an SPF of the form:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_703' href='#L_SELECT_703'><pre>703</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// SPF2(SPF1(A, B), C)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_704' href='#L_SELECT_704'><pre>704</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::foldSPFofSPF(Instruction *Inner,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_705' href='#L_SELECT_705'><pre>705</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SelectPatternFlavor SPF1,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_706' href='#L_SELECT_706'><pre>706</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *A, Value *B,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_707' href='#L_SELECT_707'><pre>707</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction &Outer,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_708' href='#L_SELECT_708'><pre>708</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> SelectPatternFlavor SPF2, Value *C) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_709' href='#L_SELECT_709'><pre>709</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> if (Outer.getType() != Inner->getType())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_710' href='#L_SELECT_710'><pre>710</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_711' href='#L_SELECT_711'><pre>711</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_712' href='#L_SELECT_712'><pre>712</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.70k</span></div><div class='tooltip'>C == A || <span class='tooltip-content'>4.70k</span></div><div class='tooltip'>C == B<span class='tooltip-content'>4.70k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_713' href='#L_SELECT_713'><pre>713</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // MAX(MAX(A, B), B) -> MAX(A, B)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_714' href='#L_SELECT_714'><pre>714</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // MIN(MIN(a, b), a) -> MIN(a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_715' href='#L_SELECT_715'><pre>715</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> if (SPF1 == SPF2)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_716' href='#L_SELECT_716'><pre>716</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return replaceInstUsesWith(Outer, Inner);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_717' href='#L_SELECT_717'><pre>717</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_718' href='#L_SELECT_718'><pre>718</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // MAX(MIN(a, b), a) -> a</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_719' href='#L_SELECT_719'><pre>719</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // MIN(MAX(a, b), a) -> a</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_720' href='#L_SELECT_720'><pre>720</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(SPF1 == SPF_SMIN && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SPF2 == SPF_SMAX</span><span class='tooltip-content'>0</span></div><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_721' href='#L_SELECT_721'><pre>721</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(SPF1 == SPF_SMAX && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SPF2 == SPF_SMIN</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_722' href='#L_SELECT_722'><pre>722</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(SPF1 == SPF_UMIN && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SPF2 == SPF_UMAX</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_723' href='#L_SELECT_723'><pre>723</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>(SPF1 == SPF_UMAX && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>SPF2 == SPF_UMIN</span><span class='tooltip-content'>0</span></div><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_724' href='#L_SELECT_724'><pre>724</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(Outer, C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_725' href='#L_SELECT_725'><pre>725</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_726' href='#L_SELECT_726'><pre>726</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_727' href='#L_SELECT_727'><pre>727</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.70k</span></div><div class='tooltip'>SPF1 == SPF2<span class='tooltip-content'>4.70k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>594</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_728' href='#L_SELECT_728'><pre>728</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> const APInt *CB, *CC;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_729' href='#L_SELECT_729'><pre>729</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> if (<div class='tooltip'>match(B, m_APInt(CB)) && <span class='tooltip-content'>594</span></div><div class='tooltip'>match(C, m_APInt(CC))<span class='tooltip-content'>63</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_730' href='#L_SELECT_730'><pre>730</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // MIN(MIN(A, 23), 97) -> MIN(A, 23)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_731' href='#L_SELECT_731'><pre>731</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // MAX(MAX(A, 97), 23) -> MAX(A, 97)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_732' href='#L_SELECT_732'><pre>732</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (<div class='tooltip'>(SPF1 == SPF_UMIN && <span class='tooltip-content'>3</span></div><div class='tooltip'><span class='red'>CB->ule(*CC)</span><span class='tooltip-content'>0</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_733' href='#L_SELECT_733'><pre>733</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> <div class='tooltip'>(SPF1 == SPF_SMIN && <span class='tooltip-content'>3</span></div><div class='tooltip'>CB->sle(*CC)<span class='tooltip-content'>1</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_734' href='#L_SELECT_734'><pre>734</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> <div class='tooltip'>(SPF1 == SPF_UMAX && <span class='tooltip-content'>3</span></div><div class='tooltip'><span class='red'>CB->uge(*CC)</span><span class='tooltip-content'>0</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_735' href='#L_SELECT_735'><pre>735</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> <div class='tooltip'>(SPF1 == SPF_SMAX && <span class='tooltip-content'>3</span></div><div class='tooltip'>CB->sge(*CC)<span class='tooltip-content'>2</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_736' href='#L_SELECT_736'><pre>736</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return replaceInstUsesWith(Outer, Inner);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_737' href='#L_SELECT_737'><pre>737</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_738' href='#L_SELECT_738'><pre>738</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // MIN(MIN(A, 97), 23) -> MIN(A, 23)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_739' href='#L_SELECT_739'><pre>739</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // MAX(MAX(A, 23), 97) -> MAX(A, 97)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_740' href='#L_SELECT_740'><pre>740</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>(SPF1 == SPF_UMIN && <span class='tooltip-content'>1</span></div><div class='tooltip'><span class='red'>CB->ugt(*CC)</span><span class='tooltip-content'>0</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_741' href='#L_SELECT_741'><pre>741</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>(SPF1 == SPF_SMIN && <span class='tooltip-content'>1</span></div><div class='tooltip'>CB->sgt(*CC)<span class='tooltip-content'>1</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_742' href='#L_SELECT_742'><pre>742</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>(SPF1 == SPF_UMAX && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CB->ult(*CC)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span> ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_743' href='#L_SELECT_743'><pre>743</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>(SPF1 == SPF_SMAX && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CB->slt(*CC)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_744' href='#L_SELECT_744'><pre>744</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Outer.replaceUsesOfWith(Inner, A);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_745' href='#L_SELECT_745'><pre>745</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return &Outer;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_746' href='#L_SELECT_746'><pre>746</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_747' href='#L_SELECT_747'><pre>747</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_748' href='#L_SELECT_748'><pre>748</pre></a></td><td class='covered-line'><pre>594</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_749' href='#L_SELECT_749'><pre>749</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_750' href='#L_SELECT_750'><pre>750</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> // ABS(ABS(X)) -> ABS(X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_751' href='#L_SELECT_751'><pre>751</pre></a></td><td class='covered-line'><pre>4.70k</pre></td><td class='code'><pre> // NABS(NABS(X)) -> NABS(X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_752' href='#L_SELECT_752'><pre>752</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.69k</span></div><div class='tooltip'>SPF1 == SPF2 && <span class='tooltip-content'>4.69k</span></div><div class='tooltip'>(SPF1 == SPF_ABS || <span class='tooltip-content'>591</span></div><div class='tooltip'>SPF1 == SPF_NABS<span class='tooltip-content'>591</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_753' href='#L_SELECT_753'><pre>753</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(Outer, Inner);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_754' href='#L_SELECT_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_755' href='#L_SELECT_755'><pre>755</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_756' href='#L_SELECT_756'><pre>756</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // ABS(NABS(X)) -> ABS(X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_757' href='#L_SELECT_757'><pre>757</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // NABS(ABS(X)) -> NABS(X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_758' href='#L_SELECT_758'><pre>758</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.69k</span></div><div class='tooltip'>(SPF1 == SPF_ABS && <span class='tooltip-content'>4.69k</span></div><div class='tooltip'>SPF2 == SPF_NABS<span class='tooltip-content'>114</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_759' href='#L_SELECT_759'><pre>759</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> <div class='tooltip'>(SPF1 == SPF_NABS && <span class='tooltip-content'>4.69k</span></div><div class='tooltip'><span class='red'>SPF2 == SPF_ABS</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_760' href='#L_SELECT_760'><pre>760</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SelectInst *SI = cast<SelectInst>(Inner);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_761' href='#L_SELECT_761'><pre>761</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewSI =</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_762' href='#L_SELECT_762'><pre>762</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateSelect(SI->getCondition(), SI->getFalseValue(),</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_763' href='#L_SELECT_763'><pre>763</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SI->getTrueValue(), SI->getName(), SI);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_764' href='#L_SELECT_764'><pre>764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(Outer, NewSI);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_765' href='#L_SELECT_765'><pre>765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_766' href='#L_SELECT_766'><pre>766</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_767' href='#L_SELECT_767'><pre>767</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> auto IsFreeOrProfitableToInvert =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_768' href='#L_SELECT_768'><pre>768</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre> [&](Value *V, Value *&NotV, bool &ElidesXor) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_769' href='#L_SELECT_769'><pre>769</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(V, m_Not(m_Value(NotV)))<span class='tooltip-content'>4.87k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_770' href='#L_SELECT_770'><pre>770</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If V has at most 2 uses then we can get rid of the xor operation</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_771' href='#L_SELECT_771'><pre>771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // entirely.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_772' href='#L_SELECT_772'><pre>772</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ElidesXor |= !V->hasNUsesOrMore(3);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_773' href='#L_SELECT_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_774' href='#L_SELECT_774'><pre>774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_775' href='#L_SELECT_775'><pre>775</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_776' href='#L_SELECT_776'><pre>776</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.87k</span></div><div class='tooltip'>IsFreeToInvert(V, !V->hasNUsesOrMore(3))<span class='tooltip-content'>4.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>311</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_777' href='#L_SELECT_777'><pre>777</pre></a></td><td class='covered-line'><pre>311</pre></td><td class='code'><pre> NotV = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_778' href='#L_SELECT_778'><pre>778</pre></a></td><td class='covered-line'><pre>311</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_779' href='#L_SELECT_779'><pre>779</pre></a></td><td class='covered-line'><pre>311</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_780' href='#L_SELECT_780'><pre>780</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_781' href='#L_SELECT_781'><pre>781</pre></a></td><td class='covered-line'><pre>4.56k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_782' href='#L_SELECT_782'><pre>782</pre></a></td><td class='covered-line'><pre>4.87k</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_783' href='#L_SELECT_783'><pre>783</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_784' href='#L_SELECT_784'><pre>784</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> Value *NotA, *NotB, *NotC;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_785' href='#L_SELECT_785'><pre>785</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> bool ElidesXor = false;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_786' href='#L_SELECT_786'><pre>786</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_787' href='#L_SELECT_787'><pre>787</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // MIN(MIN(~A, ~B), ~C) == ~MAX(MAX(A, B), C)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_788' href='#L_SELECT_788'><pre>788</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // MIN(MAX(~A, ~B), ~C) == ~MAX(MIN(A, B), C)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_789' href='#L_SELECT_789'><pre>789</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // MAX(MIN(~A, ~B), ~C) == ~MIN(MAX(A, B), C)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_790' href='#L_SELECT_790'><pre>790</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // MAX(MAX(~A, ~B), ~C) == ~MIN(MIN(A, B), C)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_791' href='#L_SELECT_791'><pre>791</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_792' href='#L_SELECT_792'><pre>792</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // This transform is performance neutral if we can elide at least one xor from</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_793' href='#L_SELECT_793'><pre>793</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // the set of three operands, since we'll be tacking on an xor at the very</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_794' href='#L_SELECT_794'><pre>794</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> // end.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_795' href='#L_SELECT_795'><pre>795</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> if (SelectPatternResult::isMinOrMax(SPF1) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_796' href='#L_SELECT_796'><pre>796</pre></a></td><td class='covered-line'><pre>4.58k</pre></td><td class='code'><pre> SelectPatternResult::isMinOrMax(SPF2) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_797' href='#L_SELECT_797'><pre>797</pre></a></td><td class='covered-line'><pre>4.58k</pre></td><td class='code'><pre> IsFreeOrProfitableToInvert(A, NotA, ElidesXor) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_798' href='#L_SELECT_798'><pre>798</pre></a></td><td class='covered-line'><pre>232</pre></td><td class='code'><pre> IsFreeOrProfitableToInvert(B, NotB, ElidesXor) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_799' href='#L_SELECT_799'><pre>799</pre></a></td><td class='covered-line'><pre>59</pre></td><td class='code'><pre> <div class='tooltip'>IsFreeOrProfitableToInvert(C, NotC, ElidesXor)<span class='tooltip-content'>59</span></div> && <div class='tooltip'>ElidesXor<span class='tooltip-content'>20</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_800' href='#L_SELECT_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!NotA</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_801' href='#L_SELECT_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NotA = Builder->CreateNot(A)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_802' href='#L_SELECT_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!NotB</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_803' href='#L_SELECT_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NotB = Builder->CreateNot(B)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_804' href='#L_SELECT_804'><pre>804</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!NotC</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_805' href='#L_SELECT_805'><pre>805</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NotC = Builder->CreateNot(C)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_806' href='#L_SELECT_806'><pre>806</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_807' href='#L_SELECT_807'><pre>807</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewInner = generateMinMaxSelectPattern(</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_808' href='#L_SELECT_808'><pre>808</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder, getInverseMinMaxSelectPattern(SPF1), NotA, NotB);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_809' href='#L_SELECT_809'><pre>809</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewOuter = Builder->CreateNot(generateMinMaxSelectPattern(</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_810' href='#L_SELECT_810'><pre>810</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder, getInverseMinMaxSelectPattern(SPF2), NewInner, NotC));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_811' href='#L_SELECT_811'><pre>811</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(Outer, NewOuter);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_812' href='#L_SELECT_812'><pre>812</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_813' href='#L_SELECT_813'><pre>813</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_814' href='#L_SELECT_814'><pre>814</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_815' href='#L_SELECT_815'><pre>815</pre></a></td><td class='covered-line'><pre>4.69k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_816' href='#L_SELECT_816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_817' href='#L_SELECT_817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If one of the constants is zero (we know they can't both be) and we have an</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_818' href='#L_SELECT_818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// icmp instruction with zero, and we have an 'and' with the non-constant value</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_819' href='#L_SELECT_819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// and a power of two we can turn the select into a shift on the result of the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_820' href='#L_SELECT_820'><pre>820</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 'and'.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_821' href='#L_SELECT_821'><pre>821</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *foldSelectICmpAnd(const SelectInst &SI, ConstantInt *TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_822' href='#L_SELECT_822'><pre>822</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ConstantInt *FalseVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_823' href='#L_SELECT_823'><pre>823</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> InstCombiner::BuilderTy *Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_824' href='#L_SELECT_824'><pre>824</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> const ICmpInst *IC = dyn_cast<ICmpInst>(SI.getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_825' href='#L_SELECT_825'><pre>825</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>!IC || <span class='tooltip-content'>10.9k</span></div><div class='tooltip'>!IC->isEquality()<span class='tooltip-content'>8.59k</span></div> || <div class='tooltip'>!SI.getType()->isIntegerTy()<span class='tooltip-content'>6.24k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_826' href='#L_SELECT_826'><pre>826</pre></a></td><td class='covered-line'><pre>4.66k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_827' href='#L_SELECT_827'><pre>827</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_828' href='#L_SELECT_828'><pre>828</pre></a></td><td class='covered-line'><pre>6.24k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.24k</span></div><div class='tooltip'>!match(IC->getOperand(1), m_Zero())<span class='tooltip-content'>6.24k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_829' href='#L_SELECT_829'><pre>829</pre></a></td><td class='covered-line'><pre>2.89k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_830' href='#L_SELECT_830'><pre>830</pre></a></td><td class='covered-line'><pre>6.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_831' href='#L_SELECT_831'><pre>831</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> ConstantInt *AndRHS;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_832' href='#L_SELECT_832'><pre>832</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> Value *LHS = IC->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_833' href='#L_SELECT_833'><pre>833</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> if (!match(LHS, m_And(m_Value(), m_ConstantInt(AndRHS))))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_834' href='#L_SELECT_834'><pre>834</pre></a></td><td class='covered-line'><pre>2.99k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_835' href='#L_SELECT_835'><pre>835</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_836' href='#L_SELECT_836'><pre>836</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> // If both select arms are non-zero see if we have a select of the form</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_837' href='#L_SELECT_837'><pre>837</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> // 'x ? 2^n + C : C'. Then we can offset both arms by C, use the logic</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_838' href='#L_SELECT_838'><pre>838</pre></a></td><td class='covered-line'><pre>3.35k</pre></td><td class='code'><pre> // for 'x ? 2^n : 0' and fix the thing up at the end.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_839' href='#L_SELECT_839'><pre>839</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> ConstantInt *Offset = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_840' href='#L_SELECT_840'><pre>840</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> if (<div class='tooltip'>!TrueVal->isZero() && <span class='tooltip-content'>352</span></div><div class='tooltip'>!FalseVal->isZero()<span class='tooltip-content'>343</span></div>) <div class='tooltip'>{<span class='tooltip-content'>317</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_841' href='#L_SELECT_841'><pre>841</pre></a></td><td class='covered-line'><pre>317</pre></td><td class='code'><pre> if ((TrueVal->getValue() - FalseVal->getValue()).isPowerOf2())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_842' href='#L_SELECT_842'><pre>842</pre></a></td><td class='covered-line'><pre>45</pre></td><td class='code'><pre> Offset = FalseVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_843' href='#L_SELECT_843'><pre>843</pre></a></td><td class='covered-line'><pre>272</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>272</span></div><div class='tooltip'>(FalseVal->getValue() - TrueVal->getValue()).isPowerOf2()<span class='tooltip-content'>272</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_844' href='#L_SELECT_844'><pre>844</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> Offset = TrueVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_845' href='#L_SELECT_845'><pre>845</pre></a></td><td class='covered-line'><pre>272</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_846' href='#L_SELECT_846'><pre>846</pre></a></td><td class='covered-line'><pre>257</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_847' href='#L_SELECT_847'><pre>847</pre></a></td><td class='covered-line'><pre>317</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_848' href='#L_SELECT_848'><pre>848</pre></a></td><td class='covered-line'><pre>317</pre></td><td class='code'><pre> // Adjust TrueVal and FalseVal to the offset.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_849' href='#L_SELECT_849'><pre>849</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> TrueVal = ConstantInt::get(Builder->getContext(),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_850' href='#L_SELECT_850'><pre>850</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> TrueVal->getValue() - Offset->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_851' href='#L_SELECT_851'><pre>851</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> FalseVal = ConstantInt::get(Builder->getContext(),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_852' href='#L_SELECT_852'><pre>852</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> FalseVal->getValue() - Offset->getValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_853' href='#L_SELECT_853'><pre>853</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_854' href='#L_SELECT_854'><pre>854</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_855' href='#L_SELECT_855'><pre>855</pre></a></td><td class='covered-line'><pre>352</pre></td><td class='code'><pre> // Make sure the mask in the 'and' and one of the select arms is a power of 2.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_856' href='#L_SELECT_856'><pre>856</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>95</span></div><div class='tooltip'>!AndRHS->getValue().isPowerOf2() ||<span class='tooltip-content'>95</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_857' href='#L_SELECT_857'><pre>857</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> (!TrueVal->getValue().isPowerOf2() &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_858' href='#L_SELECT_858'><pre>858</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> !FalseVal->getValue().isPowerOf2()))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_859' href='#L_SELECT_859'><pre>859</pre></a></td><td class='covered-line'><pre>43</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_860' href='#L_SELECT_860'><pre>860</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_861' href='#L_SELECT_861'><pre>861</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> // Determine which shift is needed to transform result of the 'and' into the</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_862' href='#L_SELECT_862'><pre>862</pre></a></td><td class='covered-line'><pre>95</pre></td><td class='code'><pre> // desired result.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_863' href='#L_SELECT_863'><pre>863</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> <div class='tooltip'>ConstantInt *ValC = !TrueVal->isZero() ? <span class='tooltip-content'>52</span></div><div class='tooltip'>TrueVal<span class='tooltip-content'>42</span></div> : <div class='tooltip'>FalseVal<span class='tooltip-content'>10</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_864' href='#L_SELECT_864'><pre>864</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> unsigned ValZeros = ValC->getValue().logBase2();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_865' href='#L_SELECT_865'><pre>865</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> unsigned AndZeros = AndRHS->getValue().logBase2();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_866' href='#L_SELECT_866'><pre>866</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_867' href='#L_SELECT_867'><pre>867</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // If types don't match we can still convert the select by introducing a zext</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_868' href='#L_SELECT_868'><pre>868</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // or a trunc of the 'and'. The trunc case requires that all of the truncated</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_869' href='#L_SELECT_869'><pre>869</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> // bits are zero, we can figure that out by looking at the 'and' mask.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_870' href='#L_SELECT_870'><pre>870</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> if (AndZeros >= ValC->getBitWidth())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_871' href='#L_SELECT_871'><pre>871</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_872' href='#L_SELECT_872'><pre>872</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_873' href='#L_SELECT_873'><pre>873</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> Value *V = Builder->CreateZExtOrTrunc(LHS, SI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_874' href='#L_SELECT_874'><pre>874</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> if (ValZeros > AndZeros)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_875' href='#L_SELECT_875'><pre>875</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> V = Builder->CreateShl(V, ValZeros - AndZeros);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_876' href='#L_SELECT_876'><pre>876</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>17</span></div><div class='tooltip'>ValZeros < AndZeros<span class='tooltip-content'>17</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_877' href='#L_SELECT_877'><pre>877</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> V = Builder->CreateLShr(V, AndZeros - ValZeros);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_878' href='#L_SELECT_878'><pre>878</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_879' href='#L_SELECT_879'><pre>879</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> // Okay, now we know that everything is set up, we just don't know whether we</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_880' href='#L_SELECT_880'><pre>880</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> // have a icmp_ne or icmp_eq and whether the true or false val is the zero.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_881' href='#L_SELECT_881'><pre>881</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> bool ShouldNotVal = !TrueVal->isZero();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_882' href='#L_SELECT_882'><pre>882</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> ShouldNotVal ^= IC->getPredicate() == ICmpInst::ICMP_NE;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_883' href='#L_SELECT_883'><pre>883</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> if (ShouldNotVal)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_884' href='#L_SELECT_884'><pre>884</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> V = Builder->CreateXor(V, ValC);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_885' href='#L_SELECT_885'><pre>885</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_886' href='#L_SELECT_886'><pre>886</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> // Apply an offset if needed.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_887' href='#L_SELECT_887'><pre>887</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> if (Offset)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_888' href='#L_SELECT_888'><pre>888</pre></a></td><td class='covered-line'><pre>33</pre></td><td class='code'><pre> V = Builder->CreateAdd(V, Offset);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_889' href='#L_SELECT_889'><pre>889</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_890' href='#L_SELECT_890'><pre>890</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_891' href='#L_SELECT_891'><pre>891</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_892' href='#L_SELECT_892'><pre>892</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Turn select C, (X + Y), (X - Y) --> (X + (select C, Y, (-Y))).</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_893' href='#L_SELECT_893'><pre>893</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This is even legal for FP.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_894' href='#L_SELECT_894'><pre>894</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldAddSubSelect(SelectInst &SI,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_895' href='#L_SELECT_895'><pre>895</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_896' href='#L_SELECT_896'><pre>896</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> Value *CondVal = SI.getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_897' href='#L_SELECT_897'><pre>897</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> Value *TrueVal = SI.getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_898' href='#L_SELECT_898'><pre>898</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> Value *FalseVal = SI.getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_899' href='#L_SELECT_899'><pre>899</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> auto *TI = dyn_cast<Instruction>(TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_900' href='#L_SELECT_900'><pre>900</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> auto *FI = dyn_cast<Instruction>(FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_901' href='#L_SELECT_901'><pre>901</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> if (<div class='tooltip'>!TI || <span class='tooltip-content'>102k</span></div><div class='tooltip'>!FI<span class='tooltip-content'>68.4k</span></div> || <div class='tooltip'>!TI->hasOneUse()<span class='tooltip-content'>50.8k</span></div> || <div class='tooltip'>!FI->hasOneUse()<span class='tooltip-content'>19.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_902' href='#L_SELECT_902'><pre>902</pre></a></td><td class='covered-line'><pre>92.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_903' href='#L_SELECT_903'><pre>903</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_904' href='#L_SELECT_904'><pre>904</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> Instruction *AddOp = nullptr, *SubOp = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_905' href='#L_SELECT_905'><pre>905</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> if ((TI->getOpcode() == Instruction::Sub &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_906' href='#L_SELECT_906'><pre>906</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> FI->getOpcode() == Instruction::Add) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_907' href='#L_SELECT_907'><pre>907</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> (TI->getOpcode() == Instruction::FSub &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_908' href='#L_SELECT_908'><pre>908</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>FI->getOpcode() == Instruction::FAdd</span><span class='tooltip-content'>0</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>22</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_909' href='#L_SELECT_909'><pre>909</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> AddOp = FI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_910' href='#L_SELECT_910'><pre>910</pre></a></td><td class='covered-line'><pre>22</pre></td><td class='code'><pre> SubOp = TI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_911' href='#L_SELECT_911'><pre>911</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>10.5k</span></div><div class='tooltip'>(FI->getOpcode() == Instruction::Sub &&<span class='tooltip-content'>10.5k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_912' href='#L_SELECT_912'><pre>912</pre></a></td><td class='covered-line'><pre>150</pre></td><td class='code'><pre> TI->getOpcode() == Instruction::Add) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_913' href='#L_SELECT_913'><pre>913</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> (FI->getOpcode() == Instruction::FSub &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_914' href='#L_SELECT_914'><pre>914</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> <div class='tooltip'>TI->getOpcode() == Instruction::FAdd<span class='tooltip-content'>2</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>152</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_915' href='#L_SELECT_915'><pre>915</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> AddOp = TI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_916' href='#L_SELECT_916'><pre>916</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> SubOp = FI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_917' href='#L_SELECT_917'><pre>917</pre></a></td><td class='covered-line'><pre>152</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_918' href='#L_SELECT_918'><pre>918</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_919' href='#L_SELECT_919'><pre>919</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> if (<div class='tooltip'>AddOp<span class='tooltip-content'>10.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>174</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_920' href='#L_SELECT_920'><pre>920</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre> Value *OtherAddOp = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_921' href='#L_SELECT_921'><pre>921</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre> if (<div class='tooltip'>SubOp->getOperand(0) == AddOp->getOperand(0)<span class='tooltip-content'>174</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_922' href='#L_SELECT_922'><pre>922</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> OtherAddOp = AddOp->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_923' href='#L_SELECT_923'><pre>923</pre></a></td><td class='covered-line'><pre>167</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>167</span></div><div class='tooltip'>SubOp->getOperand(0) == AddOp->getOperand(1)<span class='tooltip-content'>167</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_924' href='#L_SELECT_924'><pre>924</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> OtherAddOp = AddOp->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_925' href='#L_SELECT_925'><pre>925</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_926' href='#L_SELECT_926'><pre>926</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_927' href='#L_SELECT_927'><pre>927</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre> if (<div class='tooltip'>OtherAddOp<span class='tooltip-content'>174</span></div>) <div class='tooltip'>{<span class='tooltip-content'>13</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_928' href='#L_SELECT_928'><pre>928</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // So at this point we know we have (Y -> OtherAddOp):</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_929' href='#L_SELECT_929'><pre>929</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> // select C, (add X, Y), (sub X, Z)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_930' href='#L_SELECT_930'><pre>930</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *NegVal; // Compute -Z</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_931' href='#L_SELECT_931'><pre>931</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (<div class='tooltip'>SI.getType()->isFPOrFPVectorTy()<span class='tooltip-content'>13</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_932' href='#L_SELECT_932'><pre>932</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> NegVal = Builder.CreateFNeg(SubOp->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_933' href='#L_SELECT_933'><pre>933</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (Instruction *<div class='tooltip'>NegInst<span class='tooltip-content'>2</span></div> = dyn_cast<Instruction>(NegVal)) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_934' href='#L_SELECT_934'><pre>934</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> FastMathFlags Flags = AddOp->getFastMathFlags();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_935' href='#L_SELECT_935'><pre>935</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Flags &= SubOp->getFastMathFlags();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_936' href='#L_SELECT_936'><pre>936</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> NegInst->setFastMathFlags(Flags);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_937' href='#L_SELECT_937'><pre>937</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_938' href='#L_SELECT_938'><pre>938</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_939' href='#L_SELECT_939'><pre>939</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> NegVal = Builder.CreateNeg(SubOp->getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_940' href='#L_SELECT_940'><pre>940</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_941' href='#L_SELECT_941'><pre>941</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_942' href='#L_SELECT_942'><pre>942</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *NewTrueOp = OtherAddOp;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_943' href='#L_SELECT_943'><pre>943</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *NewFalseOp = NegVal;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_944' href='#L_SELECT_944'><pre>944</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (AddOp != TI)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_945' href='#L_SELECT_945'><pre>945</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> std::swap(NewTrueOp, NewFalseOp);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_946' href='#L_SELECT_946'><pre>946</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> Value *NewSel = Builder.CreateSelect(CondVal, NewTrueOp, NewFalseOp,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_947' href='#L_SELECT_947'><pre>947</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> SI.getName() + ".p", &SI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_948' href='#L_SELECT_948'><pre>948</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_949' href='#L_SELECT_949'><pre>949</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> if (<div class='tooltip'>SI.getType()->isFPOrFPVectorTy()<span class='tooltip-content'>13</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_950' href='#L_SELECT_950'><pre>950</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Instruction *RI =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_951' href='#L_SELECT_951'><pre>951</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> BinaryOperator::CreateFAdd(SubOp->getOperand(0), NewSel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_952' href='#L_SELECT_952'><pre>952</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_953' href='#L_SELECT_953'><pre>953</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> FastMathFlags Flags = AddOp->getFastMathFlags();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_954' href='#L_SELECT_954'><pre>954</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Flags &= SubOp->getFastMathFlags();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_955' href='#L_SELECT_955'><pre>955</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> RI->setFastMathFlags(Flags);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_956' href='#L_SELECT_956'><pre>956</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return RI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_957' href='#L_SELECT_957'><pre>957</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> } else</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_958' href='#L_SELECT_958'><pre>958</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return BinaryOperator::CreateAdd(SubOp->getOperand(0), NewSel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_959' href='#L_SELECT_959'><pre>959</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_960' href='#L_SELECT_960'><pre>960</pre></a></td><td class='covered-line'><pre>174</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_961' href='#L_SELECT_961'><pre>961</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_962' href='#L_SELECT_962'><pre>962</pre></a></td><td class='covered-line'><pre>10.5k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_963' href='#L_SELECT_963'><pre>963</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_964' href='#L_SELECT_964'><pre>964</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre>Instruction *InstCombiner::foldSelectExtConst(SelectInst &Sel) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_965' href='#L_SELECT_965'><pre>965</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> Instruction *ExtInst;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_966' href='#L_SELECT_966'><pre>966</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> if (!match(Sel.getTrueValue(), m_Instruction(ExtInst)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_967' href='#L_SELECT_967'><pre>967</pre></a></td><td class='covered-line'><pre>34.2k</pre></td><td class='code'><pre> !match(Sel.getFalseValue(), m_Instruction(ExtInst)))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_968' href='#L_SELECT_968'><pre>968</pre></a></td><td class='covered-line'><pre>17.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_969' href='#L_SELECT_969'><pre>969</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_970' href='#L_SELECT_970'><pre>970</pre></a></td><td class='covered-line'><pre>85.1k</pre></td><td class='code'><pre> auto ExtOpcode = ExtInst->getOpcode();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_971' href='#L_SELECT_971'><pre>971</pre></a></td><td class='covered-line'><pre>85.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>ExtOpcode != Instruction::ZExt && <span class='tooltip-content'>85.1k</span></div><div class='tooltip'>ExtOpcode != Instruction::SExt<span class='tooltip-content'>83.1k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_972' href='#L_SELECT_972'><pre>972</pre></a></td><td class='covered-line'><pre>81.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_973' href='#L_SELECT_973'><pre>973</pre></a></td><td class='covered-line'><pre>85.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_974' href='#L_SELECT_974'><pre>974</pre></a></td><td class='covered-line'><pre>85.1k</pre></td><td class='code'><pre> // TODO: Handle larger types? That requires adjusting FoldOpIntoSelect too.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_975' href='#L_SELECT_975'><pre>975</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> Value *X = ExtInst->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_976' href='#L_SELECT_976'><pre>976</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> Type *SmallType = X->getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_977' href='#L_SELECT_977'><pre>977</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> if (!SmallType->getScalarType()->isIntegerTy(1))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_978' href='#L_SELECT_978'><pre>978</pre></a></td><td class='covered-line'><pre>2.08k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_979' href='#L_SELECT_979'><pre>979</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_980' href='#L_SELECT_980'><pre>980</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> Constant *C;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_981' href='#L_SELECT_981'><pre>981</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> if (!match(Sel.getTrueValue(), m_Constant(C)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_982' href='#L_SELECT_982'><pre>982</pre></a></td><td class='covered-line'><pre>129</pre></td><td class='code'><pre> !match(Sel.getFalseValue(), m_Constant(C)))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_983' href='#L_SELECT_983'><pre>983</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_984' href='#L_SELECT_984'><pre>984</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_985' href='#L_SELECT_985'><pre>985</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // If the constant is the same after truncation to the smaller type and</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_986' href='#L_SELECT_986'><pre>986</pre></a></td><td class='covered-line'><pre>1.38k</pre></td><td class='code'><pre> // extension to the original type, we can narrow the select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_987' href='#L_SELECT_987'><pre>987</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> Value *Cond = Sel.getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_988' href='#L_SELECT_988'><pre>988</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> Type *SelType = Sel.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_989' href='#L_SELECT_989'><pre>989</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> Constant *TruncC = ConstantExpr::getTrunc(C, SmallType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_990' href='#L_SELECT_990'><pre>990</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> Constant *ExtC = ConstantExpr::getCast(ExtOpcode, TruncC, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_991' href='#L_SELECT_991'><pre>991</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> if (<div class='tooltip'>ExtC == C<span class='tooltip-content'>1.32k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>69</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_992' href='#L_SELECT_992'><pre>992</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> Value *TruncCVal = cast<Value>(TruncC);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_993' href='#L_SELECT_993'><pre>993</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> if (ExtInst == Sel.getFalseValue())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_994' href='#L_SELECT_994'><pre>994</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> std::swap(X, TruncCVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_995' href='#L_SELECT_995'><pre>995</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_996' href='#L_SELECT_996'><pre>996</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> // select Cond, (ext X), C --> ext(select Cond, X, C')</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_997' href='#L_SELECT_997'><pre>997</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> // select Cond, C, (ext X) --> ext(select Cond, C', X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_998' href='#L_SELECT_998'><pre>998</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> Value *NewSel = Builder->CreateSelect(Cond, X, TruncCVal, "narrow", &Sel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_999' href='#L_SELECT_999'><pre>999</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> return CastInst::Create(Instruction::CastOps(ExtOpcode), NewSel, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1000' href='#L_SELECT_1000'><pre>1000</pre></a></td><td class='covered-line'><pre>69</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1001' href='#L_SELECT_1001'><pre>1001</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1002' href='#L_SELECT_1002'><pre>1002</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> // If one arm of the select is the extend of the condition, replace that arm</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1003' href='#L_SELECT_1003'><pre>1003</pre></a></td><td class='covered-line'><pre>1.32k</pre></td><td class='code'><pre> // with the extension of the appropriate known bool value.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1004' href='#L_SELECT_1004'><pre>1004</pre></a></td><td class='covered-line'><pre>1.25k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.25k</span></div><div class='tooltip'>Cond == X<span class='tooltip-content'>1.25k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1005' href='#L_SELECT_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>ExtInst == Sel.getTrueValue()<span class='tooltip-content'>2</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1006' href='#L_SELECT_1006'><pre>1006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // select X, (sext X), C --> select X, -1, C</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1007' href='#L_SELECT_1007'><pre>1007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // select X, (zext X), C --> select X, 1, C</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1008' href='#L_SELECT_1008'><pre>1008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *One = ConstantInt::getTrue(SmallType);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1009' href='#L_SELECT_1009'><pre>1009</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *AllOnesOrOne = ConstantExpr::getCast(ExtOpcode, One, SelType);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1010' href='#L_SELECT_1010'><pre>1010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return SelectInst::Create(Cond, AllOnesOrOne, C, "", nullptr, &Sel);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1011' href='#L_SELECT_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1012' href='#L_SELECT_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // select X, C, (sext X) --> select X, C, 0</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1013' href='#L_SELECT_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // select X, C, (zext X) --> select X, C, 0</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1014' href='#L_SELECT_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Constant *Zero = ConstantInt::getNullValue(SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1015' href='#L_SELECT_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return SelectInst::Create(Cond, C, Zero, "", nullptr, &Sel);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1016' href='#L_SELECT_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1017' href='#L_SELECT_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1018' href='#L_SELECT_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>1.25k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1019' href='#L_SELECT_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>1.25k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1020' href='#L_SELECT_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>1.25k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1021' href='#L_SELECT_1021'><pre>1021</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1022' href='#L_SELECT_1022'><pre>1022</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to transform a vector select with a constant condition vector into a</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1023' href='#L_SELECT_1023'><pre>1023</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// shuffle for easier combining with other shuffles and insert/extract.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1024' href='#L_SELECT_1024'><pre>1024</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre>static Instruction *canonicalizeSelectToShuffle(SelectInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1025' href='#L_SELECT_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Value *CondVal = SI.getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1026' href='#L_SELECT_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Constant *CondC;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1027' href='#L_SELECT_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> if (<div class='tooltip'>!CondVal->getType()->isVectorTy() || <span class='tooltip-content'>104k</span></div><div class='tooltip'>!match(CondVal, m_Constant(CondC))<span class='tooltip-content'>125</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1028' href='#L_SELECT_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1029' href='#L_SELECT_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1030' href='#L_SELECT_1030'><pre>1030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>unsigned NumElts = CondVal->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1031' href='#L_SELECT_1031'><pre>1031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> Mask;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1032' href='#L_SELECT_1032'><pre>1032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.reserve(NumElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1033' href='#L_SELECT_1033'><pre>1033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Int32Ty = Type::getInt32Ty(CondVal->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1034' href='#L_SELECT_1034'><pre>1034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1035' href='#L_SELECT_1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Elt = CondC->getAggregateElement(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1036' href='#L_SELECT_1036'><pre>1036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Elt</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1037' href='#L_SELECT_1037'><pre>1037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1038' href='#L_SELECT_1038'><pre>1038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1039' href='#L_SELECT_1039'><pre>1039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Elt->isOneValue()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1040' href='#L_SELECT_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the select condition element is true, choose from the 1st vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1041' href='#L_SELECT_1041'><pre>1041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.push_back(ConstantInt::get(Int32Ty, i));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1042' href='#L_SELECT_1042'><pre>1042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Elt->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1043' href='#L_SELECT_1043'><pre>1043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the select condition element is false, choose from the 2nd vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1044' href='#L_SELECT_1044'><pre>1044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.push_back(ConstantInt::get(Int32Ty, i + NumElts));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1045' href='#L_SELECT_1045'><pre>1045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(Elt)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1046' href='#L_SELECT_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the select condition element is undef, the shuffle mask is undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1047' href='#L_SELECT_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.push_back(UndefValue::get(Int32Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1048' href='#L_SELECT_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1049' href='#L_SELECT_1049'><pre>1049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Bail out on a constant expression.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1050' href='#L_SELECT_1050'><pre>1050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1051' href='#L_SELECT_1051'><pre>1051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1052' href='#L_SELECT_1052'><pre>1052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1053' href='#L_SELECT_1053'><pre>1053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1054' href='#L_SELECT_1054'><pre>1054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return new ShuffleVectorInst(SI.getTrueValue(), SI.getFalseValue(),</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1055' href='#L_SELECT_1055'><pre>1055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(Mask))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1056' href='#L_SELECT_1056'><pre>1056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1057' href='#L_SELECT_1057'><pre>1057</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1058' href='#L_SELECT_1058'><pre>1058</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Reuse bitcasted operands between a compare and select:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1059' href='#L_SELECT_1059'><pre>1059</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// select (cmp (bitcast C), (bitcast D)), (bitcast' C), (bitcast' D) --></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1060' href='#L_SELECT_1060'><pre>1060</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// bitcast (select (cmp (bitcast C), (bitcast D)), (bitcast C), (bitcast D))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1061' href='#L_SELECT_1061'><pre>1061</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Instruction *foldSelectCmpBitcasts(SelectInst &Sel,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1062' href='#L_SELECT_1062'><pre>1062</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1063' href='#L_SELECT_1063'><pre>1063</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> Value *Cond = Sel.getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1064' href='#L_SELECT_1064'><pre>1064</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> Value *TVal = Sel.getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1065' href='#L_SELECT_1065'><pre>1065</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> Value *FVal = Sel.getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1066' href='#L_SELECT_1066'><pre>1066</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1067' href='#L_SELECT_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> CmpInst::Predicate Pred;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1068' href='#L_SELECT_1068'><pre>1068</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> Value *A, *B;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1069' href='#L_SELECT_1069'><pre>1069</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> if (!match(Cond, m_Cmp(Pred, m_Value(A), m_Value(B))))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1070' href='#L_SELECT_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>5.13k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1071' href='#L_SELECT_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1072' href='#L_SELECT_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // The select condition is a compare instruction. If the select's true/false</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1073' href='#L_SELECT_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // values are already the same as the compare operands, there's nothing to do.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1074' href='#L_SELECT_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>96.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>96.8k</span></div><div class='tooltip'>TVal == A || <span class='tooltip-content'>96.8k</span></div><div class='tooltip'>TVal == B<span class='tooltip-content'>74.6k</span></div> || <div class='tooltip'>FVal == A<span class='tooltip-content'>65.1k</span></div> || <div class='tooltip'>FVal == B<span class='tooltip-content'>54.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1075' href='#L_SELECT_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>43.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1076' href='#L_SELECT_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>96.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1077' href='#L_SELECT_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>53.1k</pre></td><td class='code'><pre> Value *C, *D;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1078' href='#L_SELECT_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>53.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>!match(A, m_BitCast(m_Value(C))) || <span class='tooltip-content'>53.1k</span></div><div class='tooltip'>!match(B, m_BitCast(m_Value(D)))<span class='tooltip-content'>5</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1079' href='#L_SELECT_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>53.1k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1080' href='#L_SELECT_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>53.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1081' href='#L_SELECT_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>53.1k</pre></td><td class='code'><pre> // select (cmp (bitcast C), (bitcast D)), (bitcast TSrc), (bitcast FSrc)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1082' href='#L_SELECT_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Value *TSrc, *FSrc;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1083' href='#L_SELECT_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (!match(TVal, m_BitCast(m_Value(TSrc))) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1084' href='#L_SELECT_1084'><pre>1084</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!match(FVal, m_BitCast(m_Value(FSrc)))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1085' href='#L_SELECT_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1086' href='#L_SELECT_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1087' href='#L_SELECT_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // If the select true/false values are *different bitcasts* of the same source</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1088' href='#L_SELECT_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // operands, make the select operands the same as the compare operands and</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1089' href='#L_SELECT_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // cast the result. This is the canonical select form for min/max.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1090' href='#L_SELECT_1090'><pre>1090</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Value *NewSel;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1091' href='#L_SELECT_1091'><pre>1091</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TSrc == C && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>FSrc == D</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1092' href='#L_SELECT_1092'><pre>1092</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // select (cmp (bitcast C), (bitcast D)), (bitcast' C), (bitcast' D) --></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1093' href='#L_SELECT_1093'><pre>1093</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bitcast (select (cmp A, B), A, B)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1094' href='#L_SELECT_1094'><pre>1094</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewSel = Builder.CreateSelect(Cond, A, B, "", &Sel);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1095' href='#L_SELECT_1095'><pre>1095</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>TSrc == D && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>FSrc == C</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1096' href='#L_SELECT_1096'><pre>1096</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // select (cmp (bitcast C), (bitcast D)), (bitcast' D), (bitcast' C) --></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1097' href='#L_SELECT_1097'><pre>1097</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // bitcast (select (cmp A, B), B, A)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1098' href='#L_SELECT_1098'><pre>1098</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewSel = Builder.CreateSelect(Cond, B, A, "", &Sel);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1099' href='#L_SELECT_1099'><pre>1099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1100' href='#L_SELECT_1100'><pre>1100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1101' href='#L_SELECT_1101'><pre>1101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1102' href='#L_SELECT_1102'><pre>1102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return CastInst::CreateBitOrPointerCast(NewSel, Sel.getType())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1103' href='#L_SELECT_1103'><pre>1103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1104' href='#L_SELECT_1104'><pre>1104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1105' href='#L_SELECT_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1106' href='#L_SELECT_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Value *CondVal = SI.getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1107' href='#L_SELECT_1107'><pre>1107</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Value *TrueVal = SI.getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1108' href='#L_SELECT_1108'><pre>1108</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Value *FalseVal = SI.getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1109' href='#L_SELECT_1109'><pre>1109</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> Type *SelType = SI.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1110' href='#L_SELECT_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1111' href='#L_SELECT_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> if (Value *V =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1112' href='#L_SELECT_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> SimplifySelectInst(CondVal, TrueVal, FalseVal, DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1113' href='#L_SELECT_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>104</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, V);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1114' href='#L_SELECT_1114'><pre>1114</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1115' href='#L_SELECT_1115'><pre>1115</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>104k</span></div><div class='tooltip'>I<span class='tooltip-content'>104k</span></div> = canonicalizeSelectToShuffle(SI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1116' href='#L_SELECT_1116'><pre>1116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1117' href='#L_SELECT_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1118' href='#L_SELECT_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>104k</span></div><div class='tooltip'>SelType->getScalarType()->isIntegerTy(1) &&<span class='tooltip-content'>104k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1119' href='#L_SELECT_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> <div class='tooltip'>TrueVal->getType() == CondVal->getType()<span class='tooltip-content'>1.02k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.02k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1120' href='#L_SELECT_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>1.02k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(TrueVal, m_One())<span class='tooltip-content'>1.02k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>545</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1121' href='#L_SELECT_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>545</pre></td><td class='code'><pre> // Change: A = select B, true, C --> A = or B, C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1122' href='#L_SELECT_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>545</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(CondVal, FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1123' href='#L_SELECT_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>545</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1124' href='#L_SELECT_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>483</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>483</span></div><div class='tooltip'>match(TrueVal, m_Zero())<span class='tooltip-content'>483</span></div>) <div class='tooltip'>{<span class='tooltip-content'>187</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1125' href='#L_SELECT_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>187</pre></td><td class='code'><pre> // Change: A = select B, false, C --> A = and !B, C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1126' href='#L_SELECT_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>187</pre></td><td class='code'><pre> Value *NotCond = Builder->CreateNot(CondVal, "not." + CondVal->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1127' href='#L_SELECT_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>187</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NotCond, FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1128' href='#L_SELECT_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>187</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1129' href='#L_SELECT_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>296</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>296</span></div><div class='tooltip'>match(FalseVal, m_Zero())<span class='tooltip-content'>296</span></div>) <div class='tooltip'>{<span class='tooltip-content'>197</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1130' href='#L_SELECT_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> // Change: A = select B, C, false --> A = and B, C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1131' href='#L_SELECT_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(CondVal, TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1132' href='#L_SELECT_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>197</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1133' href='#L_SELECT_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>99</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>99</span></div><div class='tooltip'>match(FalseVal, m_One())<span class='tooltip-content'>99</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1134' href='#L_SELECT_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> // Change: A = select B, C, true --> A = or !B, C</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1135' href='#L_SELECT_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> Value *NotCond = Builder->CreateNot(CondVal, "not." + CondVal->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1136' href='#L_SELECT_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> return BinaryOperator::CreateOr(NotCond, TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1137' href='#L_SELECT_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1138' href='#L_SELECT_1138'><pre>1138</pre></a></td><td class='covered-line'><pre>99</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1139' href='#L_SELECT_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>99</pre></td><td class='code'><pre> // select a, a, b -> a | b</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1140' href='#L_SELECT_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>99</pre></td><td class='code'><pre> // select a, b, a -> a & b</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1141' href='#L_SELECT_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63</span></div><div class='tooltip'>CondVal == TrueVal<span class='tooltip-content'>63</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1142' href='#L_SELECT_1142'><pre>1142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(CondVal, FalseVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1143' href='#L_SELECT_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63</span></div><div class='tooltip'>CondVal == FalseVal<span class='tooltip-content'>63</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1144' href='#L_SELECT_1144'><pre>1144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(CondVal, TrueVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1145' href='#L_SELECT_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1146' href='#L_SELECT_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // select a, ~a, b -> (~a) & b</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1147' href='#L_SELECT_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> // select a, b, ~a -> (~a) | b</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1148' href='#L_SELECT_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63</span></div><div class='tooltip'>match(TrueVal, m_Not(m_Specific(CondVal)))<span class='tooltip-content'>63</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1149' href='#L_SELECT_1149'><pre>1149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateAnd(TrueVal, FalseVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1150' href='#L_SELECT_1150'><pre>1150</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63</span></div><div class='tooltip'>match(FalseVal, m_Not(m_Specific(CondVal)))<span class='tooltip-content'>63</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1151' href='#L_SELECT_1151'><pre>1151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BinaryOperator::CreateOr(TrueVal, FalseVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1152' href='#L_SELECT_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>63</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1153' href='#L_SELECT_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1154' href='#L_SELECT_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> // Selecting between two integer or vector splat integer constants?</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1155' href='#L_SELECT_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1156' href='#L_SELECT_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> // Note that we don't handle a scalar select of vectors:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1157' href='#L_SELECT_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> // select i1 %c, <2 x i8> <1, 1>, <2 x i8> <0, 0></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1158' href='#L_SELECT_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> // because that may need 3 instructions to splat the condition value:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1159' href='#L_SELECT_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>104k</pre></td><td class='code'><pre> // extend, insertelement, shufflevector.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1160' href='#L_SELECT_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>103k</span></div><div class='tooltip'>CondVal->getType()->isVectorTy() == SelType->isVectorTy()<span class='tooltip-content'>103k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>103k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1161' href='#L_SELECT_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> // select C, 1, 0 -> zext C to int</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1162' href='#L_SELECT_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(TrueVal, m_One()) && <span class='tooltip-content'>103k</span></div><div class='tooltip'>match(FalseVal, m_Zero())<span class='tooltip-content'>4.32k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1163' href='#L_SELECT_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>451</pre></td><td class='code'><pre> return new ZExtInst(CondVal, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1164' href='#L_SELECT_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1165' href='#L_SELECT_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> // select C, -1, 0 -> sext C to int</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1166' href='#L_SELECT_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>103k</span></div><div class='tooltip'>match(TrueVal, m_AllOnes()) && <span class='tooltip-content'>103k</span></div><div class='tooltip'>match(FalseVal, m_Zero())<span class='tooltip-content'>2.67k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1167' href='#L_SELECT_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> return new SExtInst(CondVal, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1168' href='#L_SELECT_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1169' href='#L_SELECT_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> // select C, 0, 1 -> zext !C to int</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1170' href='#L_SELECT_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>103k</span></div><div class='tooltip'>match(TrueVal, m_Zero()) && <span class='tooltip-content'>103k</span></div><div class='tooltip'>match(FalseVal, m_One())<span class='tooltip-content'>6.37k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>382</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1171' href='#L_SELECT_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>382</pre></td><td class='code'><pre> Value *NotCond = Builder->CreateNot(CondVal, "not." + CondVal->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1172' href='#L_SELECT_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>382</pre></td><td class='code'><pre> return new ZExtInst(NotCond, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1173' href='#L_SELECT_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>382</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1174' href='#L_SELECT_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1175' href='#L_SELECT_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre> // select C, 0, -1 -> sext !C to int</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1176' href='#L_SELECT_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>102k</span></div><div class='tooltip'>match(TrueVal, m_Zero()) && <span class='tooltip-content'>102k</span></div><div class='tooltip'>match(FalseVal, m_AllOnes())<span class='tooltip-content'>5.99k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>30</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1177' href='#L_SELECT_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> Value *NotCond = Builder->CreateNot(CondVal, "not." + CondVal->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1178' href='#L_SELECT_1178'><pre>1178</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> return new SExtInst(NotCond, SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1179' href='#L_SELECT_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1180' href='#L_SELECT_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1181' href='#L_SELECT_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>103k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1182' href='#L_SELECT_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>102k</span></div><div class='tooltip'>TrueValC<span class='tooltip-content'>102k</span></div> = dyn_cast<ConstantInt>(TrueVal))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1183' href='#L_SELECT_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>23.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>23.2k</span></div><div class='tooltip'>FalseValC<span class='tooltip-content'>23.2k</span></div> = dyn_cast<ConstantInt>(FalseVal))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1184' href='#L_SELECT_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>10.9k</span></div><div class='tooltip'>V<span class='tooltip-content'>10.9k</span></div> = foldSelectICmpAnd(SI, TrueValC, FalseValC, Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1185' href='#L_SELECT_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, V);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1186' href='#L_SELECT_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1187' href='#L_SELECT_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // See if we are selecting two values based on a comparison of the two values.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1188' href='#L_SELECT_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (FCmpInst *<span class='tooltip-content'>102k</span></div><div class='tooltip'>FCI<span class='tooltip-content'>102k</span></div> = dyn_cast<FCmpInst>(CondVal)) <div class='tooltip'>{<span class='tooltip-content'>12.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1189' href='#L_SELECT_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>FCI->getOperand(0) == TrueVal && <span class='tooltip-content'>12.1k</span></div><div class='tooltip'>FCI->getOperand(1) == FalseVal<span class='tooltip-content'>2.81k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.73k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1190' href='#L_SELECT_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // Transform (X == Y) ? X : Y -> Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1191' href='#L_SELECT_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> if (<div class='tooltip'>FCI->getPredicate() == FCmpInst::FCMP_OEQ<span class='tooltip-content'>2.73k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1192' href='#L_SELECT_1192'><pre>1192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is not safe in general for floating point:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1193' href='#L_SELECT_1193'><pre>1193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // consider X== -0, Y== +0.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1194' href='#L_SELECT_1194'><pre>1194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // It becomes safe if either operand is a nonzero constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1195' href='#L_SELECT_1195'><pre>1195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP *CFPt, *CFPf;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1196' href='#L_SELECT_1196'><pre>1196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1197' href='#L_SELECT_1197'><pre>1197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!CFPt->getValueAPF().isZero()</span><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1198' href='#L_SELECT_1198'><pre>1198</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1199' href='#L_SELECT_1199'><pre>1199</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!CFPf->getValueAPF().isZero()</span><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1200' href='#L_SELECT_1200'><pre>1200</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(SI, FalseVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1201' href='#L_SELECT_1201'><pre>1201</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1202' href='#L_SELECT_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // Transform (X une Y) ? X : Y -> X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1203' href='#L_SELECT_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.73k</span></div><div class='tooltip'>FCI->getPredicate() == FCmpInst::FCMP_UNE<span class='tooltip-content'>2.73k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1204' href='#L_SELECT_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // This is not safe in general for floating point:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1205' href='#L_SELECT_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // consider X== -0, Y== +0.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1206' href='#L_SELECT_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // It becomes safe if either operand is a nonzero constant.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1207' href='#L_SELECT_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantFP *CFPt, *CFPf;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1208' href='#L_SELECT_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1209' href='#L_SELECT_1209'><pre>1209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!CFPt->getValueAPF().isZero()</span>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1210' href='#L_SELECT_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1211' href='#L_SELECT_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> !CFPf->getValueAPF().isZero()))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1212' href='#L_SELECT_1212'><pre>1212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SI, TrueVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1213' href='#L_SELECT_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1214' href='#L_SELECT_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1215' href='#L_SELECT_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // Canonicalize to use ordered comparisons by swapping the select</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1216' href='#L_SELECT_1216'><pre>1216</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // operands.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1217' href='#L_SELECT_1217'><pre>1217</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1218' href='#L_SELECT_1218'><pre>1218</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // e.g.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1219' href='#L_SELECT_1219'><pre>1219</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // (X ugt Y) ? X : Y -> (X ole Y) ? Y : X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1220' href='#L_SELECT_1220'><pre>1220</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.73k</span></div><div class='tooltip'>FCI->hasOneUse() && <span class='tooltip-content'>2.73k</span></div><div class='tooltip'>FCmpInst::isUnordered(FCI->getPredicate())<span class='tooltip-content'>1.94k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1221' href='#L_SELECT_1221'><pre>1221</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> FCmpInst::Predicate InvPred = FCI->getInversePredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1222' href='#L_SELECT_1222'><pre>1222</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> IRBuilder<>::FastMathFlagGuard FMFG(*Builder);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1223' href='#L_SELECT_1223'><pre>1223</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Builder->setFastMathFlags(FCI->getFastMathFlags());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1224' href='#L_SELECT_1224'><pre>1224</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewCond = Builder->CreateFCmp(InvPred, TrueVal, FalseVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1225' href='#L_SELECT_1225'><pre>1225</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> FCI->getName() + ".inv");</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1226' href='#L_SELECT_1226'><pre>1226</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1227' href='#L_SELECT_1227'><pre>1227</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return SelectInst::Create(NewCond, FalseVal, TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1228' href='#L_SELECT_1228'><pre>1228</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> SI.getName() + ".p");</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1229' href='#L_SELECT_1229'><pre>1229</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1230' href='#L_SELECT_1230'><pre>1230</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1231' href='#L_SELECT_1231'><pre>1231</pre></a></td><td class='covered-line'><pre>2.73k</pre></td><td class='code'><pre> // NOTE: if we wanted to, this is where to detect MIN/MAX</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1232' href='#L_SELECT_1232'><pre>1232</pre></a></td><td class='covered-line'><pre>9.37k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>9.37k</span></div><div class='tooltip'>FCI->getOperand(0) == FalseVal && <span class='tooltip-content'>9.37k</span></div><div class='tooltip'>FCI->getOperand(1) == TrueVal<span class='tooltip-content'>2.26k</span></div>)<div class='tooltip'>{<span class='tooltip-content'>2.13k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1233' href='#L_SELECT_1233'><pre>1233</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // Transform (X == Y) ? Y : X -> X</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1234' href='#L_SELECT_1234'><pre>1234</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> if (<div class='tooltip'>FCI->getPredicate() == FCmpInst::FCMP_OEQ<span class='tooltip-content'>2.13k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1235' href='#L_SELECT_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // This is not safe in general for floating point:</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1236' href='#L_SELECT_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // consider X== -0, Y== +0.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1237' href='#L_SELECT_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> // It becomes safe if either operand is a nonzero constant.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1238' href='#L_SELECT_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> ConstantFP *CFPt, *CFPf;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1239' href='#L_SELECT_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1240' href='#L_SELECT_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> !CFPt->getValueAPF().isZero()) ||</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1241' href='#L_SELECT_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> ((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1242' href='#L_SELECT_1242'><pre>1242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!CFPf->getValueAPF().isZero()</span>))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1243' href='#L_SELECT_1243'><pre>1243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SI, FalseVal)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1244' href='#L_SELECT_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1245' href='#L_SELECT_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // Transform (X une Y) ? Y : X -> Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1246' href='#L_SELECT_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.13k</span></div><div class='tooltip'>FCI->getPredicate() == FCmpInst::FCMP_UNE<span class='tooltip-content'>2.13k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1247' href='#L_SELECT_1247'><pre>1247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This is not safe in general for floating point:</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1248' href='#L_SELECT_1248'><pre>1248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // consider X== -0, Y== +0.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1249' href='#L_SELECT_1249'><pre>1249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // It becomes safe if either operand is a nonzero constant.</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1250' href='#L_SELECT_1250'><pre>1250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantFP *CFPt, *CFPf;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1251' href='#L_SELECT_1251'><pre>1251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1252' href='#L_SELECT_1252'><pre>1252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!CFPt->getValueAPF().isZero()</span><span class='red'>) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1253' href='#L_SELECT_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1254' href='#L_SELECT_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>!CFPf->getValueAPF().isZero()</span><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1255' href='#L_SELECT_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(SI, TrueVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1256' href='#L_SELECT_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1257' href='#L_SELECT_1257'><pre>1257</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1258' href='#L_SELECT_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // Canonicalize to use ordered comparisons by swapping the select</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1259' href='#L_SELECT_1259'><pre>1259</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // operands.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1260' href='#L_SELECT_1260'><pre>1260</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1261' href='#L_SELECT_1261'><pre>1261</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // e.g.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1262' href='#L_SELECT_1262'><pre>1262</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // (X ugt Y) ? X : Y -> (X ole Y) ? X : Y</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1263' href='#L_SELECT_1263'><pre>1263</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.13k</span></div><div class='tooltip'>FCI->hasOneUse() && <span class='tooltip-content'>2.13k</span></div><div class='tooltip'>FCmpInst::isUnordered(FCI->getPredicate())<span class='tooltip-content'>1.50k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1264' href='#L_SELECT_1264'><pre>1264</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> FCmpInst::Predicate InvPred = FCI->getInversePredicate();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1265' href='#L_SELECT_1265'><pre>1265</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> IRBuilder<>::FastMathFlagGuard FMFG(*Builder);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1266' href='#L_SELECT_1266'><pre>1266</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Builder->setFastMathFlags(FCI->getFastMathFlags());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1267' href='#L_SELECT_1267'><pre>1267</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewCond = Builder->CreateFCmp(InvPred, FalseVal, TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1268' href='#L_SELECT_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> FCI->getName() + ".inv");</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1269' href='#L_SELECT_1269'><pre>1269</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1270' href='#L_SELECT_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return SelectInst::Create(NewCond, FalseVal, TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1271' href='#L_SELECT_1271'><pre>1271</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> SI.getName() + ".p");</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1272' href='#L_SELECT_1272'><pre>1272</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1273' href='#L_SELECT_1273'><pre>1273</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1274' href='#L_SELECT_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // NOTE: if we wanted to, this is where to detect MIN/MAX</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1275' href='#L_SELECT_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1276' href='#L_SELECT_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> // NOTE: if we wanted to, this is where to detect ABS</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1277' href='#L_SELECT_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1278' href='#L_SELECT_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1279' href='#L_SELECT_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // See if we are selecting two values based on a comparison of the two values.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1280' href='#L_SELECT_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (ICmpInst *<span class='tooltip-content'>102k</span></div><div class='tooltip'>ICI<span class='tooltip-content'>102k</span></div> = dyn_cast<ICmpInst>(CondVal))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1281' href='#L_SELECT_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>85.5k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>85.5k</span></div><div class='tooltip'>Result<span class='tooltip-content'>85.5k</span></div> = foldSelectInstWithICmp(SI, ICI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1282' href='#L_SELECT_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>234</pre></td><td class='code'><pre> return Result;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1283' href='#L_SELECT_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1284' href='#L_SELECT_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>102k</span></div><div class='tooltip'>Add<span class='tooltip-content'>102k</span></div> = foldAddSubSelect(SI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1285' href='#L_SELECT_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> return Add;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1286' href='#L_SELECT_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1287' href='#L_SELECT_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // Turn (select C, (op X, Y), (op X, Z)) -> (op X, (select C, Y, Z))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1288' href='#L_SELECT_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> auto *TI = dyn_cast<Instruction>(TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1289' href='#L_SELECT_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> auto *FI = dyn_cast<Instruction>(FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1290' href='#L_SELECT_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> if (<div class='tooltip'>TI && <span class='tooltip-content'>102k</span></div><div class='tooltip'>FI<span class='tooltip-content'>68.4k</span></div> && <div class='tooltip'>TI->getOpcode() == FI->getOpcode()<span class='tooltip-content'>50.8k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1291' href='#L_SELECT_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>21.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>21.6k</span></div><div class='tooltip'>IV<span class='tooltip-content'>21.6k</span></div> = foldSelectOpOp(SI, TI, FI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1292' href='#L_SELECT_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> return IV;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1293' href='#L_SELECT_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1294' href='#L_SELECT_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>102k</span></div><div class='tooltip'>I<span class='tooltip-content'>102k</span></div> = foldSelectExtConst(SI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1295' href='#L_SELECT_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>71</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1296' href='#L_SELECT_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1297' href='#L_SELECT_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // See if we can fold the select into one of our operands.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1298' href='#L_SELECT_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>102k</span></div><div class='tooltip'>SelType->isIntOrIntVectorTy() || <span class='tooltip-content'>102k</span></div><div class='tooltip'>SelType->isFPOrFPVectorTy()<span class='tooltip-content'>29.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>81.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1299' href='#L_SELECT_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre> if (Instruction *FoldI = foldSelectIntoOp(SI, TrueVal, FalseVal))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1300' href='#L_SELECT_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>371</pre></td><td class='code'><pre> return FoldI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1301' href='#L_SELECT_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>81.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1302' href='#L_SELECT_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> Value *LHS, *RHS, *LHS2, *RHS2;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1303' href='#L_SELECT_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> Instruction::CastOps CastOp;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1304' href='#L_SELECT_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> SelectPatternResult SPR = matchSelectPattern(&SI, LHS, RHS, &CastOp);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1305' href='#L_SELECT_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> auto SPF = SPR.Flavor;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1306' href='#L_SELECT_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1307' href='#L_SELECT_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>SelectPatternResult::isMinOrMax(SPF)<span class='tooltip-content'>80.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>22.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1308' href='#L_SELECT_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>22.9k</pre></td><td class='code'><pre> // Canonicalize so that type casts are outside select patterns.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1309' href='#L_SELECT_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>22.9k</pre></td><td class='code'><pre> if (LHS->getType()->getPrimitiveSizeInBits() !=</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1310' href='#L_SELECT_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> SelType->getPrimitiveSizeInBits()) {</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1311' href='#L_SELECT_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> CmpInst::Predicate Pred = getCmpPredicateForMinMax(SPF, SPR.Ordered);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1312' href='#L_SELECT_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1313' href='#L_SELECT_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> Value *Cmp;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1314' href='#L_SELECT_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> if (<div class='tooltip'>CmpInst::isIntPredicate(Pred)<span class='tooltip-content'>34</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1315' href='#L_SELECT_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> Cmp = Builder->CreateICmp(Pred, LHS, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1316' href='#L_SELECT_1316'><pre>1316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1317' href='#L_SELECT_1317'><pre>1317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IRBuilder<>::FastMathFlagGuard FMFG(*Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1318' href='#L_SELECT_1318'><pre>1318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto FMF = cast<FPMathOperator>(SI.getCondition())->getFastMathFlags();</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1319' href='#L_SELECT_1319'><pre>1319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->setFastMathFlags(FMF);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1320' href='#L_SELECT_1320'><pre>1320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cmp = Builder->CreateFCmp(Pred, LHS, RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1321' href='#L_SELECT_1321'><pre>1321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1322' href='#L_SELECT_1322'><pre>1322</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1323' href='#L_SELECT_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> Value *NewSI = Builder->CreateCast(</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1324' href='#L_SELECT_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> CastOp, Builder->CreateSelect(Cmp, LHS, RHS, SI.getName(), &SI),</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1325' href='#L_SELECT_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> SelType);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1326' href='#L_SELECT_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, NewSI);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1327' href='#L_SELECT_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>34</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1328' href='#L_SELECT_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>22.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1329' href='#L_SELECT_1329'><pre>1329</pre></a></td><td class='covered-line'><pre>80.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1330' href='#L_SELECT_1330'><pre>1330</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>80.7k</span></div><div class='tooltip'>SPF<span class='tooltip-content'>80.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>26.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1331' href='#L_SELECT_1331'><pre>1331</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // MAX(MAX(a, b), a) -> MAX(a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1332' href='#L_SELECT_1332'><pre>1332</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // MIN(MIN(a, b), a) -> MIN(a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1333' href='#L_SELECT_1333'><pre>1333</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // MAX(MIN(a, b), a) -> a</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1334' href='#L_SELECT_1334'><pre>1334</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // MIN(MAX(a, b), a) -> a</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1335' href='#L_SELECT_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // ABS(ABS(a)) -> ABS(a)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1336' href='#L_SELECT_1336'><pre>1336</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> // NABS(NABS(a)) -> NABS(a)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1337' href='#L_SELECT_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> if (SelectPatternFlavor SPF2 = matchSelectPattern(LHS, LHS2, RHS2).Flavor)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1338' href='#L_SELECT_1338'><pre>1338</pre></a></td><td class='covered-line'><pre>4.28k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>4.28k</span></div><div class='tooltip'>R<span class='tooltip-content'>4.28k</span></div> = foldSPFofSPF(cast<Instruction>(LHS),SPF2,LHS2,RHS2,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1339' href='#L_SELECT_1339'><pre>1339</pre></a></td><td class='covered-line'><pre>4.28k</pre></td><td class='code'><pre> SI, SPF, RHS))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1340' href='#L_SELECT_1340'><pre>1340</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1341' href='#L_SELECT_1341'><pre>1341</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectPatternFlavor <span class='tooltip-content'>26.3k</span></div><div class='tooltip'>SPF2<span class='tooltip-content'>26.3k</span></div> = matchSelectPattern(RHS, LHS2, RHS2).Flavor)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1342' href='#L_SELECT_1342'><pre>1342</pre></a></td><td class='covered-line'><pre>424</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>424</span></div><div class='tooltip'>R<span class='tooltip-content'>424</span></div> = foldSPFofSPF(cast<Instruction>(RHS),SPF2,LHS2,RHS2,</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1343' href='#L_SELECT_1343'><pre>1343</pre></a></td><td class='covered-line'><pre>424</pre></td><td class='code'><pre> SI, SPF, LHS))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1344' href='#L_SELECT_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return R</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1345' href='#L_SELECT_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>26.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1346' href='#L_SELECT_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1347' href='#L_SELECT_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // MAX(~a, ~b) -> ~MIN(a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1348' href='#L_SELECT_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>80.7k</span></div><div class='tooltip'>(SPF == SPF_SMAX || <span class='tooltip-content'>80.7k</span></div><div class='tooltip'>SPF == SPF_UMAX<span class='tooltip-content'>71.0k</span></div>) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1349' href='#L_SELECT_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>10.9k</pre></td><td class='code'><pre> IsFreeToInvert(LHS, LHS->hasNUses(2)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1350' href='#L_SELECT_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>603</pre></td><td class='code'><pre> <div class='tooltip'>IsFreeToInvert(RHS, RHS->hasNUses(2))<span class='tooltip-content'>603</span></div>) <div class='tooltip'>{<span class='tooltip-content'>522</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1351' href='#L_SELECT_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> // For this transform to be profitable, we need to eliminate at least two</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1352' href='#L_SELECT_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> // 'not' instructions if we're going to add one 'not' instruction.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1353' href='#L_SELECT_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> int NumberOfNots =</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1354' href='#L_SELECT_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> (LHS->hasNUses(2) && match(LHS, m_Not(m_Value()))) +</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1355' href='#L_SELECT_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>153</pre></td><td class='code'><pre> (RHS->hasNUses(2) && match(RHS, m_Not(m_Value()))) +</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1356' href='#L_SELECT_1356'><pre>1356</pre></a></td><td class='covered-line'><pre>348</pre></td><td class='code'><pre> (SI.hasOneUse() && match(*SI.user_begin(), m_Not(m_Value())));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1357' href='#L_SELECT_1357'><pre>1357</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1358' href='#L_SELECT_1358'><pre>1358</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> if (<div class='tooltip'>NumberOfNots >= 2<span class='tooltip-content'>522</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1359' href='#L_SELECT_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewLHS = Builder->CreateNot(LHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1360' href='#L_SELECT_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewRHS = Builder->CreateNot(RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1361' href='#L_SELECT_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewCmp = SPF == SPF_SMAX</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1362' href='#L_SELECT_1362'><pre>1362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>Builder->CreateICmpSLT(NewLHS, NewRHS)</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1363' href='#L_SELECT_1363'><pre>1363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Builder->CreateICmpULT(NewLHS, NewRHS)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1364' href='#L_SELECT_1364'><pre>1364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *NewSI =</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1365' href='#L_SELECT_1365'><pre>1365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateNot(Builder->CreateSelect(NewCmp, NewLHS, NewRHS));</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1366' href='#L_SELECT_1366'><pre>1366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(SI, NewSI);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1367' href='#L_SELECT_1367'><pre>1367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1368' href='#L_SELECT_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>522</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1369' href='#L_SELECT_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1370' href='#L_SELECT_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // TODO.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1371' href='#L_SELECT_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> // ABS(-X) -> ABS(X)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1372' href='#L_SELECT_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>80.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1373' href='#L_SELECT_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1374' href='#L_SELECT_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // See if we can fold the select into a phi node if the condition is a select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1375' href='#L_SELECT_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>102k</span></div><div class='tooltip'>isa<PHINode>(SI.getCondition())<span class='tooltip-content'>102k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1376' href='#L_SELECT_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> // The true/false values have to be live in the PHI predecessor's blocks.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1377' href='#L_SELECT_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>883</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>883</span></div><div class='tooltip'>canSelectOperandBeMappingIntoPredBlock(TrueVal, SI) &&<span class='tooltip-content'>883</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1378' href='#L_SELECT_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>770</pre></td><td class='code'><pre> canSelectOperandBeMappingIntoPredBlock(FalseVal, SI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1379' href='#L_SELECT_1379'><pre>1379</pre></a></td><td class='covered-line'><pre>600</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>600</span></div><div class='tooltip'>NV<span class='tooltip-content'>600</span></div> = FoldOpIntoPhi(SI))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1380' href='#L_SELECT_1380'><pre>1380</pre></a></td><td class='covered-line'><pre>60</pre></td><td class='code'><pre> return NV;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1381' href='#L_SELECT_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1382' href='#L_SELECT_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>102k</span></div><div class='tooltip'>TrueSI<span class='tooltip-content'>102k</span></div> = dyn_cast<SelectInst>(TrueVal)) <div class='tooltip'>{<span class='tooltip-content'>6.47k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1383' href='#L_SELECT_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> if (<div class='tooltip'>TrueSI->getCondition()->getType() == CondVal->getType()<span class='tooltip-content'>6.47k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.47k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1384' href='#L_SELECT_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> // select(C, select(C, a, b), c) -> select(C, a, c)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1385' href='#L_SELECT_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> if (<div class='tooltip'>TrueSI->getCondition() == CondVal<span class='tooltip-content'>6.47k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1386' href='#L_SELECT_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (SI.getTrueValue() == TrueSI->getTrueValue())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1387' href='#L_SELECT_1387'><pre>1387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1388' href='#L_SELECT_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> SI.setOperand(1, TrueSI->getTrueValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1389' href='#L_SELECT_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return &SI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1390' href='#L_SELECT_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1391' href='#L_SELECT_1391'><pre>1391</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> // select(C0, select(C1, a, b), b) -> select(C0&C1, a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1392' href='#L_SELECT_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> // We choose this as normal form to enable folding on the And and shortening</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1393' href='#L_SELECT_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> // paths for the values (this helps GetUnderlyingObjects() for example).</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1394' href='#L_SELECT_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.46k</span></div><div class='tooltip'>TrueSI->getFalseValue() == FalseVal && <span class='tooltip-content'>6.46k</span></div><div class='tooltip'>TrueSI->hasOneUse()<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1395' href='#L_SELECT_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(CondVal, TrueSI->getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1396' href='#L_SELECT_1396'><pre>1396</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> SI.setOperand(0, And);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1397' href='#L_SELECT_1397'><pre>1397</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> SI.setOperand(1, TrueSI->getTrueValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1398' href='#L_SELECT_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return &SI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1399' href='#L_SELECT_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1400' href='#L_SELECT_1400'><pre>1400</pre></a></td><td class='covered-line'><pre>6.46k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1401' href='#L_SELECT_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>6.47k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1402' href='#L_SELECT_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>102k</span></div><div class='tooltip'>FalseSI<span class='tooltip-content'>102k</span></div> = dyn_cast<SelectInst>(FalseVal)) <div class='tooltip'>{<span class='tooltip-content'>4.39k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1403' href='#L_SELECT_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> if (<div class='tooltip'>FalseSI->getCondition()->getType() == CondVal->getType()<span class='tooltip-content'>4.39k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4.39k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1404' href='#L_SELECT_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> // select(C, a, select(C, b, c)) -> select(C, a, c)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1405' href='#L_SELECT_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> if (<div class='tooltip'>FalseSI->getCondition() == CondVal<span class='tooltip-content'>4.39k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>24</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1406' href='#L_SELECT_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> if (SI.getFalseValue() == FalseSI->getFalseValue())</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1407' href='#L_SELECT_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1408' href='#L_SELECT_1408'><pre>1408</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> SI.setOperand(2, FalseSI->getFalseValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1409' href='#L_SELECT_1409'><pre>1409</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> return &SI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1410' href='#L_SELECT_1410'><pre>1410</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1411' href='#L_SELECT_1411'><pre>1411</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> // select(C0, a, select(C1, a, b)) -> select(C0|C1, a, b)</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1412' href='#L_SELECT_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>4.37k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.37k</span></div><div class='tooltip'>FalseSI->getTrueValue() == TrueVal && <span class='tooltip-content'>4.37k</span></div><div class='tooltip'>FalseSI->hasOneUse()<span class='tooltip-content'>13</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1413' href='#L_SELECT_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> Value *Or = Builder->CreateOr(CondVal, FalseSI->getCondition());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1414' href='#L_SELECT_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> SI.setOperand(0, Or);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1415' href='#L_SELECT_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> SI.setOperand(2, FalseSI->getFalseValue());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1416' href='#L_SELECT_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return &SI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1417' href='#L_SELECT_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1418' href='#L_SELECT_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>4.37k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1419' href='#L_SELECT_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>4.39k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1420' href='#L_SELECT_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1421' href='#L_SELECT_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>102k</span></div><div class='tooltip'>BinaryOperator::isNot(CondVal)<span class='tooltip-content'>102k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>47</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1422' href='#L_SELECT_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> SI.setOperand(0, BinaryOperator::getNotArgument(CondVal));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1423' href='#L_SELECT_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> SI.setOperand(1, FalseVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1424' href='#L_SELECT_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> SI.setOperand(2, TrueVal);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1425' href='#L_SELECT_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> return &SI;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1426' href='#L_SELECT_1426'><pre>1426</pre></a></td><td class='covered-line'><pre>47</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1427' href='#L_SELECT_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>102k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1428' href='#L_SELECT_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> <div class='tooltip'>if (VectorType *<span class='tooltip-content'>101k</span></div><div class='tooltip'>VecTy<span class='tooltip-content'>101k</span></div> = dyn_cast<VectorType>(SelType)) <div class='tooltip'>{<span class='tooltip-content'>435</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1429' href='#L_SELECT_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> unsigned VWidth = VecTy->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1430' href='#L_SELECT_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> APInt UndefElts(VWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1431' href='#L_SELECT_1431'><pre>1431</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1432' href='#L_SELECT_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>435</span></div> = SimplifyDemandedVectorElts(&SI, AllOnesEltMask, UndefElts)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1433' href='#L_SELECT_1433'><pre>1433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>V != &SI</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1434' href='#L_SELECT_1434'><pre>1434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(SI, V)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1435' href='#L_SELECT_1435'><pre>1435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return &SI</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1436' href='#L_SELECT_1436'><pre>1436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1437' href='#L_SELECT_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1438' href='#L_SELECT_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>435</span></div><div class='tooltip'>isa<ConstantAggregateZero>(CondVal)<span class='tooltip-content'>435</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1439' href='#L_SELECT_1439'><pre>1439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(SI, FalseVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1440' href='#L_SELECT_1440'><pre>1440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1441' href='#L_SELECT_1441'><pre>1441</pre></a></td><td class='covered-line'><pre>435</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1442' href='#L_SELECT_1442'><pre>1442</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1443' href='#L_SELECT_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // See if we can determine the result of this select based on a dominating</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1444' href='#L_SELECT_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // condition.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1445' href='#L_SELECT_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> BasicBlock *Parent = SI.getParent();</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1446' href='#L_SELECT_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> if (BasicBlock *<div class='tooltip'>Dom<span class='tooltip-content'>101k</span></div> = Parent->getSinglePredecessor()) <div class='tooltip'>{<span class='tooltip-content'>54.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1447' href='#L_SELECT_1447'><pre>1447</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> auto *PBI = dyn_cast_or_null<BranchInst>(Dom->getTerminator());</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1448' href='#L_SELECT_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>PBI && <span class='tooltip-content'>54.7k</span></div><div class='tooltip'>PBI->isConditional()<span class='tooltip-content'>46.9k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1449' href='#L_SELECT_1449'><pre>1449</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> PBI->getSuccessor(0) != PBI->getSuccessor(1) &&</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1450' href='#L_SELECT_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> <div class='tooltip'>(PBI->getSuccessor(0) == Parent || <span class='tooltip-content'>46.9k</span></div><div class='tooltip'>PBI->getSuccessor(1) == Parent<span class='tooltip-content'>25.3k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>46.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1451' href='#L_SELECT_1451'><pre>1451</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> bool CondIsFalse = PBI->getSuccessor(1) == Parent;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1452' href='#L_SELECT_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> Optional<bool> Implication = isImpliedCondition(</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1453' href='#L_SELECT_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> PBI->getCondition(), SI.getCondition(), DL, CondIsFalse);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1454' href='#L_SELECT_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>Implication<span class='tooltip-content'>46.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>29</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1455' href='#L_SELECT_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>23</pre></td><td class='code'><pre> Value *V = *Implication ? <div class='tooltip'>TrueVal<span class='tooltip-content'>23</span></div> : <div class='tooltip'>FalseVal<span class='tooltip-content'>6</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1456' href='#L_SELECT_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> return replaceInstUsesWith(SI, V);</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1457' href='#L_SELECT_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1458' href='#L_SELECT_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>46.9k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1459' href='#L_SELECT_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1460' href='#L_SELECT_1460'><pre>1460</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1461' href='#L_SELECT_1461'><pre>1461</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // If we can compute the condition, there's no need for a select.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1462' href='#L_SELECT_1462'><pre>1462</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // Like the above fold, we are attempting to reduce compile-time cost by</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1463' href='#L_SELECT_1463'><pre>1463</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // putting this fold here with limitations rather than in InstSimplify.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1464' href='#L_SELECT_1464'><pre>1464</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // The motivation for this call into value tracking is to take advantage of</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1465' href='#L_SELECT_1465'><pre>1465</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // the assumption cache, so make sure that is populated.</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1466' href='#L_SELECT_1466'><pre>1466</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>101k</span></div><div class='tooltip'>!CondVal->getType()->isVectorTy() && <span class='tooltip-content'>101k</span></div><div class='tooltip'>!AC.assumptions().empty()<span class='tooltip-content'>101k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1467' href='#L_SELECT_1467'><pre>1467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt KnownOne(1, 0), KnownZero(1, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1468' href='#L_SELECT_1468'><pre>1468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> computeKnownBits(CondVal, KnownZero, KnownOne, 0, &SI);</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1469' href='#L_SELECT_1469'><pre>1469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>KnownOne == 1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1470' href='#L_SELECT_1470'><pre>1470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(SI, TrueVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1471' href='#L_SELECT_1471'><pre>1471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>KnownZero == 1</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1472' href='#L_SELECT_1472'><pre>1472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(SI, FalseVal)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1473' href='#L_SELECT_1473'><pre>1473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1474' href='#L_SELECT_1474'><pre>1474</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1475' href='#L_SELECT_1475'><pre>1475</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>101k</span></div><div class='tooltip'>BitCastSel<span class='tooltip-content'>101k</span></div> = foldSelectCmpBitcasts(SI, *Builder))</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1476' href='#L_SELECT_1476'><pre>1476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return BitCastSel</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1477' href='#L_SELECT_1477'><pre>1477</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1478' href='#L_SELECT_1478'><pre>1478</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SELECT_1479' href='#L_SELECT_1479'><pre>1479</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='SHIFTS' href='#SHIFTS'>lib/Transforms/InstCombine/InstCombineShifts.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_SHIFTS_105'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_1' href='#L_SHIFTS_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineShifts.cpp ----------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_2' href='#L_SHIFTS_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_3' href='#L_SHIFTS_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_4' href='#L_SHIFTS_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_5' href='#L_SHIFTS_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_6' href='#L_SHIFTS_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_7' href='#L_SHIFTS_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_8' href='#L_SHIFTS_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_9' href='#L_SHIFTS_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_10' href='#L_SHIFTS_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements the visitShl, visitLShr, and visitAShr functions.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_11' href='#L_SHIFTS_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_12' href='#L_SHIFTS_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_13' href='#L_SHIFTS_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_14' href='#L_SHIFTS_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_15' href='#L_SHIFTS_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ConstantFolding.h"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_16' href='#L_SHIFTS_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_17' href='#L_SHIFTS_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_18' href='#L_SHIFTS_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_19' href='#L_SHIFTS_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_20' href='#L_SHIFTS_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_21' href='#L_SHIFTS_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_22' href='#L_SHIFTS_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_23' href='#L_SHIFTS_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_24' href='#L_SHIFTS_24'><pre>24</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre>Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_25' href='#L_SHIFTS_25'><pre>25</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_26' href='#L_SHIFTS_26'><pre>26</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre> assert(Op0->getType() == Op1->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_27' href='#L_SHIFTS_27'><pre>27</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_28' href='#L_SHIFTS_28'><pre>28</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre> // See if we can fold away this shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_29' href='#L_SHIFTS_29'><pre>29</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre> if (SimplifyDemandedInstructionBits(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_30' href='#L_SHIFTS_30'><pre>30</pre></a></td><td class='covered-line'><pre>661</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_31' href='#L_SHIFTS_31'><pre>31</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_32' href='#L_SHIFTS_32'><pre>32</pre></a></td><td class='covered-line'><pre>189k</pre></td><td class='code'><pre> // Try to fold constant and into select arguments.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_33' href='#L_SHIFTS_33'><pre>33</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>188k</span></div><div class='tooltip'>isa<Constant>(Op0)<span class='tooltip-content'>188k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_34' href='#L_SHIFTS_34'><pre>34</pre></a></td><td class='covered-line'><pre>7.29k</pre></td><td class='code'><pre> <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>7.29k</span></div><div class='tooltip'>SI<span class='tooltip-content'>7.29k</span></div> = dyn_cast<SelectInst>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_35' href='#L_SHIFTS_35'><pre>35</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>39</span></div><div class='tooltip'>R<span class='tooltip-content'>39</span></div> = FoldOpIntoSelect(I, SI))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_36' href='#L_SHIFTS_36'><pre>36</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_37' href='#L_SHIFTS_37'><pre>37</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_38' href='#L_SHIFTS_38'><pre>38</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>188k</span></div><div class='tooltip'>CUI<span class='tooltip-content'>188k</span></div> = dyn_cast<Constant>(Op1))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_39' href='#L_SHIFTS_39'><pre>39</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>165k</span></div><div class='tooltip'>Res<span class='tooltip-content'>165k</span></div> = FoldShiftByConstant(Op0, CUI, I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_40' href='#L_SHIFTS_40'><pre>40</pre></a></td><td class='covered-line'><pre>1.46k</pre></td><td class='code'><pre> return Res;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_41' href='#L_SHIFTS_41'><pre>41</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_42' href='#L_SHIFTS_42'><pre>42</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre> // (C1 shift (A add C2)) -> (C1 shift C2) shift A)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_43' href='#L_SHIFTS_43'><pre>43</pre></a></td><td class='covered-line'><pre>188k</pre></td><td class='code'><pre> // iff A and C2 are both positive.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_44' href='#L_SHIFTS_44'><pre>44</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> Value *A;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_45' href='#L_SHIFTS_45'><pre>45</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> Constant *C;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_46' href='#L_SHIFTS_46'><pre>46</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Constant()) && <span class='tooltip-content'>186k</span></div><div class='tooltip'>match(Op1, m_Add(m_Value(A), m_Constant(C)))<span class='tooltip-content'>7.28k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_47' href='#L_SHIFTS_47'><pre>47</pre></a></td><td class='covered-line'><pre>1.26k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1.26k</span></div><div class='tooltip'>isKnownNonNegative(A, DL) && <span class='tooltip-content'>1.26k</span></div><div class='tooltip'>isKnownNonNegative(C, DL)<span class='tooltip-content'>49</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_48' href='#L_SHIFTS_48'><pre>48</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return BinaryOperator::Create(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_49' href='#L_SHIFTS_49'><pre>49</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> I.getOpcode(), Builder->CreateBinOp(I.getOpcode(), Op0, C), A);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_50' href='#L_SHIFTS_50'><pre>50</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_51' href='#L_SHIFTS_51'><pre>51</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> // X shift (A srem B) -> X shift (A and B-1) iff B is a power of 2.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_52' href='#L_SHIFTS_52'><pre>52</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> // Because shifts by negative values (which could occur if A were negative)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_53' href='#L_SHIFTS_53'><pre>53</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> // are undefined.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_54' href='#L_SHIFTS_54'><pre>54</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> const APInt *B;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_55' href='#L_SHIFTS_55'><pre>55</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op1->hasOneUse() && <span class='tooltip-content'>186k</span></div><div class='tooltip'>match(Op1, m_SRem(m_Value(A), m_Power2(B)))<span class='tooltip-content'>15.5k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_56' href='#L_SHIFTS_56'><pre>56</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // FIXME: Should this get moved into SimplifyDemandedBits by saying we don't</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_57' href='#L_SHIFTS_57'><pre>57</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // demand the sign bit (and many others) here??</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_58' href='#L_SHIFTS_58'><pre>58</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *Rem = Builder->CreateAnd(A, ConstantInt::get(I.getType(), *B-1),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_59' href='#L_SHIFTS_59'><pre>59</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Op1->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_60' href='#L_SHIFTS_60'><pre>60</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> I.setOperand(1, Rem);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_61' href='#L_SHIFTS_61'><pre>61</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_62' href='#L_SHIFTS_62'><pre>62</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_63' href='#L_SHIFTS_63'><pre>63</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_64' href='#L_SHIFTS_64'><pre>64</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_65' href='#L_SHIFTS_65'><pre>65</pre></a></td><td class='covered-line'><pre>186k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_66' href='#L_SHIFTS_66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_67' href='#L_SHIFTS_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we can simplify two logical (either left or right) shifts</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_68' href='#L_SHIFTS_68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that have constant shift amounts: OuterShift (InnerShift X, C1), C2.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_69' href='#L_SHIFTS_69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canEvaluateShiftedShift(unsigned OuterShAmt, bool IsOuterShl,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_70' href='#L_SHIFTS_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *InnerShift, InstCombiner &IC,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_71' href='#L_SHIFTS_71'><pre>71</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_72' href='#L_SHIFTS_72'><pre>72</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> assert(InnerShift->isLogicalShift() && "Unexpected instruction type");</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_73' href='#L_SHIFTS_73'><pre>73</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_74' href='#L_SHIFTS_74'><pre>74</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> // We need constant scalar or constant splat shifts.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_75' href='#L_SHIFTS_75'><pre>75</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> const APInt *InnerShiftConst;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_76' href='#L_SHIFTS_76'><pre>76</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> if (!match(InnerShift->getOperand(1), m_APInt(InnerShiftConst)))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_77' href='#L_SHIFTS_77'><pre>77</pre></a></td><td class='covered-line'><pre>735</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_78' href='#L_SHIFTS_78'><pre>78</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_79' href='#L_SHIFTS_79'><pre>79</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> // Two logical shifts in the same direction:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_80' href='#L_SHIFTS_80'><pre>80</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> // shl (shl X, C1), C2 --> shl X, C1 + C2</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_81' href='#L_SHIFTS_81'><pre>81</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> // lshr (lshr X, C1), C2 --> lshr X, C1 + C2</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_82' href='#L_SHIFTS_82'><pre>82</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> bool IsInnerShl = InnerShift->getOpcode() == Instruction::Shl;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_83' href='#L_SHIFTS_83'><pre>83</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> if (IsInnerShl == IsOuterShl)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_84' href='#L_SHIFTS_84'><pre>84</pre></a></td><td class='covered-line'><pre>361</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_85' href='#L_SHIFTS_85'><pre>85</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_86' href='#L_SHIFTS_86'><pre>86</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> // Equal shift amounts in opposite directions become bitwise 'and':</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_87' href='#L_SHIFTS_87'><pre>87</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> // lshr (shl X, C), C --> and X, C'</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_88' href='#L_SHIFTS_88'><pre>88</pre></a></td><td class='covered-line'><pre>1.51k</pre></td><td class='code'><pre> // shl (lshr X, C), C --> and X, C'</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_89' href='#L_SHIFTS_89'><pre>89</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> unsigned InnerShAmt = InnerShiftConst->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_90' href='#L_SHIFTS_90'><pre>90</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> if (InnerShAmt == OuterShAmt)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_91' href='#L_SHIFTS_91'><pre>91</pre></a></td><td class='covered-line'><pre>713</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_92' href='#L_SHIFTS_92'><pre>92</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_93' href='#L_SHIFTS_93'><pre>93</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // If the 2nd shift is bigger than the 1st, we can fold:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_94' href='#L_SHIFTS_94'><pre>94</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // lshr (shl X, C1), C2 --> and (shl X, C1 - C2), C3</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_95' href='#L_SHIFTS_95'><pre>95</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // shl (lshr X, C1), C2 --> and (lshr X, C1 - C2), C3</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_96' href='#L_SHIFTS_96'><pre>96</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // but it isn't profitable unless we know the and'd out bits are already zero.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_97' href='#L_SHIFTS_97'><pre>97</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // Also, check that the inner shift is valid (less than the type width) or</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_98' href='#L_SHIFTS_98'><pre>98</pre></a></td><td class='covered-line'><pre>1.14k</pre></td><td class='code'><pre> // we'll crash trying to produce the bit mask for the 'and'.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_99' href='#L_SHIFTS_99'><pre>99</pre></a></td><td class='covered-line'><pre>436</pre></td><td class='code'><pre> unsigned TypeWidth = InnerShift->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_100' href='#L_SHIFTS_100'><pre>100</pre></a></td><td class='covered-line'><pre>436</pre></td><td class='code'><pre> if (<div class='tooltip'>InnerShAmt > OuterShAmt && <span class='tooltip-content'>436</span></div><div class='tooltip'>InnerShAmt < TypeWidth<span class='tooltip-content'>195</span></div>) <div class='tooltip'>{<span class='tooltip-content'>195</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_101' href='#L_SHIFTS_101'><pre>101</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> unsigned MaskShift =</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_102' href='#L_SHIFTS_102'><pre>102</pre></a></td><td class='covered-line'><pre>143</pre></td><td class='code'><pre> IsInnerShl ? <div class='tooltip'>TypeWidth - InnerShAmt<span class='tooltip-content'>52</span></div> : <div class='tooltip'>InnerShAmt - OuterShAmt<span class='tooltip-content'>143</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_103' href='#L_SHIFTS_103'><pre>103</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> APInt Mask = APInt::getLowBitsSet(TypeWidth, OuterShAmt) << MaskShift;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_104' href='#L_SHIFTS_104'><pre>104</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> if (IC.MaskedValueIsZero(InnerShift->getOperand(0), Mask, 0, CxtI))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_105' href='#L_SHIFTS_105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_106' href='#L_SHIFTS_106'><pre>106</pre></a></td><td class='covered-line'><pre>195</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_107' href='#L_SHIFTS_107'><pre>107</pre></a></td><td class='covered-line'><pre>436</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_108' href='#L_SHIFTS_108'><pre>108</pre></a></td><td class='covered-line'><pre>436</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_109' href='#L_SHIFTS_109'><pre>109</pre></a></td><td class='covered-line'><pre>436</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_110' href='#L_SHIFTS_110'><pre>110</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_111' href='#L_SHIFTS_111'><pre>111</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// See if we can compute the specified value, but shifted logically to the left</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_112' href='#L_SHIFTS_112'><pre>112</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// or right by some number of bits. This should return true if the expression</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_113' href='#L_SHIFTS_113'><pre>113</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// can be computed for the same cost as the current expression tree. This is</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_114' href='#L_SHIFTS_114'><pre>114</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// used to eliminate extraneous shifting from things like:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_115' href='#L_SHIFTS_115'><pre>115</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %C = shl i128 %A, 64</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_116' href='#L_SHIFTS_116'><pre>116</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %D = shl i128 %B, 96</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_117' href='#L_SHIFTS_117'><pre>117</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %E = or i128 %C, %D</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_118' href='#L_SHIFTS_118'><pre>118</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %F = lshr i128 %E, 64</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_119' href='#L_SHIFTS_119'><pre>119</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// where the client will ask if E can be computed shifted right by 64-bits. If</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_120' href='#L_SHIFTS_120'><pre>120</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// this succeeds, getShiftedValue() will be called to produce the value.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_121' href='#L_SHIFTS_121'><pre>121</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_122' href='#L_SHIFTS_122'><pre>122</pre></a></td><td class='covered-line'><pre>137k</pre></td><td class='code'><pre> InstCombiner &IC, Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_123' href='#L_SHIFTS_123'><pre>123</pre></a></td><td class='covered-line'><pre>137k</pre></td><td class='code'><pre> // We can always evaluate constants shifted.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_124' href='#L_SHIFTS_124'><pre>124</pre></a></td><td class='covered-line'><pre>137k</pre></td><td class='code'><pre> if (isa<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_125' href='#L_SHIFTS_125'><pre>125</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_126' href='#L_SHIFTS_126'><pre>126</pre></a></td><td class='covered-line'><pre>137k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_127' href='#L_SHIFTS_127'><pre>127</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_128' href='#L_SHIFTS_128'><pre>128</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>136k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>5.42k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_129' href='#L_SHIFTS_129'><pre>129</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_130' href='#L_SHIFTS_130'><pre>130</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // If this is the opposite shift, we can directly reuse the input of the shift</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_131' href='#L_SHIFTS_131'><pre>131</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // if the needed bits are already zero in the input. This allows us to reuse</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_132' href='#L_SHIFTS_132'><pre>132</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // the value which means that we don't care if the shift has multiple uses.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_133' href='#L_SHIFTS_133'><pre>133</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> // TODO: Handle opposite shift by exact value.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_134' href='#L_SHIFTS_134'><pre>134</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> ConstantInt *CI = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_135' href='#L_SHIFTS_135'><pre>135</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> if (<div class='tooltip'>(IsLeftShift && <span class='tooltip-content'>131k</span></div><div class='tooltip'>match(I, m_LShr(m_Value(), m_ConstantInt(CI)))<span class='tooltip-content'>84.6k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_136' href='#L_SHIFTS_136'><pre>136</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> <div class='tooltip'>(!IsLeftShift && <span class='tooltip-content'>129k</span></div><div class='tooltip'>match(I, m_Shl(m_Value(), m_ConstantInt(CI)))<span class='tooltip-content'>46.4k</span></div>)) <div class='tooltip'>{<span class='tooltip-content'>1.52k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_137' href='#L_SHIFTS_137'><pre>137</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> if (<div class='tooltip'>CI->getZExtValue() == NumBits<span class='tooltip-content'>1.52k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>783</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_138' href='#L_SHIFTS_138'><pre>138</pre></a></td><td class='covered-line'><pre>783</pre></td><td class='code'><pre> // TODO: Check that the input bits are already zero with MaskedValueIsZero</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_139' href='#L_SHIFTS_139'><pre>139</pre></a></td><td class='covered-line'><pre>783</pre></td><td class='code'><pre>#if 0</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_140' href='#L_SHIFTS_140'><pre>140</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // If this is a truncate of a logical shr, we can truncate it to a smaller</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_141' href='#L_SHIFTS_141'><pre>141</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // lshr iff we know that the bits we would otherwise be shifting in are</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_142' href='#L_SHIFTS_142'><pre>142</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // already zeros.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_143' href='#L_SHIFTS_143'><pre>143</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_144' href='#L_SHIFTS_144'><pre>144</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> uint32_t BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_145' href='#L_SHIFTS_145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if (MaskedValueIsZero(I->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_146' href='#L_SHIFTS_146'><pre>146</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt::getHighBitsSet(OrigBitWidth, OrigBitWidth-BitWidth)) &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_147' href='#L_SHIFTS_147'><pre>147</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> CI->getLimitedValue(BitWidth) < BitWidth) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_148' href='#L_SHIFTS_148'><pre>148</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return CanEvaluateTruncated(I->getOperand(0), Ty);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_149' href='#L_SHIFTS_149'><pre>149</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_150' href='#L_SHIFTS_150'><pre>150</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#endif</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_151' href='#L_SHIFTS_151'><pre>151</pre></a></td><td class='covered-line'><pre>783</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_152' href='#L_SHIFTS_152'><pre>152</pre></a></td><td class='covered-line'><pre>783</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_153' href='#L_SHIFTS_153'><pre>153</pre></a></td><td class='covered-line'><pre>1.52k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_154' href='#L_SHIFTS_154'><pre>154</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_155' href='#L_SHIFTS_155'><pre>155</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> // We can't mutate something that has multiple uses: doing so would</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_156' href='#L_SHIFTS_156'><pre>156</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> // require duplicating the instruction in general, which isn't profitable.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_157' href='#L_SHIFTS_157'><pre>157</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>131k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>64.9k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_158' href='#L_SHIFTS_158'><pre>158</pre></a></td><td class='covered-line'><pre>131k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_159' href='#L_SHIFTS_159'><pre>159</pre></a></td><td class='covered-line'><pre>66.1k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_160' href='#L_SHIFTS_160'><pre>160</pre></a></td><td class='covered-line'><pre>57.3k</pre></td><td class='code'><pre> default: return false;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_161' href='#L_SHIFTS_161'><pre>161</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_162' href='#L_SHIFTS_162'><pre>162</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_163' href='#L_SHIFTS_163'><pre>163</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_164' href='#L_SHIFTS_164'><pre>164</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> // Bitwise operators can all arbitrarily be arbitrarily evaluated shifted.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_165' href='#L_SHIFTS_165'><pre>165</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre> return canEvaluateShifted(I->getOperand(0), NumBits, IsLeftShift, IC, I) &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_166' href='#L_SHIFTS_166'><pre>166</pre></a></td><td class='covered-line'><pre>892</pre></td><td class='code'><pre> canEvaluateShifted(I->getOperand(1), NumBits, IsLeftShift, IC, I);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_167' href='#L_SHIFTS_167'><pre>167</pre></a></td><td class='covered-line'><pre>2.67k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_168' href='#L_SHIFTS_168'><pre>168</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_169' href='#L_SHIFTS_169'><pre>169</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_170' href='#L_SHIFTS_170'><pre>170</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> return canEvaluateShiftedShift(NumBits, IsLeftShift, I, IC, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_171' href='#L_SHIFTS_171'><pre>171</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_172' href='#L_SHIFTS_172'><pre>172</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> case Instruction::Select: {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_173' href='#L_SHIFTS_173'><pre>173</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> SelectInst *SI = cast<SelectInst>(I);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_174' href='#L_SHIFTS_174'><pre>174</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> Value *TrueVal = SI->getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_175' href='#L_SHIFTS_175'><pre>175</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> Value *FalseVal = SI->getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_176' href='#L_SHIFTS_176'><pre>176</pre></a></td><td class='covered-line'><pre>362</pre></td><td class='code'><pre> return canEvaluateShifted(TrueVal, NumBits, IsLeftShift, IC, SI) &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_177' href='#L_SHIFTS_177'><pre>177</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> canEvaluateShifted(FalseVal, NumBits, IsLeftShift, IC, SI);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_178' href='#L_SHIFTS_178'><pre>178</pre></a></td><td class='covered-line'><pre>2.24k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_179' href='#L_SHIFTS_179'><pre>179</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_180' href='#L_SHIFTS_180'><pre>180</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> // We can change a phi if we can change all operands. Note that we never</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_181' href='#L_SHIFTS_181'><pre>181</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> // get into trouble with cyclic PHIs here because we only consider</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_182' href='#L_SHIFTS_182'><pre>182</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> // instructions with a single use.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_183' href='#L_SHIFTS_183'><pre>183</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> PHINode *PN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_184' href='#L_SHIFTS_184'><pre>184</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> for (Value *IncValue : PN->incoming_values())</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_185' href='#L_SHIFTS_185'><pre>185</pre></a></td><td class='covered-line'><pre>4.12k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>4.12k</span></div><div class='tooltip'>!canEvaluateShifted(IncValue, NumBits, IsLeftShift, IC, PN)<span class='tooltip-content'>4.12k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_186' href='#L_SHIFTS_186'><pre>186</pre></a></td><td class='covered-line'><pre>3.46k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_187' href='#L_SHIFTS_187'><pre>187</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_188' href='#L_SHIFTS_188'><pre>188</pre></a></td><td class='covered-line'><pre>3.47k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_189' href='#L_SHIFTS_189'><pre>189</pre></a></td><td class='covered-line'><pre>66.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_190' href='#L_SHIFTS_190'><pre>190</pre></a></td><td class='covered-line'><pre>66.1k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_191' href='#L_SHIFTS_191'><pre>191</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_192' href='#L_SHIFTS_192'><pre>192</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Fold OuterShift (InnerShift X, C1), C2.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_193' href='#L_SHIFTS_193'><pre>193</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// See canEvaluateShiftedShift() for the constraints on these instructions.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_194' href='#L_SHIFTS_194'><pre>194</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *foldShiftedShift(BinaryOperator *InnerShift, unsigned OuterShAmt,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_195' href='#L_SHIFTS_195'><pre>195</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> bool IsOuterShl,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_196' href='#L_SHIFTS_196'><pre>196</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> InstCombiner::BuilderTy &Builder) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_197' href='#L_SHIFTS_197'><pre>197</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> bool IsInnerShl = InnerShift->getOpcode() == Instruction::Shl;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_198' href='#L_SHIFTS_198'><pre>198</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> Type *ShType = InnerShift->getType();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_199' href='#L_SHIFTS_199'><pre>199</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> unsigned TypeWidth = ShType->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_200' href='#L_SHIFTS_200'><pre>200</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_201' href='#L_SHIFTS_201'><pre>201</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // We only accept shifts-by-a-constant in canEvaluateShifted().</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_202' href='#L_SHIFTS_202'><pre>202</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> const APInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_203' href='#L_SHIFTS_203'><pre>203</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> match(InnerShift->getOperand(1), m_APInt(C1));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_204' href='#L_SHIFTS_204'><pre>204</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> unsigned InnerShAmt = C1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_205' href='#L_SHIFTS_205'><pre>205</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_206' href='#L_SHIFTS_206'><pre>206</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // Change the shift amount and clear the appropriate IR flags.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_207' href='#L_SHIFTS_207'><pre>207</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> auto NewInnerShift = [&](unsigned ShAmt) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_208' href='#L_SHIFTS_208'><pre>208</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> InnerShift->setOperand(1, ConstantInt::get(ShType, ShAmt));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_209' href='#L_SHIFTS_209'><pre>209</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> if (<div class='tooltip'>IsInnerShl<span class='tooltip-content'>9</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_210' href='#L_SHIFTS_210'><pre>210</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> InnerShift->setHasNoUnsignedWrap(false);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_211' href='#L_SHIFTS_211'><pre>211</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> InnerShift->setHasNoSignedWrap(false);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_212' href='#L_SHIFTS_212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_213' href='#L_SHIFTS_213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InnerShift->setIsExact(false);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_214' href='#L_SHIFTS_214'><pre>214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_215' href='#L_SHIFTS_215'><pre>215</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return InnerShift;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_216' href='#L_SHIFTS_216'><pre>216</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> };</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_217' href='#L_SHIFTS_217'><pre>217</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_218' href='#L_SHIFTS_218'><pre>218</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // Two logical shifts in the same direction:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_219' href='#L_SHIFTS_219'><pre>219</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // shl (shl X, C1), C2 --> shl X, C1 + C2</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_220' href='#L_SHIFTS_220'><pre>220</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // lshr (lshr X, C1), C2 --> lshr X, C1 + C2</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_221' href='#L_SHIFTS_221'><pre>221</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> if (<div class='tooltip'>IsInnerShl == IsOuterShl<span class='tooltip-content'>697</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_222' href='#L_SHIFTS_222'><pre>222</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> // If this is an oversized composite shift, then unsigned shifts get 0.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_223' href='#L_SHIFTS_223'><pre>223</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> if (InnerShAmt + OuterShAmt >= TypeWidth)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_224' href='#L_SHIFTS_224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Constant::getNullValue(ShType)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_225' href='#L_SHIFTS_225'><pre>225</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_226' href='#L_SHIFTS_226'><pre>226</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return NewInnerShift(InnerShAmt + OuterShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_227' href='#L_SHIFTS_227'><pre>227</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_228' href='#L_SHIFTS_228'><pre>228</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_229' href='#L_SHIFTS_229'><pre>229</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // Equal shift amounts in opposite directions become bitwise 'and':</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_230' href='#L_SHIFTS_230'><pre>230</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // lshr (shl X, C), C --> and X, C'</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_231' href='#L_SHIFTS_231'><pre>231</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> // shl (lshr X, C), C --> and X, C'</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_232' href='#L_SHIFTS_232'><pre>232</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>688</span></div><div class='tooltip'>InnerShAmt == OuterShAmt<span class='tooltip-content'>688</span></div>) <div class='tooltip'>{<span class='tooltip-content'>688</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_233' href='#L_SHIFTS_233'><pre>233</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> APInt Mask = IsInnerShl</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_234' href='#L_SHIFTS_234'><pre>234</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ? APInt::getLowBitsSet(TypeWidth, TypeWidth - OuterShAmt)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_235' href='#L_SHIFTS_235'><pre>235</pre></a></td><td class='covered-line'><pre>687</pre></td><td class='code'><pre> : APInt::getHighBitsSet(TypeWidth, TypeWidth - OuterShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_236' href='#L_SHIFTS_236'><pre>236</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> Value *And = Builder.CreateAnd(InnerShift->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_237' href='#L_SHIFTS_237'><pre>237</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> ConstantInt::get(ShType, Mask));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_238' href='#L_SHIFTS_238'><pre>238</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>AndI<span class='tooltip-content'>688</span></div> = dyn_cast<Instruction>(And)) <div class='tooltip'>{<span class='tooltip-content'>688</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_239' href='#L_SHIFTS_239'><pre>239</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> AndI->moveBefore(InnerShift);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_240' href='#L_SHIFTS_240'><pre>240</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> AndI->takeName(InnerShift);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_241' href='#L_SHIFTS_241'><pre>241</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_242' href='#L_SHIFTS_242'><pre>242</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> return And;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_243' href='#L_SHIFTS_243'><pre>243</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_244' href='#L_SHIFTS_244'><pre>244</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_245' href='#L_SHIFTS_245'><pre>245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> assert<span class='red'>(InnerShAmt > OuterShAmt &&</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_246' href='#L_SHIFTS_246'><pre>246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> "Unexpected opposite direction logical shift pair");</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_247' href='#L_SHIFTS_247'><pre>247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_248' href='#L_SHIFTS_248'><pre>248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // In general, we would need an 'and' for this transform, but</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_249' href='#L_SHIFTS_249'><pre>249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // canEvaluateShiftedShift() guarantees that the masked-off bits are not used.</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_250' href='#L_SHIFTS_250'><pre>250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // lshr (shl X, C1), C2 --> shl X, C1 - C2</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_251' href='#L_SHIFTS_251'><pre>251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shl (lshr X, C1), C2 --> lshr X, C1 - C2</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_252' href='#L_SHIFTS_252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewInnerShift(InnerShAmt - OuterShAmt)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_253' href='#L_SHIFTS_253'><pre>253</pre></a></td><td class='covered-line'><pre>688</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_254' href='#L_SHIFTS_254'><pre>254</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_255' href='#L_SHIFTS_255'><pre>255</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// When canEvaluateShifted() returns true for an expression, this function</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_256' href='#L_SHIFTS_256'><pre>256</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// inserts the new computation that produces the shifted value.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_257' href='#L_SHIFTS_257'><pre>257</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *getShiftedValue(Value *V, unsigned NumBits, bool isLeftShift,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_258' href='#L_SHIFTS_258'><pre>258</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre> InstCombiner &IC, const DataLayout &DL) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_259' href='#L_SHIFTS_259'><pre>259</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre> // We can always evaluate constants shifted.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_260' href='#L_SHIFTS_260'><pre>260</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>1.70k</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'>{<span class='tooltip-content'>514</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_261' href='#L_SHIFTS_261'><pre>261</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> if (isLeftShift)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_262' href='#L_SHIFTS_262'><pre>262</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> V = IC.Builder->CreateShl(C, NumBits);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_263' href='#L_SHIFTS_263'><pre>263</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_264' href='#L_SHIFTS_264'><pre>264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = IC.Builder->CreateLShr(C, NumBits)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_265' href='#L_SHIFTS_265'><pre>265</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> // If we got a constantexpr back, try to simplify it with TD info.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_266' href='#L_SHIFTS_266'><pre>266</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> if (auto *C = dyn_cast<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_267' href='#L_SHIFTS_267'><pre>267</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>514</span></div><div class='tooltip'>FoldedC<span class='tooltip-content'>514</span></div> =</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_268' href='#L_SHIFTS_268'><pre>268</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> ConstantFoldConstant(C, DL, &IC.getTargetLibraryInfo()))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_269' href='#L_SHIFTS_269'><pre>269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>V = FoldedC</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_270' href='#L_SHIFTS_270'><pre>270</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_271' href='#L_SHIFTS_271'><pre>271</pre></a></td><td class='covered-line'><pre>514</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_272' href='#L_SHIFTS_272'><pre>272</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_273' href='#L_SHIFTS_273'><pre>273</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> Instruction *I = cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_274' href='#L_SHIFTS_274'><pre>274</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> IC.Worklist.Add(I);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_275' href='#L_SHIFTS_275'><pre>275</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_276' href='#L_SHIFTS_276'><pre>276</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_277' href='#L_SHIFTS_277'><pre>277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>default: </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><span class='red'>("Inconsistency with CanEvaluateShifted");</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_278' href='#L_SHIFTS_278'><pre>278</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre><span class='red'> </span>case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_279' href='#L_SHIFTS_279'><pre>279</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_280' href='#L_SHIFTS_280'><pre>280</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_281' href='#L_SHIFTS_281'><pre>281</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> // Bitwise operators can all arbitrarily be arbitrarily evaluated shifted.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_282' href='#L_SHIFTS_282'><pre>282</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> I->setOperand(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_283' href='#L_SHIFTS_283'><pre>283</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> 0, getShiftedValue(I->getOperand(0), NumBits, isLeftShift, IC, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_284' href='#L_SHIFTS_284'><pre>284</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> I->setOperand(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_285' href='#L_SHIFTS_285'><pre>285</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> 1, getShiftedValue(I->getOperand(1), NumBits, isLeftShift, IC, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_286' href='#L_SHIFTS_286'><pre>286</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_287' href='#L_SHIFTS_287'><pre>287</pre></a></td><td class='covered-line'><pre>478</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_288' href='#L_SHIFTS_288'><pre>288</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_289' href='#L_SHIFTS_289'><pre>289</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_290' href='#L_SHIFTS_290'><pre>290</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> return foldShiftedShift(cast<BinaryOperator>(I), NumBits, isLeftShift,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_291' href='#L_SHIFTS_291'><pre>291</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> *(IC.Builder));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_292' href='#L_SHIFTS_292'><pre>292</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_293' href='#L_SHIFTS_293'><pre>293</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> case Instruction::Select:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_294' href='#L_SHIFTS_294'><pre>294</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> I->setOperand(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_295' href='#L_SHIFTS_295'><pre>295</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> 1, getShiftedValue(I->getOperand(1), NumBits, isLeftShift, IC, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_296' href='#L_SHIFTS_296'><pre>296</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> I->setOperand(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_297' href='#L_SHIFTS_297'><pre>297</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> 2, getShiftedValue(I->getOperand(2), NumBits, isLeftShift, IC, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_298' href='#L_SHIFTS_298'><pre>298</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_299' href='#L_SHIFTS_299'><pre>299</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> case Instruction::PHI: {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_300' href='#L_SHIFTS_300'><pre>300</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // We can change a phi if we can change all operands. Note that we never</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_301' href='#L_SHIFTS_301'><pre>301</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // get into trouble with cyclic PHIs here because we only consider</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_302' href='#L_SHIFTS_302'><pre>302</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> // instructions with a single use.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_303' href='#L_SHIFTS_303'><pre>303</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> PHINode *PN = cast<PHINode>(I);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_304' href='#L_SHIFTS_304'><pre>304</pre></a></td><td class='covered-line'><pre>38</pre></td><td class='code'><pre> for (unsigned i = 0, e = PN->getNumIncomingValues(); <div class='tooltip'>i != e<span class='tooltip-content'>38</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>30</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_305' href='#L_SHIFTS_305'><pre>305</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> PN->setIncomingValue(i, getShiftedValue(PN->getIncomingValue(i), NumBits,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_306' href='#L_SHIFTS_306'><pre>306</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> isLeftShift, IC, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_307' href='#L_SHIFTS_307'><pre>307</pre></a></td><td class='covered-line'><pre>8</pre></td><td class='code'><pre> return PN;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_308' href='#L_SHIFTS_308'><pre>308</pre></a></td><td class='covered-line'><pre>697</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_309' href='#L_SHIFTS_309'><pre>309</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_310' href='#L_SHIFTS_310'><pre>310</pre></a></td><td class='covered-line'><pre>1.19k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_311' href='#L_SHIFTS_311'><pre>311</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_312' href='#L_SHIFTS_312'><pre>312</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, Constant *Op1,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_313' href='#L_SHIFTS_313'><pre>313</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_314' href='#L_SHIFTS_314'><pre>314</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> bool isLeftShift = I.getOpcode() == Instruction::Shl;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_315' href='#L_SHIFTS_315'><pre>315</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_316' href='#L_SHIFTS_316'><pre>316</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> const APInt *Op1C;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_317' href='#L_SHIFTS_317'><pre>317</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> if (!match(Op1, m_APInt(Op1C)))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_318' href='#L_SHIFTS_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_319' href='#L_SHIFTS_319'><pre>319</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_320' href='#L_SHIFTS_320'><pre>320</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> // See if we can propagate this shift into the input, this covers the trivial</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_321' href='#L_SHIFTS_321'><pre>321</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> // cast of lshr(shl(x,c1),c2) as well as other more complex cases.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_322' href='#L_SHIFTS_322'><pre>322</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>165k</span></div><div class='tooltip'>I.getOpcode() != Instruction::AShr &&<span class='tooltip-content'>165k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_323' href='#L_SHIFTS_323'><pre>323</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> <div class='tooltip'>canEvaluateShifted(Op0, Op1C->getZExtValue(), isLeftShift, *this, &I)<span class='tooltip-content'>129k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>704</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_324' href='#L_SHIFTS_324'><pre>324</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> DEBUG(dbgs() << "ICE: GetShiftedValue propagating shift through expression"</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_325' href='#L_SHIFTS_325'><pre>325</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> " to eliminate shift:\n IN: " << *Op0 << "\n SH: " << I <<"\n");</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_326' href='#L_SHIFTS_326'><pre>326</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_327' href='#L_SHIFTS_327'><pre>327</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> return replaceInstUsesWith(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_328' href='#L_SHIFTS_328'><pre>328</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> I, getShiftedValue(Op0, Op1C->getZExtValue(), isLeftShift, *this, DL));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_329' href='#L_SHIFTS_329'><pre>329</pre></a></td><td class='covered-line'><pre>704</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_330' href='#L_SHIFTS_330'><pre>330</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_331' href='#L_SHIFTS_331'><pre>331</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> // See if we can simplify any instructions used by the instruction whose sole</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_332' href='#L_SHIFTS_332'><pre>332</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> // purpose is to compute bits we don't care about.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_333' href='#L_SHIFTS_333'><pre>333</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> unsigned TypeBits = Op0->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_334' href='#L_SHIFTS_334'><pre>334</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_335' href='#L_SHIFTS_335'><pre>335</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> assert(!Op1C->uge(TypeBits) &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_336' href='#L_SHIFTS_336'><pre>336</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> "Shift over the type width should have been removed already");</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_337' href='#L_SHIFTS_337'><pre>337</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_338' href='#L_SHIFTS_338'><pre>338</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> if (Instruction *FoldedShift = foldOpWithConstantIntoOperand(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_339' href='#L_SHIFTS_339'><pre>339</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return FoldedShift;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_340' href='#L_SHIFTS_340'><pre>340</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_341' href='#L_SHIFTS_341'><pre>341</pre></a></td><td class='covered-line'><pre>165k</pre></td><td class='code'><pre> // Fold shift2(trunc(shift1(x,c1)), c2) -> trunc(shift2(shift1(x,c1),c2))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_342' href='#L_SHIFTS_342'><pre>342</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre> <div class='tooltip'>if (TruncInst *<span class='tooltip-content'>164k</span></div><div class='tooltip'>TI<span class='tooltip-content'>164k</span></div> = dyn_cast<TruncInst>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>2.13k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_343' href='#L_SHIFTS_343'><pre>343</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> Instruction *TrOp = dyn_cast<Instruction>(TI->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_344' href='#L_SHIFTS_344'><pre>344</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // If 'shift2' is an ashr, we would have to get the sign bit into a funny</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_345' href='#L_SHIFTS_345'><pre>345</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // place. Don't try to do this transformation in this case. Also, we</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_346' href='#L_SHIFTS_346'><pre>346</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // require that the input operand is a shift-by-constant so that we have</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_347' href='#L_SHIFTS_347'><pre>347</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // confidence that the shifts will get folded together. We could do this</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_348' href='#L_SHIFTS_348'><pre>348</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> // xform in more cases, but it is unlikely to be profitable.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_349' href='#L_SHIFTS_349'><pre>349</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> if (<div class='tooltip'>TrOp && <span class='tooltip-content'>2.13k</span></div><div class='tooltip'>I.isLogicalShift()<span class='tooltip-content'>1.92k</span></div> && <div class='tooltip'>TrOp->isShift()<span class='tooltip-content'>1.72k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_350' href='#L_SHIFTS_350'><pre>350</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> <div class='tooltip'>isa<ConstantInt>(TrOp->getOperand(1))<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_351' href='#L_SHIFTS_351'><pre>351</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // Okay, we'll do this xform. Make the shift of shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_352' href='#L_SHIFTS_352'><pre>352</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Constant *ShAmt =</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_353' href='#L_SHIFTS_353'><pre>353</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> ConstantExpr::getZExt(cast<Constant>(Op1), TrOp->getType());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_354' href='#L_SHIFTS_354'><pre>354</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // (shift2 (shift1 & 0x00FF), c2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_355' href='#L_SHIFTS_355'><pre>355</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *NSh = Builder->CreateBinOp(I.getOpcode(), TrOp, ShAmt,I.getName());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_356' href='#L_SHIFTS_356'><pre>356</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_357' href='#L_SHIFTS_357'><pre>357</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // For logical shifts, the truncation has the effect of making the high</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_358' href='#L_SHIFTS_358'><pre>358</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // part of the register be zeros. Emulate this by inserting an AND to</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_359' href='#L_SHIFTS_359'><pre>359</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // clear the top bits as needed. This 'and' will usually be zapped by</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_360' href='#L_SHIFTS_360'><pre>360</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // other xforms later if dead.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_361' href='#L_SHIFTS_361'><pre>361</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> unsigned SrcSize = TrOp->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_362' href='#L_SHIFTS_362'><pre>362</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> unsigned DstSize = TI->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_363' href='#L_SHIFTS_363'><pre>363</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> APInt MaskV(APInt::getLowBitsSet(SrcSize, DstSize));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_364' href='#L_SHIFTS_364'><pre>364</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_365' href='#L_SHIFTS_365'><pre>365</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // The mask we constructed says what the trunc would do if occurring</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_366' href='#L_SHIFTS_366'><pre>366</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // between the shifts. We want to know the effect *after* the second</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_367' href='#L_SHIFTS_367'><pre>367</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // shift. We know that it is a logical shift by a constant, so adjust the</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_368' href='#L_SHIFTS_368'><pre>368</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // mask as appropriate.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_369' href='#L_SHIFTS_369'><pre>369</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (I.getOpcode() == Instruction::Shl)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_370' href='#L_SHIFTS_370'><pre>370</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> MaskV <<= Op1C->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_371' href='#L_SHIFTS_371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_372' href='#L_SHIFTS_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(I.getOpcode() == Instruction::LShr && "Unknown logical shift");</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_373' href='#L_SHIFTS_373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MaskV = MaskV.lshr(Op1C->getZExtValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_374' href='#L_SHIFTS_374'><pre>374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_375' href='#L_SHIFTS_375'><pre>375</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_376' href='#L_SHIFTS_376'><pre>376</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // shift1 & 0x00FF</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_377' href='#L_SHIFTS_377'><pre>377</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *And = Builder->CreateAnd(NSh,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_378' href='#L_SHIFTS_378'><pre>378</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> ConstantInt::get(I.getContext(), MaskV),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_379' href='#L_SHIFTS_379'><pre>379</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> TI->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_380' href='#L_SHIFTS_380'><pre>380</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_381' href='#L_SHIFTS_381'><pre>381</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // Return the value truncated to the interesting size.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_382' href='#L_SHIFTS_382'><pre>382</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return new TruncInst(And, I.getType());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_383' href='#L_SHIFTS_383'><pre>383</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_384' href='#L_SHIFTS_384'><pre>384</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_385' href='#L_SHIFTS_385'><pre>385</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_386' href='#L_SHIFTS_386'><pre>386</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>164k</span></div><div class='tooltip'>Op0->hasOneUse()<span class='tooltip-content'>164k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>90.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_387' href='#L_SHIFTS_387'><pre>387</pre></a></td><td class='covered-line'><pre>90.8k</pre></td><td class='code'><pre> if (BinaryOperator *<div class='tooltip'>Op0BO<span class='tooltip-content'>90.8k</span></div> = dyn_cast<BinaryOperator>(Op0)) <div class='tooltip'>{<span class='tooltip-content'>44.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_388' href='#L_SHIFTS_388'><pre>388</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> // Turn ((X >> C) + Y) << C -> (X + (Y << C)) & (~0 << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_389' href='#L_SHIFTS_389'><pre>389</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> Value *V1, *V2;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_390' href='#L_SHIFTS_390'><pre>390</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> ConstantInt *CC;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_391' href='#L_SHIFTS_391'><pre>391</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> switch (Op0BO->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_392' href='#L_SHIFTS_392'><pre>392</pre></a></td><td class='covered-line'><pre>20.6k</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_393' href='#L_SHIFTS_393'><pre>393</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_394' href='#L_SHIFTS_394'><pre>394</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_395' href='#L_SHIFTS_395'><pre>395</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_396' href='#L_SHIFTS_396'><pre>396</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> case Instruction::Xor: {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_397' href='#L_SHIFTS_397'><pre>397</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> // These operators commute.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_398' href='#L_SHIFTS_398'><pre>398</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> // Turn (Y + (X >> C)) << C -> (X + (Y << C)) & (~0 << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_399' href='#L_SHIFTS_399'><pre>399</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>isLeftShift && <span class='tooltip-content'>12.2k</span></div><div class='tooltip'>Op0BO->getOperand(1)->hasOneUse()<span class='tooltip-content'>2.19k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_400' href='#L_SHIFTS_400'><pre>400</pre></a></td><td class='covered-line'><pre>808</pre></td><td class='code'><pre> match(Op0BO->getOperand(1), m_Shr(m_Value(V1),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_401' href='#L_SHIFTS_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> m_Specific(Op1)))) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_402' href='#L_SHIFTS_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *YS = // (Y << C)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_403' href='#L_SHIFTS_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateShl(Op0BO->getOperand(0), Op1, Op0BO->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_404' href='#L_SHIFTS_404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X + (Y << C))</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_405' href='#L_SHIFTS_405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *X = Builder->CreateBinOp(Op0BO->getOpcode(), YS, V1,</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_406' href='#L_SHIFTS_406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op0BO->getOperand(1)->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_407' href='#L_SHIFTS_407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Op1Val = Op1C->getLimitedValue(TypeBits);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_408' href='#L_SHIFTS_408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_409' href='#L_SHIFTS_409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt Bits = APInt::getHighBitsSet(TypeBits, TypeBits - Op1Val);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_410' href='#L_SHIFTS_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *Mask = ConstantInt::get(I.getContext(), Bits);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_411' href='#L_SHIFTS_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (VectorType *</span><span class='red'>VT</span><span class='red'> = dyn_cast<VectorType>(X->getType()))</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_412' href='#L_SHIFTS_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Mask = ConstantVector::getSplat(VT->getNumElements(), Mask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_413' href='#L_SHIFTS_413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateAnd(X, Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_414' href='#L_SHIFTS_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_415' href='#L_SHIFTS_415'><pre>415</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_416' href='#L_SHIFTS_416'><pre>416</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> // Turn (Y + ((X >> C) & CC)) << C -> ((X & (CC << C)) + (Y << C))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_417' href='#L_SHIFTS_417'><pre>417</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> Value *Op0BOOp1 = Op0BO->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_418' href='#L_SHIFTS_418'><pre>418</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>isLeftShift && <span class='tooltip-content'>12.2k</span></div><div class='tooltip'>Op0BOOp1->hasOneUse()<span class='tooltip-content'>2.19k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_419' href='#L_SHIFTS_419'><pre>419</pre></a></td><td class='covered-line'><pre>808</pre></td><td class='code'><pre> match(Op0BOOp1,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_420' href='#L_SHIFTS_420'><pre>420</pre></a></td><td class='covered-line'><pre>808</pre></td><td class='code'><pre> m_And(m_OneUse(m_Shr(m_Value(V1), m_Specific(Op1))),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_421' href='#L_SHIFTS_421'><pre>421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> m_ConstantInt(CC)))) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_422' href='#L_SHIFTS_422'><pre>422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *YS = // (Y << C)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_423' href='#L_SHIFTS_423'><pre>423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateShl(Op0BO->getOperand(0), Op1,</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_424' href='#L_SHIFTS_424'><pre>424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op0BO->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_425' href='#L_SHIFTS_425'><pre>425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X & (CC << C)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_426' href='#L_SHIFTS_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *XM = Builder->CreateAnd(V1, ConstantExpr::getShl(CC, Op1),</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_427' href='#L_SHIFTS_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V1->getName()+".mask");</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_428' href='#L_SHIFTS_428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(Op0BO->getOpcode(), YS, XM);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_429' href='#L_SHIFTS_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_430' href='#L_SHIFTS_430'><pre>430</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> <div class='tooltip'>LLVM_FALLTHROUGH<span class='tooltip-content'>12.2k</span></div><div class='tooltip'>;<span class='tooltip-content'>12.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_431' href='#L_SHIFTS_431'><pre>431</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_432' href='#L_SHIFTS_432'><pre>432</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_433' href='#L_SHIFTS_433'><pre>433</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> case Instruction::Sub: {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_434' href='#L_SHIFTS_434'><pre>434</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // Turn ((X >> C) + Y) << C -> (X + (Y << C)) & (~0 << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_435' href='#L_SHIFTS_435'><pre>435</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>isLeftShift && <span class='tooltip-content'>24.0k</span></div><div class='tooltip'>Op0BO->getOperand(0)->hasOneUse()<span class='tooltip-content'>3.32k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_436' href='#L_SHIFTS_436'><pre>436</pre></a></td><td class='covered-line'><pre>1.71k</pre></td><td class='code'><pre> match(Op0BO->getOperand(0), m_Shr(m_Value(V1),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_437' href='#L_SHIFTS_437'><pre>437</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> m_Specific(Op1)))) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_438' href='#L_SHIFTS_438'><pre>438</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Value *YS = // (Y << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_439' href='#L_SHIFTS_439'><pre>439</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Builder->CreateShl(Op0BO->getOperand(1), Op1, Op0BO->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_440' href='#L_SHIFTS_440'><pre>440</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> // (X + (Y << C))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_441' href='#L_SHIFTS_441'><pre>441</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Value *X = Builder->CreateBinOp(Op0BO->getOpcode(), V1, YS,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_442' href='#L_SHIFTS_442'><pre>442</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Op0BO->getOperand(0)->getName());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_443' href='#L_SHIFTS_443'><pre>443</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> unsigned Op1Val = Op1C->getLimitedValue(TypeBits);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_444' href='#L_SHIFTS_444'><pre>444</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_445' href='#L_SHIFTS_445'><pre>445</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> APInt Bits = APInt::getHighBitsSet(TypeBits, TypeBits - Op1Val);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_446' href='#L_SHIFTS_446'><pre>446</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> Constant *Mask = ConstantInt::get(I.getContext(), Bits);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_447' href='#L_SHIFTS_447'><pre>447</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> if (VectorType *VT = dyn_cast<VectorType>(X->getType()))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_448' href='#L_SHIFTS_448'><pre>448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>Mask = ConstantVector::getSplat(VT->getNumElements(), Mask)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_449' href='#L_SHIFTS_449'><pre>449</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(X, Mask);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_450' href='#L_SHIFTS_450'><pre>450</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_451' href='#L_SHIFTS_451'><pre>451</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_452' href='#L_SHIFTS_452'><pre>452</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> // Turn (((X >> C)&CC) + Y) << C -> (X + (Y << C)) & (CC << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_453' href='#L_SHIFTS_453'><pre>453</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>24.0k</span></div><div class='tooltip'>isLeftShift && <span class='tooltip-content'>24.0k</span></div><div class='tooltip'>Op0BO->getOperand(0)->hasOneUse()<span class='tooltip-content'>3.31k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_454' href='#L_SHIFTS_454'><pre>454</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre> match(Op0BO->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_455' href='#L_SHIFTS_455'><pre>455</pre></a></td><td class='covered-line'><pre>1.70k</pre></td><td class='code'><pre> m_And(m_OneUse(m_Shr(m_Value(V1), m_Value(V2))),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_456' href='#L_SHIFTS_456'><pre>456</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> m_ConstantInt(CC))) && <div class='tooltip'>V2 == Op1<span class='tooltip-content'>3</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_457' href='#L_SHIFTS_457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *YS = // (Y << C)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_458' href='#L_SHIFTS_458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateShl(Op0BO->getOperand(1), Op1, Op0BO->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_459' href='#L_SHIFTS_459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // X & (CC << C)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_460' href='#L_SHIFTS_460'><pre>460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *XM = Builder->CreateAnd(V1, ConstantExpr::getShl(CC, Op1),</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_461' href='#L_SHIFTS_461'><pre>461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V1->getName()+".mask");</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_462' href='#L_SHIFTS_462'><pre>462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_463' href='#L_SHIFTS_463'><pre>463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::Create(Op0BO->getOpcode(), XM, YS);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_464' href='#L_SHIFTS_464'><pre>464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_465' href='#L_SHIFTS_465'><pre>465</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_466' href='#L_SHIFTS_466'><pre>466</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_467' href='#L_SHIFTS_467'><pre>467</pre></a></td><td class='covered-line'><pre>24.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_468' href='#L_SHIFTS_468'><pre>468</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_469' href='#L_SHIFTS_469'><pre>469</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_470' href='#L_SHIFTS_470'><pre>470</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_471' href='#L_SHIFTS_471'><pre>471</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> // If the operand is a bitwise operator with a constant RHS, and the</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_472' href='#L_SHIFTS_472'><pre>472</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> // shift is the only use, we can pull it out of the shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_473' href='#L_SHIFTS_473'><pre>473</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>44.7k</span></div><div class='tooltip'>Op0C<span class='tooltip-content'>44.7k</span></div> = dyn_cast<ConstantInt>(Op0BO->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>23.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_474' href='#L_SHIFTS_474'><pre>474</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> bool isValid = true; // Valid only for And, Or, Xor</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_475' href='#L_SHIFTS_475'><pre>475</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> bool highBitSet = false; // Transform if high bit of constant set?</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_476' href='#L_SHIFTS_476'><pre>476</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_477' href='#L_SHIFTS_477'><pre>477</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> switch (Op0BO->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_478' href='#L_SHIFTS_478'><pre>478</pre></a></td><td class='covered-line'><pre>17.0k</pre></td><td class='code'><pre> default: isValid = false; break; // Do not perform transform!</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_479' href='#L_SHIFTS_479'><pre>479</pre></a></td><td class='covered-line'><pre>6.24k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_480' href='#L_SHIFTS_480'><pre>480</pre></a></td><td class='covered-line'><pre>6.24k</pre></td><td class='code'><pre> isValid = isLeftShift;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_481' href='#L_SHIFTS_481'><pre>481</pre></a></td><td class='covered-line'><pre>6.24k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_482' href='#L_SHIFTS_482'><pre>482</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_483' href='#L_SHIFTS_483'><pre>483</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_484' href='#L_SHIFTS_484'><pre>484</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> highBitSet = false;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_485' href='#L_SHIFTS_485'><pre>485</pre></a></td><td class='covered-line'><pre>13</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_486' href='#L_SHIFTS_486'><pre>486</pre></a></td><td class='covered-line'><pre>429</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_487' href='#L_SHIFTS_487'><pre>487</pre></a></td><td class='covered-line'><pre>429</pre></td><td class='code'><pre> highBitSet = true;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_488' href='#L_SHIFTS_488'><pre>488</pre></a></td><td class='covered-line'><pre>429</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_489' href='#L_SHIFTS_489'><pre>489</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_490' href='#L_SHIFTS_490'><pre>490</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_491' href='#L_SHIFTS_491'><pre>491</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // If this is a signed shift right, and the high bit is modified</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_492' href='#L_SHIFTS_492'><pre>492</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // by the logical operation, do not perform the transformation.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_493' href='#L_SHIFTS_493'><pre>493</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // The highBitSet boolean indicates the value of the high bit of</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_494' href='#L_SHIFTS_494'><pre>494</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // the constant which would cause it to be modified for this</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_495' href='#L_SHIFTS_495'><pre>495</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> // operation.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_496' href='#L_SHIFTS_496'><pre>496</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_497' href='#L_SHIFTS_497'><pre>497</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>23.7k</span></div><div class='tooltip'>isValid && <span class='tooltip-content'>23.7k</span></div><div class='tooltip'>I.getOpcode() == Instruction::AShr<span class='tooltip-content'>720</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_498' href='#L_SHIFTS_498'><pre>498</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> isValid = Op0C->getValue()[TypeBits-1] == highBitSet;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_499' href='#L_SHIFTS_499'><pre>499</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_500' href='#L_SHIFTS_500'><pre>500</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>isValid<span class='tooltip-content'>23.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>720</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_501' href='#L_SHIFTS_501'><pre>501</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> Constant *NewRHS = ConstantExpr::get(I.getOpcode(), Op0C, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_502' href='#L_SHIFTS_502'><pre>502</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_503' href='#L_SHIFTS_503'><pre>503</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> Value *NewShift =</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_504' href='#L_SHIFTS_504'><pre>504</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> Builder->CreateBinOp(I.getOpcode(), Op0BO->getOperand(0), Op1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_505' href='#L_SHIFTS_505'><pre>505</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> NewShift->takeName(Op0BO);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_506' href='#L_SHIFTS_506'><pre>506</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_507' href='#L_SHIFTS_507'><pre>507</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> return BinaryOperator::Create(Op0BO->getOpcode(), NewShift,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_508' href='#L_SHIFTS_508'><pre>508</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> NewRHS);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_509' href='#L_SHIFTS_509'><pre>509</pre></a></td><td class='covered-line'><pre>720</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_510' href='#L_SHIFTS_510'><pre>510</pre></a></td><td class='covered-line'><pre>23.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_511' href='#L_SHIFTS_511'><pre>511</pre></a></td><td class='covered-line'><pre>44.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_512' href='#L_SHIFTS_512'><pre>512</pre></a></td><td class='covered-line'><pre>90.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_513' href='#L_SHIFTS_513'><pre>513</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_514' href='#L_SHIFTS_514'><pre>514</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_515' href='#L_SHIFTS_515'><pre>515</pre></a></td><td class='covered-line'><pre>164k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_516' href='#L_SHIFTS_516'><pre>516</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_517' href='#L_SHIFTS_517'><pre>517</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitShl(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_518' href='#L_SHIFTS_518'><pre>518</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_519' href='#L_SHIFTS_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_520' href='#L_SHIFTS_520'><pre>520</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_521' href='#L_SHIFTS_521'><pre>521</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_522' href='#L_SHIFTS_522'><pre>522</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre> if (Value *V = SimplifyShlInst(Op0, Op1, I.hasNoSignedWrap(),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_523' href='#L_SHIFTS_523'><pre>523</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre> I.hasNoUnsignedWrap(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_524' href='#L_SHIFTS_524'><pre>524</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_525' href='#L_SHIFTS_525'><pre>525</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_526' href='#L_SHIFTS_526'><pre>526</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>95.9k</span></div><div class='tooltip'>V<span class='tooltip-content'>95.9k</span></div> = commonShiftTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_527' href='#L_SHIFTS_527'><pre>527</pre></a></td><td class='covered-line'><pre>1.30k</pre></td><td class='code'><pre> return V;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_528' href='#L_SHIFTS_528'><pre>528</pre></a></td><td class='covered-line'><pre>95.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_529' href='#L_SHIFTS_529'><pre>529</pre></a></td><td class='covered-line'><pre>94.6k</pre></td><td class='code'><pre> const APInt *ShAmtAPInt;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_530' href='#L_SHIFTS_530'><pre>530</pre></a></td><td class='covered-line'><pre>94.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(ShAmtAPInt))<span class='tooltip-content'>94.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>82.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_531' href='#L_SHIFTS_531'><pre>531</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> unsigned ShAmt = ShAmtAPInt->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_532' href='#L_SHIFTS_532'><pre>532</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> unsigned BitWidth = I.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_533' href='#L_SHIFTS_533'><pre>533</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> Type *Ty = I.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_534' href='#L_SHIFTS_534'><pre>534</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_535' href='#L_SHIFTS_535'><pre>535</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // shl (zext X), ShAmt --> zext (shl X, ShAmt)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_536' href='#L_SHIFTS_536'><pre>536</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // This is only valid if X would have zeros shifted out.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_537' href='#L_SHIFTS_537'><pre>537</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_538' href='#L_SHIFTS_538'><pre>538</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_ZExt(m_Value(X)))<span class='tooltip-content'>82.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>15.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_539' href='#L_SHIFTS_539'><pre>539</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> unsigned SrcWidth = X->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_540' href='#L_SHIFTS_540'><pre>540</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> if (ShAmt < SrcWidth &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_541' href='#L_SHIFTS_541'><pre>541</pre></a></td><td class='covered-line'><pre>6.21k</pre></td><td class='code'><pre> MaskedValueIsZero(X, APInt::getHighBitsSet(SrcWidth, ShAmt), 0, &I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_542' href='#L_SHIFTS_542'><pre>542</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return new ZExtInst(Builder->CreateShl(X, ShAmt), Ty);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_543' href='#L_SHIFTS_543'><pre>543</pre></a></td><td class='covered-line'><pre>15.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_544' href='#L_SHIFTS_544'><pre>544</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_545' href='#L_SHIFTS_545'><pre>545</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // (X >>u C) << C --> X & (-1 << C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_546' href='#L_SHIFTS_546'><pre>546</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>82.2k</span></div><div class='tooltip'>match(Op0, m_LShr(m_Value(X), m_Specific(Op1)))<span class='tooltip-content'>82.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>32</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_547' href='#L_SHIFTS_547'><pre>547</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> APInt Mask(APInt::getHighBitsSet(BitWidth, BitWidth - ShAmt));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_548' href='#L_SHIFTS_548'><pre>548</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(X, ConstantInt::get(Ty, Mask));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_549' href='#L_SHIFTS_549'><pre>549</pre></a></td><td class='covered-line'><pre>32</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_550' href='#L_SHIFTS_550'><pre>550</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_551' href='#L_SHIFTS_551'><pre>551</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // Be careful about hiding shl instructions behind bit masks. They are used</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_552' href='#L_SHIFTS_552'><pre>552</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // to represent multiplies by a constant, and it is important that simple</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_553' href='#L_SHIFTS_553'><pre>553</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // arithmetic expressions are still recognizable by scalar evolution.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_554' href='#L_SHIFTS_554'><pre>554</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // The inexact versions are deferred to DAGCombine, so we don't hide shl</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_555' href='#L_SHIFTS_555'><pre>555</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> // behind a bit mask.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_556' href='#L_SHIFTS_556'><pre>556</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> const APInt *ShOp1;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_557' href='#L_SHIFTS_557'><pre>557</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre> if (match(Op0, m_CombineOr(m_Exact(m_LShr(m_Value(X), m_APInt(ShOp1))),</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_558' href='#L_SHIFTS_558'><pre>558</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> m_Exact(m_AShr(m_Value(X), m_APInt(ShOp1)))))) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_559' href='#L_SHIFTS_559'><pre>559</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> unsigned ShrAmt = ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_560' href='#L_SHIFTS_560'><pre>560</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>ShrAmt < ShAmt<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>29</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_561' href='#L_SHIFTS_561'><pre>561</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> // If C1 < C2: (X >>?,exact C1) << C2 --> X << (C2 - C1)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_562' href='#L_SHIFTS_562'><pre>562</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShAmt - ShrAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_563' href='#L_SHIFTS_563'><pre>563</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_564' href='#L_SHIFTS_564'><pre>564</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> NewShl->setHasNoUnsignedWrap(I.hasNoUnsignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_565' href='#L_SHIFTS_565'><pre>565</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> NewShl->setHasNoSignedWrap(I.hasNoSignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_566' href='#L_SHIFTS_566'><pre>566</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> return NewShl;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_567' href='#L_SHIFTS_567'><pre>567</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_568' href='#L_SHIFTS_568'><pre>568</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>91</span></div><div class='tooltip'>ShrAmt > ShAmt<span class='tooltip-content'>91</span></div>) <div class='tooltip'>{<span class='tooltip-content'>91</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_569' href='#L_SHIFTS_569'><pre>569</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> // If C1 > C2: (X >>?exact C1) << C2 --> X >>?exact (C1 - C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_570' href='#L_SHIFTS_570'><pre>570</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShrAmt - ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_571' href='#L_SHIFTS_571'><pre>571</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> auto *NewShr = BinaryOperator::Create(</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_572' href='#L_SHIFTS_572'><pre>572</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> cast<BinaryOperator>(Op0)->getOpcode(), X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_573' href='#L_SHIFTS_573'><pre>573</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> NewShr->setIsExact(true);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_574' href='#L_SHIFTS_574'><pre>574</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> return NewShr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_575' href='#L_SHIFTS_575'><pre>575</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_576' href='#L_SHIFTS_576'><pre>576</pre></a></td><td class='covered-line'><pre>91</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_577' href='#L_SHIFTS_577'><pre>577</pre></a></td><td class='covered-line'><pre>82.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_578' href='#L_SHIFTS_578'><pre>578</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>82.1k</span></div><div class='tooltip'>match(Op0, m_Shl(m_Value(X), m_APInt(ShOp1)))<span class='tooltip-content'>82.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_579' href='#L_SHIFTS_579'><pre>579</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> unsigned AmtSum = ShAmt + ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_580' href='#L_SHIFTS_580'><pre>580</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // Oversized shifts are simplified to zero in InstSimplify.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_581' href='#L_SHIFTS_581'><pre>581</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (AmtSum < BitWidth)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_582' href='#L_SHIFTS_582'><pre>582</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // (X << C1) << C2 --> X << (C1 + C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_583' href='#L_SHIFTS_583'><pre>583</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return BinaryOperator::CreateShl(X, ConstantInt::get(Ty, AmtSum));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_584' href='#L_SHIFTS_584'><pre>584</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_585' href='#L_SHIFTS_585'><pre>585</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_586' href='#L_SHIFTS_586'><pre>586</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre> // If the shifted-out value is known-zero, then this is a NUW shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_587' href='#L_SHIFTS_587'><pre>587</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>82.1k</span></div><div class='tooltip'>!I.hasNoUnsignedWrap() &&<span class='tooltip-content'>82.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_588' href='#L_SHIFTS_588'><pre>588</pre></a></td><td class='covered-line'><pre>65.8k</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0, APInt::getHighBitsSet(BitWidth, ShAmt), 0, &I)<span class='tooltip-content'>65.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.10k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_589' href='#L_SHIFTS_589'><pre>589</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> I.setHasNoUnsignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_590' href='#L_SHIFTS_590'><pre>590</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_591' href='#L_SHIFTS_591'><pre>591</pre></a></td><td class='covered-line'><pre>1.10k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_592' href='#L_SHIFTS_592'><pre>592</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_593' href='#L_SHIFTS_593'><pre>593</pre></a></td><td class='covered-line'><pre>82.1k</pre></td><td class='code'><pre> // If the shifted-out value is all signbits, then this is a NSW shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_594' href='#L_SHIFTS_594'><pre>594</pre></a></td><td class='covered-line'><pre>81.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>81.0k</span></div><div class='tooltip'>!I.hasNoSignedWrap() && <span class='tooltip-content'>81.0k</span></div><div class='tooltip'>ComputeNumSignBits(Op0, 0, &I) > ShAmt<span class='tooltip-content'>50.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.34k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_595' href='#L_SHIFTS_595'><pre>595</pre></a></td><td class='covered-line'><pre>1.34k</pre></td><td class='code'><pre> I.setHasNoSignedWrap();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_596' href='#L_SHIFTS_596'><pre>596</pre></a></td><td class='covered-line'><pre>1.34k</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_597' href='#L_SHIFTS_597'><pre>597</pre></a></td><td class='covered-line'><pre>1.34k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_598' href='#L_SHIFTS_598'><pre>598</pre></a></td><td class='covered-line'><pre>81.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_599' href='#L_SHIFTS_599'><pre>599</pre></a></td><td class='covered-line'><pre>94.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_600' href='#L_SHIFTS_600'><pre>600</pre></a></td><td class='covered-line'><pre>92.0k</pre></td><td class='code'><pre> Constant *C1;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_601' href='#L_SHIFTS_601'><pre>601</pre></a></td><td class='covered-line'><pre>92.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_Constant(C1))<span class='tooltip-content'>92.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>79.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_602' href='#L_SHIFTS_602'><pre>602</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> Constant *C2;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_603' href='#L_SHIFTS_603'><pre>603</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_604' href='#L_SHIFTS_604'><pre>604</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> // (C2 << X) << C1 --> (C2 << C1) << X</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_605' href='#L_SHIFTS_605'><pre>605</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> if (match(Op0, m_OneUse(m_Shl(m_Constant(C2), m_Value(X)))))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_606' href='#L_SHIFTS_606'><pre>606</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return BinaryOperator::CreateShl(ConstantExpr::getShl(C2, C1), X);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_607' href='#L_SHIFTS_607'><pre>607</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_608' href='#L_SHIFTS_608'><pre>608</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> // (X * C2) << C1 --> X * (C2 << C1)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_609' href='#L_SHIFTS_609'><pre>609</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>79.6k</span></div><div class='tooltip'>match(Op0, m_Mul(m_Value(X), m_Constant(C2)))<span class='tooltip-content'>79.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_610' href='#L_SHIFTS_610'><pre>610</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> return BinaryOperator::CreateMul(X, ConstantExpr::getShl(C2, C1));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_611' href='#L_SHIFTS_611'><pre>611</pre></a></td><td class='covered-line'><pre>79.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_612' href='#L_SHIFTS_612'><pre>612</pre></a></td><td class='covered-line'><pre>92.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_613' href='#L_SHIFTS_613'><pre>613</pre></a></td><td class='covered-line'><pre>92.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_614' href='#L_SHIFTS_614'><pre>614</pre></a></td><td class='covered-line'><pre>92.0k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_615' href='#L_SHIFTS_615'><pre>615</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_616' href='#L_SHIFTS_616'><pre>616</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitLShr(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_617' href='#L_SHIFTS_617'><pre>617</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_618' href='#L_SHIFTS_618'><pre>618</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_619' href='#L_SHIFTS_619'><pre>619</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_620' href='#L_SHIFTS_620'><pre>620</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_621' href='#L_SHIFTS_621'><pre>621</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> if (Value *V = SimplifyLShrInst(Op0, Op1, I.isExact(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_622' href='#L_SHIFTS_622'><pre>622</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_623' href='#L_SHIFTS_623'><pre>623</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_624' href='#L_SHIFTS_624'><pre>624</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>51.2k</span></div><div class='tooltip'>R<span class='tooltip-content'>51.2k</span></div> = commonShiftTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_625' href='#L_SHIFTS_625'><pre>625</pre></a></td><td class='covered-line'><pre>321</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_626' href='#L_SHIFTS_626'><pre>626</pre></a></td><td class='covered-line'><pre>51.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_627' href='#L_SHIFTS_627'><pre>627</pre></a></td><td class='covered-line'><pre>50.9k</pre></td><td class='code'><pre> Type *Ty = I.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_628' href='#L_SHIFTS_628'><pre>628</pre></a></td><td class='covered-line'><pre>50.9k</pre></td><td class='code'><pre> const APInt *ShAmtAPInt;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_629' href='#L_SHIFTS_629'><pre>629</pre></a></td><td class='covered-line'><pre>50.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(ShAmtAPInt))<span class='tooltip-content'>50.9k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>45.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_630' href='#L_SHIFTS_630'><pre>630</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> unsigned ShAmt = ShAmtAPInt->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_631' href='#L_SHIFTS_631'><pre>631</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> unsigned BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_632' href='#L_SHIFTS_632'><pre>632</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> auto *II = dyn_cast<IntrinsicInst>(Op0);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_633' href='#L_SHIFTS_633'><pre>633</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>II && <span class='tooltip-content'>45.8k</span></div><div class='tooltip'><span class='red'>isPowerOf2_32(BitWidth)</span><span class='tooltip-content'>0</span></div> && <div class='tooltip'><span class='red'>Log2_32(BitWidth) == ShAmt</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_634' href='#L_SHIFTS_634'><pre>634</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>(II->getIntrinsicID() == Intrinsic::ctlz ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_635' href='#L_SHIFTS_635'><pre>635</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>II->getIntrinsicID() == Intrinsic::cttz</span><span class='red'> ||</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_636' href='#L_SHIFTS_636'><pre>636</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::ctpop</span><span class='tooltip-content'>0</span></div><span class='red'>)</span>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_637' href='#L_SHIFTS_637'><pre>637</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ctlz.i32(x)>>5 --> zext(x == 0)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_638' href='#L_SHIFTS_638'><pre>638</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // cttz.i32(x)>>5 --> zext(x == 0)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_639' href='#L_SHIFTS_639'><pre>639</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ctpop.i32(x)>>5 --> zext(x == -1)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_640' href='#L_SHIFTS_640'><pre>640</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool IsPop = II->getIntrinsicID() == Intrinsic::ctpop;</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_641' href='#L_SHIFTS_641'><pre>641</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *RHS = ConstantInt::getSigned(Ty, IsPop ? </span><div class='tooltip'><span class='red'>-1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_642' href='#L_SHIFTS_642'><pre>642</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Cmp = Builder->CreateICmpEQ(II->getArgOperand(0), RHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_643' href='#L_SHIFTS_643'><pre>643</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ZExtInst(Cmp, Ty);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_644' href='#L_SHIFTS_644'><pre>644</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_645' href='#L_SHIFTS_645'><pre>645</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_646' href='#L_SHIFTS_646'><pre>646</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_647' href='#L_SHIFTS_647'><pre>647</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> const APInt *ShOp1;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_648' href='#L_SHIFTS_648'><pre>648</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_Shl(m_Value(X), m_APInt(ShOp1)))<span class='tooltip-content'>45.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_649' href='#L_SHIFTS_649'><pre>649</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> unsigned ShlAmt = ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_650' href='#L_SHIFTS_650'><pre>650</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> if (<div class='tooltip'>ShlAmt < ShAmt<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_651' href='#L_SHIFTS_651'><pre>651</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShAmt - ShlAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_652' href='#L_SHIFTS_652'><pre>652</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> if (<div class='tooltip'>cast<BinaryOperator>(Op0)->hasNoUnsignedWrap()<span class='tooltip-content'>7</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_653' href='#L_SHIFTS_653'><pre>653</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X <<nuw C1) >>u C2 --> X >>u (C2 - C1)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_654' href='#L_SHIFTS_654'><pre>654</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> auto *NewLShr = BinaryOperator::CreateLShr(X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_655' href='#L_SHIFTS_655'><pre>655</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> NewLShr->setIsExact(I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_656' href='#L_SHIFTS_656'><pre>656</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return NewLShr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_657' href='#L_SHIFTS_657'><pre>657</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_658' href='#L_SHIFTS_658'><pre>658</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> // (X << C1) >>u C2 --> (X >>u (C2 - C1)) & (-1 >> C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_659' href='#L_SHIFTS_659'><pre>659</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *NewLShr = Builder->CreateLShr(X, ShiftDiff, "", I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_660' href='#L_SHIFTS_660'><pre>660</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> APInt Mask(APInt::getLowBitsSet(BitWidth, BitWidth - ShAmt));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_661' href='#L_SHIFTS_661'><pre>661</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NewLShr, ConstantInt::get(Ty, Mask));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_662' href='#L_SHIFTS_662'><pre>662</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_663' href='#L_SHIFTS_663'><pre>663</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>29</span></div><div class='tooltip'>ShlAmt > ShAmt<span class='tooltip-content'>29</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_664' href='#L_SHIFTS_664'><pre>664</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShlAmt - ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_665' href='#L_SHIFTS_665'><pre>665</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>cast<BinaryOperator>(Op0)->hasNoUnsignedWrap()<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_666' href='#L_SHIFTS_666'><pre>666</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (X <<nuw C1) >>u C2 --> X <<nuw (C1 - C2)</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_667' href='#L_SHIFTS_667'><pre>667</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewShl = BinaryOperator::CreateShl(X, ShiftDiff);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_668' href='#L_SHIFTS_668'><pre>668</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewShl->setHasNoUnsignedWrap(true);</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_669' href='#L_SHIFTS_669'><pre>669</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return NewShl;</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_670' href='#L_SHIFTS_670'><pre>670</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_671' href='#L_SHIFTS_671'><pre>671</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // (X << C1) >>u C2 --> X << (C1 - C2) & (-1 >> C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_672' href='#L_SHIFTS_672'><pre>672</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *NewShl = Builder->CreateShl(X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_673' href='#L_SHIFTS_673'><pre>673</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> APInt Mask(APInt::getLowBitsSet(BitWidth, BitWidth - ShAmt));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_674' href='#L_SHIFTS_674'><pre>674</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(NewShl, ConstantInt::get(Ty, Mask));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_675' href='#L_SHIFTS_675'><pre>675</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_676' href='#L_SHIFTS_676'><pre>676</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> assert(ShlAmt == ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_677' href='#L_SHIFTS_677'><pre>677</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> // (X << C) >>u C --> X & (-1 >>u C)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_678' href='#L_SHIFTS_678'><pre>678</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> APInt Mask(APInt::getLowBitsSet(BitWidth, BitWidth - ShAmt));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_679' href='#L_SHIFTS_679'><pre>679</pre></a></td><td class='covered-line'><pre>28</pre></td><td class='code'><pre> return BinaryOperator::CreateAnd(X, ConstantInt::get(Ty, Mask));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_680' href='#L_SHIFTS_680'><pre>680</pre></a></td><td class='covered-line'><pre>29</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_681' href='#L_SHIFTS_681'><pre>681</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_682' href='#L_SHIFTS_682'><pre>682</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>45.8k</span></div><div class='tooltip'>match(Op0, m_LShr(m_Value(X), m_APInt(ShOp1)))<span class='tooltip-content'>45.8k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_683' href='#L_SHIFTS_683'><pre>683</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> unsigned AmtSum = ShAmt + ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_684' href='#L_SHIFTS_684'><pre>684</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // Oversized shifts are simplified to zero in InstSimplify.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_685' href='#L_SHIFTS_685'><pre>685</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> if (AmtSum < BitWidth)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_686' href='#L_SHIFTS_686'><pre>686</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> // (X >>u C1) >>u C2 --> X >>u (C1 + C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_687' href='#L_SHIFTS_687'><pre>687</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_688' href='#L_SHIFTS_688'><pre>688</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_689' href='#L_SHIFTS_689'><pre>689</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_690' href='#L_SHIFTS_690'><pre>690</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> // If the shifted-out value is known-zero, then this is an exact shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_691' href='#L_SHIFTS_691'><pre>691</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>45.8k</span></div><div class='tooltip'>!I.isExact() &&<span class='tooltip-content'>45.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_692' href='#L_SHIFTS_692'><pre>692</pre></a></td><td class='covered-line'><pre>43.7k</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0, APInt::getLowBitsSet(BitWidth, ShAmt), 0, &I)<span class='tooltip-content'>43.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>53</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_693' href='#L_SHIFTS_693'><pre>693</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> I.setIsExact();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_694' href='#L_SHIFTS_694'><pre>694</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_695' href='#L_SHIFTS_695'><pre>695</pre></a></td><td class='covered-line'><pre>53</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_696' href='#L_SHIFTS_696'><pre>696</pre></a></td><td class='covered-line'><pre>45.8k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_697' href='#L_SHIFTS_697'><pre>697</pre></a></td><td class='covered-line'><pre>50.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_698' href='#L_SHIFTS_698'><pre>698</pre></a></td><td class='covered-line'><pre>50.9k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_699' href='#L_SHIFTS_699'><pre>699</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_700' href='#L_SHIFTS_700'><pre>700</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitAShr(BinaryOperator &I) {</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_701' href='#L_SHIFTS_701'><pre>701</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre> if (Value *V = SimplifyVectorOp(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_702' href='#L_SHIFTS_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_703' href='#L_SHIFTS_703'><pre>703</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_704' href='#L_SHIFTS_704'><pre>704</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre> Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_705' href='#L_SHIFTS_705'><pre>705</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre> if (Value *V = SimplifyAShrInst(Op0, Op1, I.isExact(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_706' href='#L_SHIFTS_706'><pre>706</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return replaceInstUsesWith(I, V);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_707' href='#L_SHIFTS_707'><pre>707</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_708' href='#L_SHIFTS_708'><pre>708</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>41.8k</span></div><div class='tooltip'>R<span class='tooltip-content'>41.8k</span></div> = commonShiftTransforms(I))</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_709' href='#L_SHIFTS_709'><pre>709</pre></a></td><td class='covered-line'><pre>506</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_710' href='#L_SHIFTS_710'><pre>710</pre></a></td><td class='covered-line'><pre>41.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_711' href='#L_SHIFTS_711'><pre>711</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre> Type *Ty = I.getType();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_712' href='#L_SHIFTS_712'><pre>712</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre> unsigned BitWidth = Ty->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_713' href='#L_SHIFTS_713'><pre>713</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre> const APInt *ShAmtAPInt;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_714' href='#L_SHIFTS_714'><pre>714</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op1, m_APInt(ShAmtAPInt))<span class='tooltip-content'>41.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_715' href='#L_SHIFTS_715'><pre>715</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> unsigned ShAmt = ShAmtAPInt->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_716' href='#L_SHIFTS_716'><pre>716</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_717' href='#L_SHIFTS_717'><pre>717</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // If the shift amount equals the difference in width of the destination</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_718' href='#L_SHIFTS_718'><pre>718</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // and source scalar types:</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_719' href='#L_SHIFTS_719'><pre>719</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // ashr (shl (zext X), C), C --> sext X</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_720' href='#L_SHIFTS_720'><pre>720</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> Value *X;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_721' href='#L_SHIFTS_721'><pre>721</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> if (match(Op0, m_Shl(m_ZExt(m_Value(X)), m_Specific(Op1))) &&</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_722' href='#L_SHIFTS_722'><pre>722</pre></a></td><td class='covered-line'><pre>128</pre></td><td class='code'><pre> ShAmt == BitWidth - X->getType()->getScalarSizeInBits())</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_723' href='#L_SHIFTS_723'><pre>723</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return new SExtInst(X, Ty);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_724' href='#L_SHIFTS_724'><pre>724</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_725' href='#L_SHIFTS_725'><pre>725</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // We can't handle (X << C1) >>s C2. It shifts arbitrary bits in. However,</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_726' href='#L_SHIFTS_726'><pre>726</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // we can handle (X <<nsw C1) >>s C2 since it only shifts in sign bits.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_727' href='#L_SHIFTS_727'><pre>727</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> const APInt *ShOp1;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_728' href='#L_SHIFTS_728'><pre>728</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(Op0, m_NSWShl(m_Value(X), m_APInt(ShOp1)))<span class='tooltip-content'>36.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_729' href='#L_SHIFTS_729'><pre>729</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> unsigned ShlAmt = ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_730' href='#L_SHIFTS_730'><pre>730</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (<div class='tooltip'>ShlAmt < ShAmt<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_731' href='#L_SHIFTS_731'><pre>731</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // (X <<nsw C1) >>s C2 --> X >>s (C2 - C1)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_732' href='#L_SHIFTS_732'><pre>732</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShAmt - ShlAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_733' href='#L_SHIFTS_733'><pre>733</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> auto *NewAShr = BinaryOperator::CreateAShr(X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_734' href='#L_SHIFTS_734'><pre>734</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> NewAShr->setIsExact(I.isExact());</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_735' href='#L_SHIFTS_735'><pre>735</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return NewAShr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_736' href='#L_SHIFTS_736'><pre>736</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_737' href='#L_SHIFTS_737'><pre>737</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2</span></div><div class='tooltip'>ShlAmt > ShAmt<span class='tooltip-content'>2</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_738' href='#L_SHIFTS_738'><pre>738</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // (X <<nsw C1) >>s C2 --> X <<nsw (C1 - C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_739' href='#L_SHIFTS_739'><pre>739</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Constant *ShiftDiff = ConstantInt::get(Ty, ShlAmt - ShAmt);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_740' href='#L_SHIFTS_740'><pre>740</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> auto *NewShl = BinaryOperator::Create(Instruction::Shl, X, ShiftDiff);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_741' href='#L_SHIFTS_741'><pre>741</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> NewShl->setHasNoSignedWrap(true);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_742' href='#L_SHIFTS_742'><pre>742</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> return NewShl;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_743' href='#L_SHIFTS_743'><pre>743</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_744' href='#L_SHIFTS_744'><pre>744</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_745' href='#L_SHIFTS_745'><pre>745</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_746' href='#L_SHIFTS_746'><pre>746</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>36.0k</span></div><div class='tooltip'>match(Op0, m_AShr(m_Value(X), m_APInt(ShOp1)))<span class='tooltip-content'>36.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>14</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_747' href='#L_SHIFTS_747'><pre>747</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> unsigned AmtSum = ShAmt + ShOp1->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_748' href='#L_SHIFTS_748'><pre>748</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> // Oversized arithmetic shifts replicate the sign bit.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_749' href='#L_SHIFTS_749'><pre>749</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> AmtSum = std::min(AmtSum, BitWidth - 1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_750' href='#L_SHIFTS_750'><pre>750</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> // (X >>s C1) >>s C2 --> X >>s (C1 + C2)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_751' href='#L_SHIFTS_751'><pre>751</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> return BinaryOperator::CreateAShr(X, ConstantInt::get(Ty, AmtSum));</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_752' href='#L_SHIFTS_752'><pre>752</pre></a></td><td class='covered-line'><pre>14</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_753' href='#L_SHIFTS_753'><pre>753</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_754' href='#L_SHIFTS_754'><pre>754</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> // If the shifted-out value is known-zero, then this is an exact shift.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_755' href='#L_SHIFTS_755'><pre>755</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>36.0k</span></div><div class='tooltip'>!I.isExact() &&<span class='tooltip-content'>36.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_756' href='#L_SHIFTS_756'><pre>756</pre></a></td><td class='covered-line'><pre>12.1k</pre></td><td class='code'><pre> <div class='tooltip'>MaskedValueIsZero(Op0, APInt::getLowBitsSet(BitWidth, ShAmt), 0, &I)<span class='tooltip-content'>12.1k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>940</span></div></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_757' href='#L_SHIFTS_757'><pre>757</pre></a></td><td class='covered-line'><pre>940</pre></td><td class='code'><pre> I.setIsExact();</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_758' href='#L_SHIFTS_758'><pre>758</pre></a></td><td class='covered-line'><pre>940</pre></td><td class='code'><pre> return &I;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_759' href='#L_SHIFTS_759'><pre>759</pre></a></td><td class='covered-line'><pre>940</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_760' href='#L_SHIFTS_760'><pre>760</pre></a></td><td class='covered-line'><pre>36.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_761' href='#L_SHIFTS_761'><pre>761</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_762' href='#L_SHIFTS_762'><pre>762</pre></a></td><td class='covered-line'><pre>41.3k</pre></td><td class='code'><pre> // See if we can turn a signed shr into an unsigned shr.</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_763' href='#L_SHIFTS_763'><pre>763</pre></a></td><td class='covered-line'><pre>40.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>40.3k</span></div><div class='tooltip'>MaskedValueIsZero(Op0, APInt::getSignBit(BitWidth), 0, &I)<span class='tooltip-content'>40.3k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_764' href='#L_SHIFTS_764'><pre>764</pre></a></td><td class='covered-line'><pre>61</pre></td><td class='code'><pre> return BinaryOperator::CreateLShr(Op0, Op1);</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_765' href='#L_SHIFTS_765'><pre>765</pre></a></td><td class='covered-line'><pre>40.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_766' href='#L_SHIFTS_766'><pre>766</pre></a></td><td class='covered-line'><pre>40.3k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_SHIFTS_767' href='#L_SHIFTS_767'><pre>767</pre></a></td><td class='covered-line'><pre>40.3k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='DEMANDED' href='#DEMANDED'>lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_DEMANDED_176'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1' href='#L_DEMANDED_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineSimplifyDemanded.cpp ------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_2' href='#L_DEMANDED_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_3' href='#L_DEMANDED_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_4' href='#L_DEMANDED_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_5' href='#L_DEMANDED_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_6' href='#L_DEMANDED_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_7' href='#L_DEMANDED_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_8' href='#L_DEMANDED_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_9' href='#L_DEMANDED_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_10' href='#L_DEMANDED_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file contains logic for simplifying instructions based on information</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_11' href='#L_DEMANDED_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// about how they are used.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_12' href='#L_DEMANDED_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_13' href='#L_DEMANDED_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_14' href='#L_DEMANDED_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_15' href='#L_DEMANDED_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_16' href='#L_DEMANDED_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/ValueTracking.h"</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_17' href='#L_DEMANDED_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/IntrinsicInst.h"</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_18' href='#L_DEMANDED_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_19' href='#L_DEMANDED_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_20' href='#L_DEMANDED_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_21' href='#L_DEMANDED_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm::PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_22' href='#L_DEMANDED_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_23' href='#L_DEMANDED_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_24' href='#L_DEMANDED_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_25' href='#L_DEMANDED_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Check to see if the specified operand of the specified instruction is a</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_26' href='#L_DEMANDED_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant integer. If so, check to see if there are any bits set in the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_27' href='#L_DEMANDED_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// constant that are not demanded. If so, shrink the constant and return true.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_28' href='#L_DEMANDED_28'><pre>28</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool ShrinkDemandedConstant(Instruction *I, unsigned OpNo,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_29' href='#L_DEMANDED_29'><pre>29</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> APInt Demanded) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_30' href='#L_DEMANDED_30'><pre>30</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> assert(I && "No instruction?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_31' href='#L_DEMANDED_31'><pre>31</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> assert(OpNo < I->getNumOperands() && "Operand index too large");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_32' href='#L_DEMANDED_32'><pre>32</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_33' href='#L_DEMANDED_33'><pre>33</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> // The operand must be a constant integer or splat integer.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_34' href='#L_DEMANDED_34'><pre>34</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> Value *Op = I->getOperand(OpNo);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_35' href='#L_DEMANDED_35'><pre>35</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_36' href='#L_DEMANDED_36'><pre>36</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> if (!match(Op, m_APInt(C)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_37' href='#L_DEMANDED_37'><pre>37</pre></a></td><td class='covered-line'><pre>225k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_38' href='#L_DEMANDED_38'><pre>38</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_39' href='#L_DEMANDED_39'><pre>39</pre></a></td><td class='covered-line'><pre>515k</pre></td><td class='code'><pre> // If there are no bits set that aren't demanded, nothing to do.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_40' href='#L_DEMANDED_40'><pre>40</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> Demanded = Demanded.zextOrTrunc(C->getBitWidth());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_41' href='#L_DEMANDED_41'><pre>41</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> if ((~Demanded & *C) == 0)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_42' href='#L_DEMANDED_42'><pre>42</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_43' href='#L_DEMANDED_43'><pre>43</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_44' href='#L_DEMANDED_44'><pre>44</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre> // This instruction is producing bits that are not demanded. Shrink the RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_45' href='#L_DEMANDED_45'><pre>45</pre></a></td><td class='covered-line'><pre>824</pre></td><td class='code'><pre> Demanded &= *C;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_46' href='#L_DEMANDED_46'><pre>46</pre></a></td><td class='covered-line'><pre>824</pre></td><td class='code'><pre> I->setOperand(OpNo, ConstantInt::get(Op->getType(), Demanded));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_47' href='#L_DEMANDED_47'><pre>47</pre></a></td><td class='covered-line'><pre>824</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_48' href='#L_DEMANDED_48'><pre>48</pre></a></td><td class='covered-line'><pre>824</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_49' href='#L_DEMANDED_49'><pre>49</pre></a></td><td class='covered-line'><pre>289k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_50' href='#L_DEMANDED_50'><pre>50</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_51' href='#L_DEMANDED_51'><pre>51</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_52' href='#L_DEMANDED_52'><pre>52</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_53' href='#L_DEMANDED_53'><pre>53</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Inst is an integer instruction that SimplifyDemandedBits knows about. See if</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_54' href='#L_DEMANDED_54'><pre>54</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the instruction has any properties that allow us to simplify its operands.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_55' href='#L_DEMANDED_55'><pre>55</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre>bool InstCombiner::SimplifyDemandedInstructionBits(Instruction &Inst) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_56' href='#L_DEMANDED_56'><pre>56</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> unsigned BitWidth = Inst.getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_57' href='#L_DEMANDED_57'><pre>57</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_58' href='#L_DEMANDED_58'><pre>58</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> APInt DemandedMask(APInt::getAllOnesValue(BitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_59' href='#L_DEMANDED_59'><pre>59</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_60' href='#L_DEMANDED_60'><pre>60</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> Value *V = SimplifyDemandedUseBits(&Inst, DemandedMask, KnownZero, KnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_61' href='#L_DEMANDED_61'><pre>61</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> 0, &Inst);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_62' href='#L_DEMANDED_62'><pre>62</pre></a></td><td class='covered-line'><pre>612k</pre></td><td class='code'><pre> if (<div class='tooltip'>!V<span class='tooltip-content'>612k</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>609k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_63' href='#L_DEMANDED_63'><pre>63</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.79k</span></div><div class='tooltip'>V == &Inst<span class='tooltip-content'>2.79k</span></div>) <div class='tooltip'>return true<span class='tooltip-content'>2.07k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_64' href='#L_DEMANDED_64'><pre>64</pre></a></td><td class='covered-line'><pre>724</pre></td><td class='code'><pre> replaceInstUsesWith(Inst, V);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_65' href='#L_DEMANDED_65'><pre>65</pre></a></td><td class='covered-line'><pre>724</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_66' href='#L_DEMANDED_66'><pre>66</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_67' href='#L_DEMANDED_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_68' href='#L_DEMANDED_68'><pre>68</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This form of SimplifyDemandedBits simplifies the specified instruction</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_69' href='#L_DEMANDED_69'><pre>69</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operand if possible, updating it in place. It returns true if it made any</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_70' href='#L_DEMANDED_70'><pre>70</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// change and false otherwise.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_71' href='#L_DEMANDED_71'><pre>71</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>bool InstCombiner::SimplifyDemandedBits(Use &U, const APInt &DemandedMask,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_72' href='#L_DEMANDED_72'><pre>72</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt &KnownZero, APInt &KnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_73' href='#L_DEMANDED_73'><pre>73</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre> unsigned Depth) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_74' href='#L_DEMANDED_74'><pre>74</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre> auto *UserI = dyn_cast<Instruction>(U.getUser());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_75' href='#L_DEMANDED_75'><pre>75</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre> Value *NewVal = SimplifyDemandedUseBits(U.get(), DemandedMask, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_76' href='#L_DEMANDED_76'><pre>76</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre> KnownOne, Depth, UserI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_77' href='#L_DEMANDED_77'><pre>77</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre> if (<div class='tooltip'>!NewVal<span class='tooltip-content'>4.25M</span></div>) <div class='tooltip'>return false<span class='tooltip-content'>4.25M</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_78' href='#L_DEMANDED_78'><pre>78</pre></a></td><td class='covered-line'><pre>4.57k</pre></td><td class='code'><pre> U = NewVal;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_79' href='#L_DEMANDED_79'><pre>79</pre></a></td><td class='covered-line'><pre>4.57k</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_80' href='#L_DEMANDED_80'><pre>80</pre></a></td><td class='covered-line'><pre>4.25M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_81' href='#L_DEMANDED_81'><pre>81</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_82' href='#L_DEMANDED_82'><pre>82</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_83' href='#L_DEMANDED_83'><pre>83</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This function attempts to replace V with a simpler value based on the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_84' href='#L_DEMANDED_84'><pre>84</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// demanded bits. When this function is called, it is known that only the bits</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_85' href='#L_DEMANDED_85'><pre>85</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// set in DemandedMask of the result of V are ever used downstream.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_86' href='#L_DEMANDED_86'><pre>86</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Consequently, depending on the mask and V, it may be possible to replace V</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_87' href='#L_DEMANDED_87'><pre>87</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// with a constant or one of its operands. In such cases, this function does</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_88' href='#L_DEMANDED_88'><pre>88</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// the replacement and returns true. In all other cases, it returns false after</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_89' href='#L_DEMANDED_89'><pre>89</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// analyzing the expression and setting KnownOne and known to be one in the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_90' href='#L_DEMANDED_90'><pre>90</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// expression. KnownZero contains all the bits that are known to be zero in the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_91' href='#L_DEMANDED_91'><pre>91</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// expression. These are provided to potentially allow the caller (which might</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_92' href='#L_DEMANDED_92'><pre>92</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// recursively be SimplifyDemandedBits itself) to simplify the expression.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_93' href='#L_DEMANDED_93'><pre>93</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// KnownOne and KnownZero always follow the invariant that:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_94' href='#L_DEMANDED_94'><pre>94</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// KnownOne & KnownZero == 0.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_95' href='#L_DEMANDED_95'><pre>95</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// That is, a bit can't be both 1 and 0. Note that the bits in KnownOne and</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_96' href='#L_DEMANDED_96'><pre>96</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// KnownZero may only be accurate for those bits set in DemandedMask. Note also</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_97' href='#L_DEMANDED_97'><pre>97</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// that the bitwidth of V, DemandedMask, KnownZero and KnownOne must all be the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_98' href='#L_DEMANDED_98'><pre>98</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// same.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_99' href='#L_DEMANDED_99'><pre>99</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_100' href='#L_DEMANDED_100'><pre>100</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This returns null if it did not change anything and it permits no</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_101' href='#L_DEMANDED_101'><pre>101</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// simplification. This returns V itself if it did some simplification of V's</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_102' href='#L_DEMANDED_102'><pre>102</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operands based on the information about what bits are demanded. This returns</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_103' href='#L_DEMANDED_103'><pre>103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// some other non-null value if it found out that V is equal to another value</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_104' href='#L_DEMANDED_104'><pre>104</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// in the context where the specified bits are demanded, but not for all users.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_105' href='#L_DEMANDED_105'><pre>105</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_106' href='#L_DEMANDED_106'><pre>106</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt &KnownZero, APInt &KnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_107' href='#L_DEMANDED_107'><pre>107</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> unsigned Depth,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_108' href='#L_DEMANDED_108'><pre>108</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> Instruction *CxtI) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_109' href='#L_DEMANDED_109'><pre>109</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> assert(V != nullptr && "Null pointer of Value???");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_110' href='#L_DEMANDED_110'><pre>110</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> assert(Depth <= 6 && "Limit Search Depth");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_111' href='#L_DEMANDED_111'><pre>111</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> uint32_t BitWidth = DemandedMask.getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_112' href='#L_DEMANDED_112'><pre>112</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> Type *VTy = V->getType();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_113' href='#L_DEMANDED_113'><pre>113</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> assert(</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_114' href='#L_DEMANDED_114'><pre>114</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> (!VTy->isIntOrIntVectorTy() || VTy->getScalarSizeInBits() == BitWidth) &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_115' href='#L_DEMANDED_115'><pre>115</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> KnownZero.getBitWidth() == BitWidth &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_116' href='#L_DEMANDED_116'><pre>116</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> KnownOne.getBitWidth() == BitWidth &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_117' href='#L_DEMANDED_117'><pre>117</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> "Value *V, DemandedMask, KnownZero and KnownOne "</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_118' href='#L_DEMANDED_118'><pre>118</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> "must have same BitWidth");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_119' href='#L_DEMANDED_119'><pre>119</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> const APInt *C;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_120' href='#L_DEMANDED_120'><pre>120</pre></a></td><td class='covered-line'><pre>4.87M</pre></td><td class='code'><pre> if (<div class='tooltip'>match(V, m_APInt(C))<span class='tooltip-content'>4.87M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.01M</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_121' href='#L_DEMANDED_121'><pre>121</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> // We know all of the bits for a scalar constant or a splat vector constant!</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_122' href='#L_DEMANDED_122'><pre>122</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> KnownOne = *C & DemandedMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_123' href='#L_DEMANDED_123'><pre>123</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> KnownZero = ~KnownOne & DemandedMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_124' href='#L_DEMANDED_124'><pre>124</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_125' href='#L_DEMANDED_125'><pre>125</pre></a></td><td class='covered-line'><pre>1.01M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_126' href='#L_DEMANDED_126'><pre>126</pre></a></td><td class='covered-line'><pre>3.85M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.85M</span></div><div class='tooltip'>isa<ConstantPointerNull>(V)<span class='tooltip-content'>3.85M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>291k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_127' href='#L_DEMANDED_127'><pre>127</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> // We know all of the bits for a constant!</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_128' href='#L_DEMANDED_128'><pre>128</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> KnownOne.clearAllBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_129' href='#L_DEMANDED_129'><pre>129</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> KnownZero = DemandedMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_130' href='#L_DEMANDED_130'><pre>130</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_131' href='#L_DEMANDED_131'><pre>131</pre></a></td><td class='covered-line'><pre>291k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_132' href='#L_DEMANDED_132'><pre>132</pre></a></td><td class='covered-line'><pre>3.85M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_133' href='#L_DEMANDED_133'><pre>133</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre> KnownZero.clearAllBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_134' href='#L_DEMANDED_134'><pre>134</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre> KnownOne.clearAllBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_135' href='#L_DEMANDED_135'><pre>135</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre> if (<div class='tooltip'>DemandedMask == 0<span class='tooltip-content'>3.56M</span></div>) <div class='tooltip'>{ // Not demanding any bits from V.<span class='tooltip-content'>42</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_136' href='#L_DEMANDED_136'><pre>136</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> if (isa<UndefValue>(V))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_137' href='#L_DEMANDED_137'><pre>137</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_138' href='#L_DEMANDED_138'><pre>138</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return UndefValue::get(VTy);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_139' href='#L_DEMANDED_139'><pre>139</pre></a></td><td class='covered-line'><pre>42</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_140' href='#L_DEMANDED_140'><pre>140</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_141' href='#L_DEMANDED_141'><pre>141</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.56M</span></div><div class='tooltip'>Depth == 6<span class='tooltip-content'>3.56M</span></div>) // Limit search depth.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_142' href='#L_DEMANDED_142'><pre>142</pre></a></td><td class='covered-line'><pre>3.72k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_143' href='#L_DEMANDED_143'><pre>143</pre></a></td><td class='covered-line'><pre>3.56M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_144' href='#L_DEMANDED_144'><pre>144</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> APInt LHSKnownZero(BitWidth, 0), LHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_145' href='#L_DEMANDED_145'><pre>145</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> APInt RHSKnownZero(BitWidth, 0), RHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_146' href='#L_DEMANDED_146'><pre>146</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_147' href='#L_DEMANDED_147'><pre>147</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_148' href='#L_DEMANDED_148'><pre>148</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>3.55M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>156k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_149' href='#L_DEMANDED_149'><pre>149</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> computeKnownBits(V, KnownZero, KnownOne, Depth, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_150' href='#L_DEMANDED_150'><pre>150</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> return nullptr; // Only analyze instructions.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_151' href='#L_DEMANDED_151'><pre>151</pre></a></td><td class='covered-line'><pre>156k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_152' href='#L_DEMANDED_152'><pre>152</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_153' href='#L_DEMANDED_153'><pre>153</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> // If there are multiple uses of this value and we aren't at the root, then</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_154' href='#L_DEMANDED_154'><pre>154</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> // we can't do any simplifications of the operands, because DemandedMask</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_155' href='#L_DEMANDED_155'><pre>155</pre></a></td><td class='covered-line'><pre>3.55M</pre></td><td class='code'><pre> // only reflects the bits demanded by *one* of the users.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_156' href='#L_DEMANDED_156'><pre>156</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.40M</span></div><div class='tooltip'>Depth != 0 && <span class='tooltip-content'>3.40M</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>1.21M</span></div>) <div class='tooltip'>{<span class='tooltip-content'>414k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_157' href='#L_DEMANDED_157'><pre>157</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> // Despite the fact that we can't simplify this instruction in all User's</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_158' href='#L_DEMANDED_158'><pre>158</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> // context, we can at least compute the knownzero/knownone bits, and we can</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_159' href='#L_DEMANDED_159'><pre>159</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> // do simplifications that apply to *just* the one user if we know that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_160' href='#L_DEMANDED_160'><pre>160</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> // this instruction has a simpler value in that context.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_161' href='#L_DEMANDED_161'><pre>161</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> if (<div class='tooltip'>I->getOpcode() == Instruction::And<span class='tooltip-content'>414k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>7.76k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_162' href='#L_DEMANDED_162'><pre>162</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> // If either the LHS or the RHS are Zero, the result is zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_163' href='#L_DEMANDED_163'><pre>163</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(1), RHSKnownZero, RHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_164' href='#L_DEMANDED_164'><pre>164</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_165' href='#L_DEMANDED_165'><pre>165</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_166' href='#L_DEMANDED_166'><pre>166</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_167' href='#L_DEMANDED_167'><pre>167</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_168' href='#L_DEMANDED_168'><pre>168</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> // If all of the demanded bits are known 1 on one side, return the other.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_169' href='#L_DEMANDED_169'><pre>169</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> // These bits cannot contribute to the result of the 'and' in this</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_170' href='#L_DEMANDED_170'><pre>170</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> // context.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_171' href='#L_DEMANDED_171'><pre>171</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> if ((DemandedMask & ~LHSKnownZero & RHSKnownOne) ==</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_172' href='#L_DEMANDED_172'><pre>172</pre></a></td><td class='covered-line'><pre>7.76k</pre></td><td class='code'><pre> (DemandedMask & ~LHSKnownZero))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_173' href='#L_DEMANDED_173'><pre>173</pre></a></td><td class='covered-line'><pre>148</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_174' href='#L_DEMANDED_174'><pre>174</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.62k</span></div><div class='tooltip'>(DemandedMask & ~RHSKnownZero & LHSKnownOne) ==<span class='tooltip-content'>7.62k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_175' href='#L_DEMANDED_175'><pre>175</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre> (DemandedMask & ~RHSKnownZero))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_176' href='#L_DEMANDED_176'><pre>176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_177' href='#L_DEMANDED_177'><pre>177</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_178' href='#L_DEMANDED_178'><pre>178</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre> // If all of the demanded bits in the inputs are known zeros, return zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_179' href='#L_DEMANDED_179'><pre>179</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.62k</span></div><div class='tooltip'>(DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask<span class='tooltip-content'>7.62k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_180' href='#L_DEMANDED_180'><pre>180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Constant::getNullValue(VTy)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_181' href='#L_DEMANDED_181'><pre>181</pre></a></td><td class='covered-line'><pre>7.62k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_182' href='#L_DEMANDED_182'><pre>182</pre></a></td><td class='covered-line'><pre>406k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>406k</span></div><div class='tooltip'>I->getOpcode() == Instruction::Or<span class='tooltip-content'>406k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>21.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_183' href='#L_DEMANDED_183'><pre>183</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // We can simplify (X|Y) -> X or Y in the user's context if we know that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_184' href='#L_DEMANDED_184'><pre>184</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // only bits from X or Y are demanded.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_185' href='#L_DEMANDED_185'><pre>185</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_186' href='#L_DEMANDED_186'><pre>186</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // If either the LHS or the RHS are One, the result is One.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_187' href='#L_DEMANDED_187'><pre>187</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(1), RHSKnownZero, RHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_188' href='#L_DEMANDED_188'><pre>188</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_189' href='#L_DEMANDED_189'><pre>189</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_190' href='#L_DEMANDED_190'><pre>190</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_191' href='#L_DEMANDED_191'><pre>191</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_192' href='#L_DEMANDED_192'><pre>192</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // If all of the demanded bits are known zero on one side, return the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_193' href='#L_DEMANDED_193'><pre>193</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // other. These bits cannot contribute to the result of the 'or' in this</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_194' href='#L_DEMANDED_194'><pre>194</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> // context.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_195' href='#L_DEMANDED_195'><pre>195</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> if ((DemandedMask & ~LHSKnownOne & RHSKnownZero) ==</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_196' href='#L_DEMANDED_196'><pre>196</pre></a></td><td class='covered-line'><pre>21.3k</pre></td><td class='code'><pre> (DemandedMask & ~LHSKnownOne))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_197' href='#L_DEMANDED_197'><pre>197</pre></a></td><td class='covered-line'><pre>113</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_198' href='#L_DEMANDED_198'><pre>198</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.2k</span></div><div class='tooltip'>(DemandedMask & ~RHSKnownOne & LHSKnownZero) ==<span class='tooltip-content'>21.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_199' href='#L_DEMANDED_199'><pre>199</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre> (DemandedMask & ~RHSKnownOne))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_200' href='#L_DEMANDED_200'><pre>200</pre></a></td><td class='covered-line'><pre>48</pre></td><td class='code'><pre> return I->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_201' href='#L_DEMANDED_201'><pre>201</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_202' href='#L_DEMANDED_202'><pre>202</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre> // If all of the potentially set bits on one side are known to be set on</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_203' href='#L_DEMANDED_203'><pre>203</pre></a></td><td class='covered-line'><pre>21.2k</pre></td><td class='code'><pre> // the other side, just use the 'other' side.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_204' href='#L_DEMANDED_204'><pre>204</pre></a></td><td class='covered-line'><pre>21.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.1k</span></div><div class='tooltip'>(DemandedMask & (~RHSKnownZero) & LHSKnownOne) ==<span class='tooltip-content'>21.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_205' href='#L_DEMANDED_205'><pre>205</pre></a></td><td class='covered-line'><pre>21.1k</pre></td><td class='code'><pre> (DemandedMask & (~RHSKnownZero)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_206' href='#L_DEMANDED_206'><pre>206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_207' href='#L_DEMANDED_207'><pre>207</pre></a></td><td class='covered-line'><pre>21.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>21.1k</span></div><div class='tooltip'>(DemandedMask & (~LHSKnownZero) & RHSKnownOne) ==<span class='tooltip-content'>21.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_208' href='#L_DEMANDED_208'><pre>208</pre></a></td><td class='covered-line'><pre>21.1k</pre></td><td class='code'><pre> (DemandedMask & (~LHSKnownZero)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_209' href='#L_DEMANDED_209'><pre>209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_210' href='#L_DEMANDED_210'><pre>210</pre></a></td><td class='covered-line'><pre>385k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>385k</span></div><div class='tooltip'>I->getOpcode() == Instruction::Xor<span class='tooltip-content'>385k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6.50k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_211' href='#L_DEMANDED_211'><pre>211</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> // We can simplify (X^Y) -> X or Y in the user's context if we know that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_212' href='#L_DEMANDED_212'><pre>212</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> // only bits from X or Y are demanded.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_213' href='#L_DEMANDED_213'><pre>213</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_214' href='#L_DEMANDED_214'><pre>214</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(1), RHSKnownZero, RHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_215' href='#L_DEMANDED_215'><pre>215</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_216' href='#L_DEMANDED_216'><pre>216</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_217' href='#L_DEMANDED_217'><pre>217</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_218' href='#L_DEMANDED_218'><pre>218</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_219' href='#L_DEMANDED_219'><pre>219</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> // If all of the demanded bits are known zero on one side, return the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_220' href='#L_DEMANDED_220'><pre>220</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> // other.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_221' href='#L_DEMANDED_221'><pre>221</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> if ((DemandedMask & RHSKnownZero) == DemandedMask)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_222' href='#L_DEMANDED_222'><pre>222</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_223' href='#L_DEMANDED_223'><pre>223</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.50k</span></div><div class='tooltip'>(DemandedMask & LHSKnownZero) == DemandedMask<span class='tooltip-content'>6.50k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_224' href='#L_DEMANDED_224'><pre>224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_225' href='#L_DEMANDED_225'><pre>225</pre></a></td><td class='covered-line'><pre>6.50k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_226' href='#L_DEMANDED_226'><pre>226</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_227' href='#L_DEMANDED_227'><pre>227</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> // Compute the KnownZero/KnownOne bits to simplify things downstream.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_228' href='#L_DEMANDED_228'><pre>228</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> computeKnownBits(I, KnownZero, KnownOne, Depth, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_229' href='#L_DEMANDED_229'><pre>229</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_230' href='#L_DEMANDED_230'><pre>230</pre></a></td><td class='covered-line'><pre>414k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_231' href='#L_DEMANDED_231'><pre>231</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_232' href='#L_DEMANDED_232'><pre>232</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre> // If this is the root being simplified, allow it to have multiple uses,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_233' href='#L_DEMANDED_233'><pre>233</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre> // just set the DemandedMask to all bits so that we can try to simplify the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_234' href='#L_DEMANDED_234'><pre>234</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre> // operands. This allows visitTruncInst (for example) to simplify the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_235' href='#L_DEMANDED_235'><pre>235</pre></a></td><td class='covered-line'><pre>3.40M</pre></td><td class='code'><pre> // operand of a trunc without duplicating all the logic below.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_236' href='#L_DEMANDED_236'><pre>236</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.98M</span></div><div class='tooltip'>Depth == 0 && <span class='tooltip-content'>2.98M</span></div><div class='tooltip'>!V->hasOneUse()<span class='tooltip-content'>2.18M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_237' href='#L_DEMANDED_237'><pre>237</pre></a></td><td class='covered-line'><pre>1.06M</pre></td><td class='code'><pre> DemandedMask = APInt::getAllOnesValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_238' href='#L_DEMANDED_238'><pre>238</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_239' href='#L_DEMANDED_239'><pre>239</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_240' href='#L_DEMANDED_240'><pre>240</pre></a></td><td class='covered-line'><pre>1.44M</pre></td><td class='code'><pre> default:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_241' href='#L_DEMANDED_241'><pre>241</pre></a></td><td class='covered-line'><pre>1.44M</pre></td><td class='code'><pre> computeKnownBits(I, KnownZero, KnownOne, Depth, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_242' href='#L_DEMANDED_242'><pre>242</pre></a></td><td class='covered-line'><pre>1.44M</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_243' href='#L_DEMANDED_243'><pre>243</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_244' href='#L_DEMANDED_244'><pre>244</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> // If either the LHS or the RHS are Zero, the result is zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_245' href='#L_DEMANDED_245'><pre>245</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_246' href='#L_DEMANDED_246'><pre>246</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> RHSKnownOne, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_247' href='#L_DEMANDED_247'><pre>247</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(0), DemandedMask & ~RHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_248' href='#L_DEMANDED_248'><pre>248</pre></a></td><td class='covered-line'><pre>264k</pre></td><td class='code'><pre> LHSKnownZero, LHSKnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_249' href='#L_DEMANDED_249'><pre>249</pre></a></td><td class='covered-line'><pre>503</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_250' href='#L_DEMANDED_250'><pre>250</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> assert(!(RHSKnownZero & RHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_251' href='#L_DEMANDED_251'><pre>251</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> assert(!(LHSKnownZero & LHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_252' href='#L_DEMANDED_252'><pre>252</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_253' href='#L_DEMANDED_253'><pre>253</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> // If the client is only demanding bits that we know, return the known</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_254' href='#L_DEMANDED_254'><pre>254</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> // constant.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_255' href='#L_DEMANDED_255'><pre>255</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> if ((DemandedMask & ((RHSKnownZero | LHSKnownZero)|</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_256' href='#L_DEMANDED_256'><pre>256</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> (RHSKnownOne & LHSKnownOne))) == DemandedMask)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_257' href='#L_DEMANDED_257'><pre>257</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return Constant::getIntegerValue(VTy, RHSKnownOne & LHSKnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_258' href='#L_DEMANDED_258'><pre>258</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_259' href='#L_DEMANDED_259'><pre>259</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> // If all of the demanded bits are known 1 on one side, return the other.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_260' href='#L_DEMANDED_260'><pre>260</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> // These bits cannot contribute to the result of the 'and'.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_261' href='#L_DEMANDED_261'><pre>261</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>263k</span></div><div class='tooltip'>(DemandedMask & ~LHSKnownZero & RHSKnownOne) ==<span class='tooltip-content'>263k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_262' href='#L_DEMANDED_262'><pre>262</pre></a></td><td class='covered-line'><pre>263k</pre></td><td class='code'><pre> (DemandedMask & ~LHSKnownZero))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_263' href='#L_DEMANDED_263'><pre>263</pre></a></td><td class='covered-line'><pre>2.12k</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_264' href='#L_DEMANDED_264'><pre>264</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>261k</span></div><div class='tooltip'>(DemandedMask & ~RHSKnownZero & LHSKnownOne) ==<span class='tooltip-content'>261k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_265' href='#L_DEMANDED_265'><pre>265</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> (DemandedMask & ~RHSKnownZero))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_266' href='#L_DEMANDED_266'><pre>266</pre></a></td><td class='covered-line'><pre>151</pre></td><td class='code'><pre> return I->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_267' href='#L_DEMANDED_267'><pre>267</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_268' href='#L_DEMANDED_268'><pre>268</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> // If all of the demanded bits in the inputs are known zeros, return zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_269' href='#L_DEMANDED_269'><pre>269</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>261k</span></div><div class='tooltip'>(DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask<span class='tooltip-content'>261k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_270' href='#L_DEMANDED_270'><pre>270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return Constant::getNullValue(VTy)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_271' href='#L_DEMANDED_271'><pre>271</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_272' href='#L_DEMANDED_272'><pre>272</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> // If the RHS is a constant, see if we can simplify it.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_273' href='#L_DEMANDED_273'><pre>273</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>261k</span></div><div class='tooltip'>ShrinkDemandedConstant(I, 1, DemandedMask & ~LHSKnownZero)<span class='tooltip-content'>261k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_274' href='#L_DEMANDED_274'><pre>274</pre></a></td><td class='covered-line'><pre>507</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_275' href='#L_DEMANDED_275'><pre>275</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_276' href='#L_DEMANDED_276'><pre>276</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> // Output known-1 bits are only known if set in both the LHS & RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_277' href='#L_DEMANDED_277'><pre>277</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> KnownOne = RHSKnownOne & LHSKnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_278' href='#L_DEMANDED_278'><pre>278</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> // Output known-0 are known to be clear if zero in either the LHS | RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_279' href='#L_DEMANDED_279'><pre>279</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> KnownZero = RHSKnownZero | LHSKnownZero;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_280' href='#L_DEMANDED_280'><pre>280</pre></a></td><td class='covered-line'><pre>261k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_281' href='#L_DEMANDED_281'><pre>281</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_282' href='#L_DEMANDED_282'><pre>282</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> // If either the LHS or the RHS are One, the result is One.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_283' href='#L_DEMANDED_283'><pre>283</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_284' href='#L_DEMANDED_284'><pre>284</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> RHSKnownOne, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_285' href='#L_DEMANDED_285'><pre>285</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(0), DemandedMask & ~RHSKnownOne,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_286' href='#L_DEMANDED_286'><pre>286</pre></a></td><td class='covered-line'><pre>129k</pre></td><td class='code'><pre> LHSKnownZero, LHSKnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_287' href='#L_DEMANDED_287'><pre>287</pre></a></td><td class='covered-line'><pre>619</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_288' href='#L_DEMANDED_288'><pre>288</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> assert(!(RHSKnownZero & RHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_289' href='#L_DEMANDED_289'><pre>289</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> assert(!(LHSKnownZero & LHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_290' href='#L_DEMANDED_290'><pre>290</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_291' href='#L_DEMANDED_291'><pre>291</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // If the client is only demanding bits that we know, return the known</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_292' href='#L_DEMANDED_292'><pre>292</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // constant.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_293' href='#L_DEMANDED_293'><pre>293</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> if ((DemandedMask & ((RHSKnownZero & LHSKnownZero)|</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_294' href='#L_DEMANDED_294'><pre>294</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> (RHSKnownOne | LHSKnownOne))) == DemandedMask)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_295' href='#L_DEMANDED_295'><pre>295</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return Constant::getIntegerValue(VTy, RHSKnownOne | LHSKnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_296' href='#L_DEMANDED_296'><pre>296</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_297' href='#L_DEMANDED_297'><pre>297</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // If all of the demanded bits are known zero on one side, return the other.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_298' href='#L_DEMANDED_298'><pre>298</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // These bits cannot contribute to the result of the 'or'.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_299' href='#L_DEMANDED_299'><pre>299</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>128k</span></div><div class='tooltip'>(DemandedMask & ~LHSKnownOne & RHSKnownZero) ==<span class='tooltip-content'>128k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_300' href='#L_DEMANDED_300'><pre>300</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> (DemandedMask & ~LHSKnownOne))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_301' href='#L_DEMANDED_301'><pre>301</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_302' href='#L_DEMANDED_302'><pre>302</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>128k</span></div><div class='tooltip'>(DemandedMask & ~RHSKnownOne & LHSKnownZero) ==<span class='tooltip-content'>128k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_303' href='#L_DEMANDED_303'><pre>303</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> (DemandedMask & ~RHSKnownOne))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_304' href='#L_DEMANDED_304'><pre>304</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return I->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_305' href='#L_DEMANDED_305'><pre>305</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_306' href='#L_DEMANDED_306'><pre>306</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // If all of the potentially set bits on one side are known to be set on</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_307' href='#L_DEMANDED_307'><pre>307</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // the other side, just use the 'other' side.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_308' href='#L_DEMANDED_308'><pre>308</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>128k</span></div><div class='tooltip'>(DemandedMask & (~RHSKnownZero) & LHSKnownOne) ==<span class='tooltip-content'>128k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_309' href='#L_DEMANDED_309'><pre>309</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> (DemandedMask & (~RHSKnownZero)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_310' href='#L_DEMANDED_310'><pre>310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_311' href='#L_DEMANDED_311'><pre>311</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>128k</span></div><div class='tooltip'>(DemandedMask & (~LHSKnownZero) & RHSKnownOne) ==<span class='tooltip-content'>128k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_312' href='#L_DEMANDED_312'><pre>312</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> (DemandedMask & (~LHSKnownZero)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_313' href='#L_DEMANDED_313'><pre>313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_314' href='#L_DEMANDED_314'><pre>314</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_315' href='#L_DEMANDED_315'><pre>315</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // If the RHS is a constant, see if we can simplify it.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_316' href='#L_DEMANDED_316'><pre>316</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>128k</span></div><div class='tooltip'>ShrinkDemandedConstant(I, 1, DemandedMask)<span class='tooltip-content'>128k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_317' href='#L_DEMANDED_317'><pre>317</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_318' href='#L_DEMANDED_318'><pre>318</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_319' href='#L_DEMANDED_319'><pre>319</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // Output known-0 bits are only known if clear in both the LHS & RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_320' href='#L_DEMANDED_320'><pre>320</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> KnownZero = RHSKnownZero & LHSKnownZero;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_321' href='#L_DEMANDED_321'><pre>321</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> // Output known-1 are known to be set if set in either the LHS | RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_322' href='#L_DEMANDED_322'><pre>322</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> KnownOne = RHSKnownOne | LHSKnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_323' href='#L_DEMANDED_323'><pre>323</pre></a></td><td class='covered-line'><pre>128k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_324' href='#L_DEMANDED_324'><pre>324</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> case Instruction::Xor: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_325' href='#L_DEMANDED_325'><pre>325</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, RHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_326' href='#L_DEMANDED_326'><pre>326</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> RHSKnownOne, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_327' href='#L_DEMANDED_327'><pre>327</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, LHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_328' href='#L_DEMANDED_328'><pre>328</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> LHSKnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_329' href='#L_DEMANDED_329'><pre>329</pre></a></td><td class='covered-line'><pre>30</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_330' href='#L_DEMANDED_330'><pre>330</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> assert(!(RHSKnownZero & RHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_331' href='#L_DEMANDED_331'><pre>331</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> assert(!(LHSKnownZero & LHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_332' href='#L_DEMANDED_332'><pre>332</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_333' href='#L_DEMANDED_333'><pre>333</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // Output known-0 bits are known if clear or set in both the LHS & RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_334' href='#L_DEMANDED_334'><pre>334</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> APInt IKnownZero = (RHSKnownZero & LHSKnownZero) |</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_335' href='#L_DEMANDED_335'><pre>335</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> (RHSKnownOne & LHSKnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_336' href='#L_DEMANDED_336'><pre>336</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // Output known-1 are known to be set if set in only one of the LHS, RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_337' href='#L_DEMANDED_337'><pre>337</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> APInt IKnownOne = (RHSKnownZero & LHSKnownOne) |</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_338' href='#L_DEMANDED_338'><pre>338</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> (RHSKnownOne & LHSKnownZero);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_339' href='#L_DEMANDED_339'><pre>339</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_340' href='#L_DEMANDED_340'><pre>340</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If the client is only demanding bits that we know, return the known</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_341' href='#L_DEMANDED_341'><pre>341</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // constant.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_342' href='#L_DEMANDED_342'><pre>342</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> if ((DemandedMask & (IKnownZero|IKnownOne)) == DemandedMask)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_343' href='#L_DEMANDED_343'><pre>343</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return Constant::getIntegerValue(VTy, IKnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_344' href='#L_DEMANDED_344'><pre>344</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_345' href='#L_DEMANDED_345'><pre>345</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If all of the demanded bits are known zero on one side, return the other.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_346' href='#L_DEMANDED_346'><pre>346</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // These bits cannot contribute to the result of the 'xor'.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_347' href='#L_DEMANDED_347'><pre>347</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>(DemandedMask & RHSKnownZero) == DemandedMask<span class='tooltip-content'>63.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_348' href='#L_DEMANDED_348'><pre>348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_349' href='#L_DEMANDED_349'><pre>349</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>(DemandedMask & LHSKnownZero) == DemandedMask<span class='tooltip-content'>63.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_350' href='#L_DEMANDED_350'><pre>350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_351' href='#L_DEMANDED_351'><pre>351</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_352' href='#L_DEMANDED_352'><pre>352</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If all of the demanded bits are known to be zero on one side or the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_353' href='#L_DEMANDED_353'><pre>353</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // other, turn this into an *inclusive* or.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_354' href='#L_DEMANDED_354'><pre>354</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_355' href='#L_DEMANDED_355'><pre>355</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>(DemandedMask & ~RHSKnownZero & ~LHSKnownZero) == 0<span class='tooltip-content'>63.2k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_356' href='#L_DEMANDED_356'><pre>356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *Or =</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_357' href='#L_DEMANDED_357'><pre>357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_358' href='#L_DEMANDED_358'><pre>358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_359' href='#L_DEMANDED_359'><pre>359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertNewInstWith(Or, *I);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_360' href='#L_DEMANDED_360'><pre>360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_361' href='#L_DEMANDED_361'><pre>361</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_362' href='#L_DEMANDED_362'><pre>362</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If all of the demanded bits on one side are known, and all of the set</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_363' href='#L_DEMANDED_363'><pre>363</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // bits on that side are also known to be set on the other side, turn this</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_364' href='#L_DEMANDED_364'><pre>364</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // into an AND, as we know the bits will be cleared.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_365' href='#L_DEMANDED_365'><pre>365</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_366' href='#L_DEMANDED_366'><pre>366</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>(DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask<span class='tooltip-content'>63.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>42.1k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_367' href='#L_DEMANDED_367'><pre>367</pre></a></td><td class='covered-line'><pre>42.1k</pre></td><td class='code'><pre> // all known</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_368' href='#L_DEMANDED_368'><pre>368</pre></a></td><td class='covered-line'><pre>42.1k</pre></td><td class='code'><pre> if (<div class='tooltip'>(RHSKnownOne & LHSKnownOne) == RHSKnownOne<span class='tooltip-content'>42.1k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_369' href='#L_DEMANDED_369'><pre>369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *AndC = Constant::getIntegerValue(VTy,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_370' href='#L_DEMANDED_370'><pre>370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ~RHSKnownOne & DemandedMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_371' href='#L_DEMANDED_371'><pre>371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *And = BinaryOperator::CreateAnd(I->getOperand(0), AndC);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_372' href='#L_DEMANDED_372'><pre>372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertNewInstWith(And, *I);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_373' href='#L_DEMANDED_373'><pre>373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_374' href='#L_DEMANDED_374'><pre>374</pre></a></td><td class='covered-line'><pre>42.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_375' href='#L_DEMANDED_375'><pre>375</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_376' href='#L_DEMANDED_376'><pre>376</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If the RHS is a constant, see if we can simplify it.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_377' href='#L_DEMANDED_377'><pre>377</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // FIXME: for XOR, we prefer to force bits to 1 if they will make a -1.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_378' href='#L_DEMANDED_378'><pre>378</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>63.2k</span></div><div class='tooltip'>ShrinkDemandedConstant(I, 1, DemandedMask)<span class='tooltip-content'>63.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_379' href='#L_DEMANDED_379'><pre>379</pre></a></td><td class='covered-line'><pre>50</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_380' href='#L_DEMANDED_380'><pre>380</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_381' href='#L_DEMANDED_381'><pre>381</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // If our LHS is an 'and' and if it has one use, and if any of the bits we</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_382' href='#L_DEMANDED_382'><pre>382</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // are flipping are known to be set, then the xor is just resetting those</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_383' href='#L_DEMANDED_383'><pre>383</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // bits to zero. We can just knock out bits from the 'and' and the 'xor',</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_384' href='#L_DEMANDED_384'><pre>384</pre></a></td><td class='covered-line'><pre>63.2k</pre></td><td class='code'><pre> // simplifying both of them.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_385' href='#L_DEMANDED_385'><pre>385</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>63.1k</span></div><div class='tooltip'>LHSInst<span class='tooltip-content'>63.1k</span></div> = dyn_cast<Instruction>(I->getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_386' href='#L_DEMANDED_386'><pre>386</pre></a></td><td class='covered-line'><pre>62.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>62.6k</span></div><div class='tooltip'>LHSInst->getOpcode() == Instruction::And && <span class='tooltip-content'>62.6k</span></div><div class='tooltip'>LHSInst->hasOneUse()<span class='tooltip-content'>3.26k</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_387' href='#L_DEMANDED_387'><pre>387</pre></a></td><td class='covered-line'><pre>3.02k</pre></td><td class='code'><pre> isa<ConstantInt>(I->getOperand(1)) &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_388' href='#L_DEMANDED_388'><pre>388</pre></a></td><td class='covered-line'><pre>889</pre></td><td class='code'><pre> isa<ConstantInt>(LHSInst->getOperand(1)) &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_389' href='#L_DEMANDED_389'><pre>389</pre></a></td><td class='covered-line'><pre>331</pre></td><td class='code'><pre> <div class='tooltip'>(LHSKnownOne & RHSKnownOne & DemandedMask) != 0<span class='tooltip-content'>331</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_390' href='#L_DEMANDED_390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *AndRHS = cast<ConstantInt>(LHSInst->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_391' href='#L_DEMANDED_391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt *XorRHS = cast<ConstantInt>(I->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_392' href='#L_DEMANDED_392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt NewMask = ~(LHSKnownOne & RHSKnownOne & DemandedMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_393' href='#L_DEMANDED_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_394' href='#L_DEMANDED_394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *AndC =</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_395' href='#L_DEMANDED_395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(I->getType(), NewMask & AndRHS->getValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_396' href='#L_DEMANDED_396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewAnd = BinaryOperator::CreateAnd(I->getOperand(0), AndC);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_397' href='#L_DEMANDED_397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstWith(NewAnd, *I);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_398' href='#L_DEMANDED_398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_399' href='#L_DEMANDED_399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *XorC =</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_400' href='#L_DEMANDED_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(I->getType(), NewMask & XorRHS->getValue());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_401' href='#L_DEMANDED_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *NewXor = BinaryOperator::CreateXor(NewAnd, XorC);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_402' href='#L_DEMANDED_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertNewInstWith(NewXor, *I);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_403' href='#L_DEMANDED_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_404' href='#L_DEMANDED_404'><pre>404</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_405' href='#L_DEMANDED_405'><pre>405</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> // Output known-0 bits are known if clear or set in both the LHS & RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_406' href='#L_DEMANDED_406'><pre>406</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> KnownZero= (RHSKnownZero & LHSKnownZero) | (RHSKnownOne & LHSKnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_407' href='#L_DEMANDED_407'><pre>407</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> // Output known-1 are known to be set if set in only one of the LHS, RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_408' href='#L_DEMANDED_408'><pre>408</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> KnownOne = (RHSKnownZero & LHSKnownOne) | (RHSKnownOne & LHSKnownZero);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_409' href='#L_DEMANDED_409'><pre>409</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_410' href='#L_DEMANDED_410'><pre>410</pre></a></td><td class='covered-line'><pre>63.1k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_411' href='#L_DEMANDED_411'><pre>411</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> case Instruction::Select:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_412' href='#L_DEMANDED_412'><pre>412</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> // If this is a select as part of a min/max pattern, don't simplify any</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_413' href='#L_DEMANDED_413'><pre>413</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> // further in case we break the structure.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_414' href='#L_DEMANDED_414'><pre>414</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> Value *LHS, *RHS;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_415' href='#L_DEMANDED_415'><pre>415</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre> if (matchSelectPattern(I, LHS, RHS).Flavor != SPF_UNKNOWN)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_416' href='#L_DEMANDED_416'><pre>416</pre></a></td><td class='covered-line'><pre>11.0k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_417' href='#L_DEMANDED_417'><pre>417</pre></a></td><td class='covered-line'><pre>25.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_418' href='#L_DEMANDED_418'><pre>418</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>14.0k</span></div><div class='tooltip'>SimplifyDemandedBits(I->getOperandUse(2), DemandedMask, RHSKnownZero,<span class='tooltip-content'>14.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_419' href='#L_DEMANDED_419'><pre>419</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> RHSKnownOne, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_420' href='#L_DEMANDED_420'><pre>420</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, LHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_421' href='#L_DEMANDED_421'><pre>421</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> LHSKnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_422' href='#L_DEMANDED_422'><pre>422</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_423' href='#L_DEMANDED_423'><pre>423</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> assert(!(RHSKnownZero & RHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_424' href='#L_DEMANDED_424'><pre>424</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> assert(!(LHSKnownZero & LHSKnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_425' href='#L_DEMANDED_425'><pre>425</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_426' href='#L_DEMANDED_426'><pre>426</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> // If the operands are constants, see if we can simplify them.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_427' href='#L_DEMANDED_427'><pre>427</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> if (ShrinkDemandedConstant(I, 1, DemandedMask) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_428' href='#L_DEMANDED_428'><pre>428</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> ShrinkDemandedConstant(I, 2, DemandedMask))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_429' href='#L_DEMANDED_429'><pre>429</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_430' href='#L_DEMANDED_430'><pre>430</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_431' href='#L_DEMANDED_431'><pre>431</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> // Only known if known in both the LHS and RHS.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_432' href='#L_DEMANDED_432'><pre>432</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> KnownOne = RHSKnownOne & LHSKnownOne;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_433' href='#L_DEMANDED_433'><pre>433</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> KnownZero = RHSKnownZero & LHSKnownZero;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_434' href='#L_DEMANDED_434'><pre>434</pre></a></td><td class='covered-line'><pre>14.0k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_435' href='#L_DEMANDED_435'><pre>435</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> case Instruction::Trunc: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_436' href='#L_DEMANDED_436'><pre>436</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> unsigned truncBf = I->getOperand(0)->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_437' href='#L_DEMANDED_437'><pre>437</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> DemandedMask = DemandedMask.zext(truncBf);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_438' href='#L_DEMANDED_438'><pre>438</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> KnownZero = KnownZero.zext(truncBf);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_439' href='#L_DEMANDED_439'><pre>439</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> KnownOne = KnownOne.zext(truncBf);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_440' href='#L_DEMANDED_440'><pre>440</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_441' href='#L_DEMANDED_441'><pre>441</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_442' href='#L_DEMANDED_442'><pre>442</pre></a></td><td class='covered-line'><pre>973</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_443' href='#L_DEMANDED_443'><pre>443</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> DemandedMask = DemandedMask.trunc(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_444' href='#L_DEMANDED_444'><pre>444</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> KnownZero = KnownZero.trunc(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_445' href='#L_DEMANDED_445'><pre>445</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> KnownOne = KnownOne.trunc(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_446' href='#L_DEMANDED_446'><pre>446</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_447' href='#L_DEMANDED_447'><pre>447</pre></a></td><td class='covered-line'><pre>112k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_448' href='#L_DEMANDED_448'><pre>448</pre></a></td><td class='covered-line'><pre>113k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_449' href='#L_DEMANDED_449'><pre>449</pre></a></td><td class='covered-line'><pre>5.27k</pre></td><td class='code'><pre> case Instruction::BitCast:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_450' href='#L_DEMANDED_450'><pre>450</pre></a></td><td class='covered-line'><pre>5.27k</pre></td><td class='code'><pre> if (!I->getOperand(0)->getType()->isIntOrIntVectorTy())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_451' href='#L_DEMANDED_451'><pre>451</pre></a></td><td class='covered-line'><pre>5.22k</pre></td><td class='code'><pre> return nullptr; // vector->int or fp->int?</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_452' href='#L_DEMANDED_452'><pre>452</pre></a></td><td class='covered-line'><pre>5.27k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_453' href='#L_DEMANDED_453'><pre>453</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> <div class='tooltip'>if (VectorType *<span class='tooltip-content'>46</span></div><div class='tooltip'>DstVTy<span class='tooltip-content'>46</span></div> = dyn_cast<VectorType>(I->getType())) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_454' href='#L_DEMANDED_454'><pre>454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (VectorType *</span><span class='red'>SrcVTy</span><span class='red'> =</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_455' href='#L_DEMANDED_455'><pre>455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> dyn_cast<VectorType>(I->getOperand(0)->getType())) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_456' href='#L_DEMANDED_456'><pre>456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DstVTy->getNumElements() != SrcVTy->getNumElements()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_457' href='#L_DEMANDED_457'><pre>457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't touch a bitcast between vectors of different element counts.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_458' href='#L_DEMANDED_458'><pre>458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_459' href='#L_DEMANDED_459'><pre>459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_460' href='#L_DEMANDED_460'><pre>460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't touch a scalar-to-vector bitcast.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_461' href='#L_DEMANDED_461'><pre>461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_462' href='#L_DEMANDED_462'><pre>462</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>46</span></div><div class='tooltip'>I->getOperand(0)->getType()->isVectorTy()<span class='tooltip-content'>46</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_463' href='#L_DEMANDED_463'><pre>463</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> // Don't touch a vector-to-scalar bitcast.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_464' href='#L_DEMANDED_464'><pre>464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_465' href='#L_DEMANDED_465'><pre>465</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_466' href='#L_DEMANDED_466'><pre>466</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>46</span></div><div class='tooltip'>SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero,<span class='tooltip-content'>46</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_467' href='#L_DEMANDED_467'><pre>467</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_468' href='#L_DEMANDED_468'><pre>468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_469' href='#L_DEMANDED_469'><pre>469</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_470' href='#L_DEMANDED_470'><pre>470</pre></a></td><td class='covered-line'><pre>46</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_471' href='#L_DEMANDED_471'><pre>471</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> case Instruction::ZExt: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_472' href='#L_DEMANDED_472'><pre>472</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> // Compute the bits in the result that are not present in the input.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_473' href='#L_DEMANDED_473'><pre>473</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> unsigned SrcBitWidth =I->getOperand(0)->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_474' href='#L_DEMANDED_474'><pre>474</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_475' href='#L_DEMANDED_475'><pre>475</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> DemandedMask = DemandedMask.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_476' href='#L_DEMANDED_476'><pre>476</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownZero = KnownZero.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_477' href='#L_DEMANDED_477'><pre>477</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownOne = KnownOne.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_478' href='#L_DEMANDED_478'><pre>478</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMask, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_479' href='#L_DEMANDED_479'><pre>479</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_480' href='#L_DEMANDED_480'><pre>480</pre></a></td><td class='covered-line'><pre>41</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_481' href='#L_DEMANDED_481'><pre>481</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> DemandedMask = DemandedMask.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_482' href='#L_DEMANDED_482'><pre>482</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownZero = KnownZero.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_483' href='#L_DEMANDED_483'><pre>483</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownOne = KnownOne.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_484' href='#L_DEMANDED_484'><pre>484</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_485' href='#L_DEMANDED_485'><pre>485</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> // The top bits are known to be zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_486' href='#L_DEMANDED_486'><pre>486</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> KnownZero |= APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_487' href='#L_DEMANDED_487'><pre>487</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_488' href='#L_DEMANDED_488'><pre>488</pre></a></td><td class='covered-line'><pre>93.0k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_489' href='#L_DEMANDED_489'><pre>489</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> case Instruction::SExt: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_490' href='#L_DEMANDED_490'><pre>490</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // Compute the bits in the result that are not present in the input.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_491' href='#L_DEMANDED_491'><pre>491</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> unsigned SrcBitWidth =I->getOperand(0)->getType()->getScalarSizeInBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_492' href='#L_DEMANDED_492'><pre>492</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_493' href='#L_DEMANDED_493'><pre>493</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> APInt InputDemandedBits = DemandedMask &</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_494' href='#L_DEMANDED_494'><pre>494</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> APInt::getLowBitsSet(BitWidth, SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_495' href='#L_DEMANDED_495'><pre>495</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_496' href='#L_DEMANDED_496'><pre>496</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> APInt NewBits(APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_497' href='#L_DEMANDED_497'><pre>497</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // If any of the sign extended bits are demanded, we know that the sign</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_498' href='#L_DEMANDED_498'><pre>498</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // bit is demanded.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_499' href='#L_DEMANDED_499'><pre>499</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> if ((NewBits & DemandedMask) != 0)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_500' href='#L_DEMANDED_500'><pre>500</pre></a></td><td class='covered-line'><pre>38.3k</pre></td><td class='code'><pre> InputDemandedBits.setBit(SrcBitWidth-1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_501' href='#L_DEMANDED_501'><pre>501</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_502' href='#L_DEMANDED_502'><pre>502</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> InputDemandedBits = InputDemandedBits.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_503' href='#L_DEMANDED_503'><pre>503</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> KnownZero = KnownZero.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_504' href='#L_DEMANDED_504'><pre>504</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> KnownOne = KnownOne.trunc(SrcBitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_505' href='#L_DEMANDED_505'><pre>505</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), InputDemandedBits, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_506' href='#L_DEMANDED_506'><pre>506</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_507' href='#L_DEMANDED_507'><pre>507</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_508' href='#L_DEMANDED_508'><pre>508</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> InputDemandedBits = InputDemandedBits.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_509' href='#L_DEMANDED_509'><pre>509</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> KnownZero = KnownZero.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_510' href='#L_DEMANDED_510'><pre>510</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> KnownOne = KnownOne.zext(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_511' href='#L_DEMANDED_511'><pre>511</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_512' href='#L_DEMANDED_512'><pre>512</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_513' href='#L_DEMANDED_513'><pre>513</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // If the sign bit of the input is known set or clear, then we know the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_514' href='#L_DEMANDED_514'><pre>514</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // top bits of the result.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_515' href='#L_DEMANDED_515'><pre>515</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_516' href='#L_DEMANDED_516'><pre>516</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // If the input sign bit is known zero, or if the NewBits are not demanded</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_517' href='#L_DEMANDED_517'><pre>517</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> // convert this into a zero extension.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_518' href='#L_DEMANDED_518'><pre>518</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>KnownZero[SrcBitWidth-1] || <span class='tooltip-content'>38.6k</span></div><div class='tooltip'>(NewBits & ~DemandedMask) == NewBits<span class='tooltip-content'>38.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>291</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_519' href='#L_DEMANDED_519'><pre>519</pre></a></td><td class='covered-line'><pre>291</pre></td><td class='code'><pre> // Convert to ZExt cast</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_520' href='#L_DEMANDED_520'><pre>520</pre></a></td><td class='covered-line'><pre>291</pre></td><td class='code'><pre> CastInst *NewCast = new ZExtInst(I->getOperand(0), VTy, I->getName());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_521' href='#L_DEMANDED_521'><pre>521</pre></a></td><td class='covered-line'><pre>291</pre></td><td class='code'><pre> return InsertNewInstWith(NewCast, *I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_522' href='#L_DEMANDED_522'><pre>522</pre></a></td><td class='covered-line'><pre>38.3k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>38.3k</span></div><div class='tooltip'>KnownOne[SrcBitWidth-1]<span class='tooltip-content'>38.3k</span></div>) <div class='tooltip'><span class='red'>{ // Input sign bit known set</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_523' href='#L_DEMANDED_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> KnownOne |= NewBits;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_524' href='#L_DEMANDED_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_525' href='#L_DEMANDED_525'><pre>525</pre></a></td><td class='covered-line'><pre>38.3k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_526' href='#L_DEMANDED_526'><pre>526</pre></a></td><td class='covered-line'><pre>38.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_527' href='#L_DEMANDED_527'><pre>527</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_528' href='#L_DEMANDED_528'><pre>528</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> case Instruction::Sub: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_529' href='#L_DEMANDED_529'><pre>529</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> /// If the high-bits of an ADD/SUB are not demanded, then we do not care</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_530' href='#L_DEMANDED_530'><pre>530</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> /// about the high bits of the operands.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_531' href='#L_DEMANDED_531'><pre>531</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> unsigned NLZ = DemandedMask.countLeadingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_532' href='#L_DEMANDED_532'><pre>532</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> if (<div class='tooltip'>NLZ > 0<span class='tooltip-content'>280k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>34.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_533' href='#L_DEMANDED_533'><pre>533</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> // Right fill the mask of bits for this ADD/SUB to demand the most</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_534' href='#L_DEMANDED_534'><pre>534</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> // significant bit and all those below it.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_535' href='#L_DEMANDED_535'><pre>535</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> APInt DemandedFromOps(APInt::getLowBitsSet(BitWidth, BitWidth-NLZ));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_536' href='#L_DEMANDED_536'><pre>536</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedFromOps,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_537' href='#L_DEMANDED_537'><pre>537</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> LHSKnownZero, LHSKnownOne, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_538' href='#L_DEMANDED_538'><pre>538</pre></a></td><td class='covered-line'><pre>34.4k</pre></td><td class='code'><pre> ShrinkDemandedConstant(I, 1, DemandedFromOps) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_539' href='#L_DEMANDED_539'><pre>539</pre></a></td><td class='covered-line'><pre>34.1k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(1), DemandedFromOps,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_540' href='#L_DEMANDED_540'><pre>540</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> LHSKnownZero, LHSKnownOne, Depth + 1)) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_541' href='#L_DEMANDED_541'><pre>541</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> // Disable the nsw and nuw flags here: We can no longer guarantee that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_542' href='#L_DEMANDED_542'><pre>542</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> // we won't wrap after simplification. Removing the nsw/nuw flags is</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_543' href='#L_DEMANDED_543'><pre>543</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> // legal here because the top bit is not demanded.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_544' href='#L_DEMANDED_544'><pre>544</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> BinaryOperator &BinOP = *cast<BinaryOperator>(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_545' href='#L_DEMANDED_545'><pre>545</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> BinOP.setHasNoSignedWrap(false);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_546' href='#L_DEMANDED_546'><pre>546</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> BinOP.setHasNoUnsignedWrap(false);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_547' href='#L_DEMANDED_547'><pre>547</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_548' href='#L_DEMANDED_548'><pre>548</pre></a></td><td class='covered-line'><pre>638</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_549' href='#L_DEMANDED_549'><pre>549</pre></a></td><td class='covered-line'><pre>34.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_550' href='#L_DEMANDED_550'><pre>550</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_551' href='#L_DEMANDED_551'><pre>551</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> // Otherwise just hand the add/sub off to computeKnownBits to fill in</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_552' href='#L_DEMANDED_552'><pre>552</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> // the known zeros and ones.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_553' href='#L_DEMANDED_553'><pre>553</pre></a></td><td class='covered-line'><pre>279k</pre></td><td class='code'><pre> computeKnownBits(V, KnownZero, KnownOne, Depth, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_554' href='#L_DEMANDED_554'><pre>554</pre></a></td><td class='covered-line'><pre>279k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_555' href='#L_DEMANDED_555'><pre>555</pre></a></td><td class='covered-line'><pre>280k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_556' href='#L_DEMANDED_556'><pre>556</pre></a></td><td class='covered-line'><pre>172k</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_557' href='#L_DEMANDED_557'><pre>557</pre></a></td><td class='covered-line'><pre>172k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>SA<span class='tooltip-content'>172k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>151k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_558' href='#L_DEMANDED_558'><pre>558</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_559' href='#L_DEMANDED_559'><pre>559</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> Value *VarX; ConstantInt *C1;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_560' href='#L_DEMANDED_560'><pre>560</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> if (<div class='tooltip'>match(I->getOperand(0), m_Shr(m_Value(VarX), m_ConstantInt(C1)))<span class='tooltip-content'>151k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.81k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_561' href='#L_DEMANDED_561'><pre>561</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> Instruction *Shr = cast<Instruction>(I->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_562' href='#L_DEMANDED_562'><pre>562</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> Value *R = SimplifyShrShlDemandedBits(Shr, I, DemandedMask,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_563' href='#L_DEMANDED_563'><pre>563</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> KnownZero, KnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_564' href='#L_DEMANDED_564'><pre>564</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> if (R)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_565' href='#L_DEMANDED_565'><pre>565</pre></a></td><td class='covered-line'><pre>52</pre></td><td class='code'><pre> return R;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_566' href='#L_DEMANDED_566'><pre>566</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_567' href='#L_DEMANDED_567'><pre>567</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_568' href='#L_DEMANDED_568'><pre>568</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_569' href='#L_DEMANDED_569'><pre>569</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> uint64_t ShiftAmt = SA->getLimitedValue(BitWidth-1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_570' href='#L_DEMANDED_570'><pre>570</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> APInt DemandedMaskIn(DemandedMask.lshr(ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_571' href='#L_DEMANDED_571'><pre>571</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_572' href='#L_DEMANDED_572'><pre>572</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> // If the shift is NUW/NSW, then it does demand the high bits.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_573' href='#L_DEMANDED_573'><pre>573</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> ShlOperator *IOp = cast<ShlOperator>(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_574' href='#L_DEMANDED_574'><pre>574</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> if (IOp->hasNoSignedWrap())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_575' href='#L_DEMANDED_575'><pre>575</pre></a></td><td class='covered-line'><pre>53.8k</pre></td><td class='code'><pre> DemandedMaskIn |= APInt::getHighBitsSet(BitWidth, ShiftAmt+1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_576' href='#L_DEMANDED_576'><pre>576</pre></a></td><td class='covered-line'><pre>97.4k</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>97.4k</span></div><div class='tooltip'>IOp->hasNoUnsignedWrap()<span class='tooltip-content'>97.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_577' href='#L_DEMANDED_577'><pre>577</pre></a></td><td class='covered-line'><pre>9.05k</pre></td><td class='code'><pre> DemandedMaskIn |= APInt::getHighBitsSet(BitWidth, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_578' href='#L_DEMANDED_578'><pre>578</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_579' href='#L_DEMANDED_579'><pre>579</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMaskIn, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_580' href='#L_DEMANDED_580'><pre>580</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_581' href='#L_DEMANDED_581'><pre>581</pre></a></td><td class='covered-line'><pre>172</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_582' href='#L_DEMANDED_582'><pre>582</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_583' href='#L_DEMANDED_583'><pre>583</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> KnownZero <<= ShiftAmt;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_584' href='#L_DEMANDED_584'><pre>584</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> KnownOne <<= ShiftAmt;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_585' href='#L_DEMANDED_585'><pre>585</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> // low bits known zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_586' href='#L_DEMANDED_586'><pre>586</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> if (ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_587' href='#L_DEMANDED_587'><pre>587</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> KnownZero |= APInt::getLowBitsSet(BitWidth, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_588' href='#L_DEMANDED_588'><pre>588</pre></a></td><td class='covered-line'><pre>151k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_589' href='#L_DEMANDED_589'><pre>589</pre></a></td><td class='covered-line'><pre>172k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_590' href='#L_DEMANDED_590'><pre>590</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_591' href='#L_DEMANDED_591'><pre>591</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> // For a logical shift right</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_592' href='#L_DEMANDED_592'><pre>592</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>SA<span class='tooltip-content'>101k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>89.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_593' href='#L_DEMANDED_593'><pre>593</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> uint64_t ShiftAmt = SA->getLimitedValue(BitWidth-1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_594' href='#L_DEMANDED_594'><pre>594</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_595' href='#L_DEMANDED_595'><pre>595</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> // Unsigned shift right.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_596' href='#L_DEMANDED_596'><pre>596</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> APInt DemandedMaskIn(DemandedMask.shl(ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_597' href='#L_DEMANDED_597'><pre>597</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_598' href='#L_DEMANDED_598'><pre>598</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> // If the shift is exact, then it does demand the low bits (and knows that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_599' href='#L_DEMANDED_599'><pre>599</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> // they are zero).</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_600' href='#L_DEMANDED_600'><pre>600</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> if (cast<LShrOperator>(I)->isExact())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_601' href='#L_DEMANDED_601'><pre>601</pre></a></td><td class='covered-line'><pre>4.56k</pre></td><td class='code'><pre> DemandedMaskIn |= APInt::getLowBitsSet(BitWidth, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_602' href='#L_DEMANDED_602'><pre>602</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_603' href='#L_DEMANDED_603'><pre>603</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMaskIn, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_604' href='#L_DEMANDED_604'><pre>604</pre></a></td><td class='covered-line'><pre>89.7k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_605' href='#L_DEMANDED_605'><pre>605</pre></a></td><td class='covered-line'><pre>97</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_606' href='#L_DEMANDED_606'><pre>606</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_607' href='#L_DEMANDED_607'><pre>607</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_608' href='#L_DEMANDED_608'><pre>608</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> KnownOne = APIntOps::lshr(KnownOne, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_609' href='#L_DEMANDED_609'><pre>609</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>ShiftAmt<span class='tooltip-content'>89.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>89.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_610' href='#L_DEMANDED_610'><pre>610</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> // Compute the new bits that are at the top now.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_611' href='#L_DEMANDED_611'><pre>611</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> APInt HighBits(APInt::getHighBitsSet(BitWidth, ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_612' href='#L_DEMANDED_612'><pre>612</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> KnownZero |= HighBits; // high bits known zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_613' href='#L_DEMANDED_613'><pre>613</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_614' href='#L_DEMANDED_614'><pre>614</pre></a></td><td class='covered-line'><pre>89.6k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_615' href='#L_DEMANDED_615'><pre>615</pre></a></td><td class='covered-line'><pre>101k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_616' href='#L_DEMANDED_616'><pre>616</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_617' href='#L_DEMANDED_617'><pre>617</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // If this is an arithmetic shift right and only the low-bit is set, we can</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_618' href='#L_DEMANDED_618'><pre>618</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // always convert this into a logical shr, even if the shift amount is</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_619' href='#L_DEMANDED_619'><pre>619</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // variable. The low bit of the shift cannot be an input sign bit unless</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_620' href='#L_DEMANDED_620'><pre>620</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // the shift amount is >= the size of the datatype, which is undefined.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_621' href='#L_DEMANDED_621'><pre>621</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>DemandedMask == 1<span class='tooltip-content'>54.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>19</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_622' href='#L_DEMANDED_622'><pre>622</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> // Perform the logical shift right.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_623' href='#L_DEMANDED_623'><pre>623</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> Instruction *NewVal = BinaryOperator::CreateLShr(</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_624' href='#L_DEMANDED_624'><pre>624</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> I->getOperand(0), I->getOperand(1), I->getName());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_625' href='#L_DEMANDED_625'><pre>625</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> return InsertNewInstWith(NewVal, *I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_626' href='#L_DEMANDED_626'><pre>626</pre></a></td><td class='covered-line'><pre>19</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_627' href='#L_DEMANDED_627'><pre>627</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_628' href='#L_DEMANDED_628'><pre>628</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // If the sign bit is the only bit demanded by this ashr, then there is no</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_629' href='#L_DEMANDED_629'><pre>629</pre></a></td><td class='covered-line'><pre>54.7k</pre></td><td class='code'><pre> // need to do it, the shift doesn't change the high bit.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_630' href='#L_DEMANDED_630'><pre>630</pre></a></td><td class='covered-line'><pre>54.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>54.6k</span></div><div class='tooltip'>DemandedMask.isSignBit()<span class='tooltip-content'>54.6k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_631' href='#L_DEMANDED_631'><pre>631</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_632' href='#L_DEMANDED_632'><pre>632</pre></a></td><td class='covered-line'><pre>54.6k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_633' href='#L_DEMANDED_633'><pre>633</pre></a></td><td class='covered-line'><pre>54.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>54.6k</span></div><div class='tooltip'>SA<span class='tooltip-content'>54.6k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>47.8k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_634' href='#L_DEMANDED_634'><pre>634</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> uint32_t ShiftAmt = SA->getLimitedValue(BitWidth-1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_635' href='#L_DEMANDED_635'><pre>635</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_636' href='#L_DEMANDED_636'><pre>636</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> // Signed shift right.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_637' href='#L_DEMANDED_637'><pre>637</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> APInt DemandedMaskIn(DemandedMask.shl(ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_638' href='#L_DEMANDED_638'><pre>638</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> // If any of the "high bits" are demanded, we should set the sign bit as</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_639' href='#L_DEMANDED_639'><pre>639</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> // demanded.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_640' href='#L_DEMANDED_640'><pre>640</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> if (DemandedMask.countLeadingZeros() <= ShiftAmt)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_641' href='#L_DEMANDED_641'><pre>641</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> DemandedMaskIn.setBit(BitWidth-1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_642' href='#L_DEMANDED_642'><pre>642</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_643' href='#L_DEMANDED_643'><pre>643</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> // If the shift is exact, then it does demand the low bits (and knows that</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_644' href='#L_DEMANDED_644'><pre>644</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> // they are zero).</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_645' href='#L_DEMANDED_645'><pre>645</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> if (cast<AShrOperator>(I)->isExact())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_646' href='#L_DEMANDED_646'><pre>646</pre></a></td><td class='covered-line'><pre>31.1k</pre></td><td class='code'><pre> DemandedMaskIn |= APInt::getLowBitsSet(BitWidth, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_647' href='#L_DEMANDED_647'><pre>647</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_648' href='#L_DEMANDED_648'><pre>648</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), DemandedMaskIn, KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_649' href='#L_DEMANDED_649'><pre>649</pre></a></td><td class='covered-line'><pre>47.8k</pre></td><td class='code'><pre> KnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_650' href='#L_DEMANDED_650'><pre>650</pre></a></td><td class='covered-line'><pre>128</pre></td><td class='code'><pre> return I;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_651' href='#L_DEMANDED_651'><pre>651</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_652' href='#L_DEMANDED_652'><pre>652</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> // Compute the new bits that are at the top now.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_653' href='#L_DEMANDED_653'><pre>653</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> APInt HighBits(APInt::getHighBitsSet(BitWidth, ShiftAmt));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_654' href='#L_DEMANDED_654'><pre>654</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> KnownZero = APIntOps::lshr(KnownZero, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_655' href='#L_DEMANDED_655'><pre>655</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> KnownOne = APIntOps::lshr(KnownOne, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_656' href='#L_DEMANDED_656'><pre>656</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_657' href='#L_DEMANDED_657'><pre>657</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> // Handle the sign bits.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_658' href='#L_DEMANDED_658'><pre>658</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> APInt SignBit(APInt::getSignBit(BitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_659' href='#L_DEMANDED_659'><pre>659</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> // Adjust to where it is now in the mask.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_660' href='#L_DEMANDED_660'><pre>660</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> SignBit = APIntOps::lshr(SignBit, ShiftAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_661' href='#L_DEMANDED_661'><pre>661</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_662' href='#L_DEMANDED_662'><pre>662</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> // If the input sign bit is known to be zero, or if none of the top bits</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_663' href='#L_DEMANDED_663'><pre>663</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> // are demanded, turn this into an unsigned shift right.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_664' href='#L_DEMANDED_664'><pre>664</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> if (<div class='tooltip'>BitWidth <= ShiftAmt || <span class='tooltip-content'>47.7k</span></div><div class='tooltip'>KnownZero[BitWidth-ShiftAmt-1]<span class='tooltip-content'>47.7k</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_665' href='#L_DEMANDED_665'><pre>665</pre></a></td><td class='covered-line'><pre>47.3k</pre></td><td class='code'><pre> <div class='tooltip'>(HighBits & ~DemandedMask) == HighBits<span class='tooltip-content'>47.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>571</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_666' href='#L_DEMANDED_666'><pre>666</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> // Perform the logical shift right.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_667' href='#L_DEMANDED_667'><pre>667</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> BinaryOperator *NewVal = BinaryOperator::CreateLShr(I->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_668' href='#L_DEMANDED_668'><pre>668</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> SA, I->getName());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_669' href='#L_DEMANDED_669'><pre>669</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> NewVal->setIsExact(cast<BinaryOperator>(I)->isExact());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_670' href='#L_DEMANDED_670'><pre>670</pre></a></td><td class='covered-line'><pre>571</pre></td><td class='code'><pre> return InsertNewInstWith(NewVal, *I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_671' href='#L_DEMANDED_671'><pre>671</pre></a></td><td class='covered-line'><pre>47.1k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>47.1k</span></div><div class='tooltip'>(KnownOne & SignBit) != 0<span class='tooltip-content'>47.1k</span></div>) <div class='tooltip'><span class='red'>{ // New bits are known one.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_672' href='#L_DEMANDED_672'><pre>672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> KnownOne |= HighBits;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_673' href='#L_DEMANDED_673'><pre>673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_674' href='#L_DEMANDED_674'><pre>674</pre></a></td><td class='covered-line'><pre>47.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_675' href='#L_DEMANDED_675'><pre>675</pre></a></td><td class='covered-line'><pre>53.9k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_676' href='#L_DEMANDED_676'><pre>676</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> case Instruction::SRem:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_677' href='#L_DEMANDED_677'><pre>677</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Rem<span class='tooltip-content'>3.31k</span></div> = dyn_cast<ConstantInt>(I->getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>2.81k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_678' href='#L_DEMANDED_678'><pre>678</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> // X % -1 demands all the bits because we don't want to introduce</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_679' href='#L_DEMANDED_679'><pre>679</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> // INT_MIN % -1 (== undef) by accident.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_680' href='#L_DEMANDED_680'><pre>680</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> if (Rem->isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_681' href='#L_DEMANDED_681'><pre>681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>break</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_682' href='#L_DEMANDED_682'><pre>682</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> APInt RA = Rem->getValue().abs();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_683' href='#L_DEMANDED_683'><pre>683</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> if (<div class='tooltip'>RA.isPowerOf2()<span class='tooltip-content'>2.81k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>932</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_684' href='#L_DEMANDED_684'><pre>684</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> if (DemandedMask.ult(RA)) // srem won't affect demanded bits</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_685' href='#L_DEMANDED_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I->getOperand(0)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_686' href='#L_DEMANDED_686'><pre>686</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_687' href='#L_DEMANDED_687'><pre>687</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> APInt LowBits = RA - 1;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_688' href='#L_DEMANDED_688'><pre>688</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> APInt Mask2 = LowBits | APInt::getSignBit(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_689' href='#L_DEMANDED_689'><pre>689</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), Mask2, LHSKnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_690' href='#L_DEMANDED_690'><pre>690</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> LHSKnownOne, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_691' href='#L_DEMANDED_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_692' href='#L_DEMANDED_692'><pre>692</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_693' href='#L_DEMANDED_693'><pre>693</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> // The low bits of LHS are unchanged by the srem.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_694' href='#L_DEMANDED_694'><pre>694</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> KnownZero = LHSKnownZero & LowBits;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_695' href='#L_DEMANDED_695'><pre>695</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> KnownOne = LHSKnownOne & LowBits;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_696' href='#L_DEMANDED_696'><pre>696</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_697' href='#L_DEMANDED_697'><pre>697</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> // If LHS is non-negative or has all low bits zero, then the upper bits</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_698' href='#L_DEMANDED_698'><pre>698</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> // are all zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_699' href='#L_DEMANDED_699'><pre>699</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSKnownZero[BitWidth-1] || <span class='tooltip-content'>932</span></div><div class='tooltip'>((LHSKnownZero & LowBits) == LowBits)<span class='tooltip-content'>932</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_700' href='#L_DEMANDED_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>KnownZero |= ~LowBits</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_701' href='#L_DEMANDED_701'><pre>701</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_702' href='#L_DEMANDED_702'><pre>702</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> // If LHS is negative and not all low bits are zero, then the upper bits</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_703' href='#L_DEMANDED_703'><pre>703</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> // are all one.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_704' href='#L_DEMANDED_704'><pre>704</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSKnownOne[BitWidth-1] && <span class='tooltip-content'>932</span></div><div class='tooltip'><span class='red'>((LHSKnownOne & LowBits) != 0)</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_705' href='#L_DEMANDED_705'><pre>705</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>KnownOne |= ~LowBits</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_706' href='#L_DEMANDED_706'><pre>706</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_707' href='#L_DEMANDED_707'><pre>707</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_708' href='#L_DEMANDED_708'><pre>708</pre></a></td><td class='covered-line'><pre>932</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_709' href='#L_DEMANDED_709'><pre>709</pre></a></td><td class='covered-line'><pre>2.81k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_710' href='#L_DEMANDED_710'><pre>710</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_711' href='#L_DEMANDED_711'><pre>711</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> // The sign bit is the LHS's sign bit, except when the result of the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_712' href='#L_DEMANDED_712'><pre>712</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> // remainder is zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_713' href='#L_DEMANDED_713'><pre>713</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.31k</span></div><div class='tooltip'>DemandedMask.isNegative() && <span class='tooltip-content'>3.31k</span></div><div class='tooltip'>KnownZero.isNonNegative()<span class='tooltip-content'>3.12k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.12k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_714' href='#L_DEMANDED_714'><pre>714</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> APInt LHSKnownZero(BitWidth, 0), LHSKnownOne(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_715' href='#L_DEMANDED_715'><pre>715</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> computeKnownBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth + 1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_716' href='#L_DEMANDED_716'><pre>716</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_717' href='#L_DEMANDED_717'><pre>717</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> // If it's known zero, our sign bit is also zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_718' href='#L_DEMANDED_718'><pre>718</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> if (LHSKnownZero.isNegative())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_719' href='#L_DEMANDED_719'><pre>719</pre></a></td><td class='covered-line'><pre>25</pre></td><td class='code'><pre> KnownZero.setBit(KnownZero.getBitWidth() - 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_720' href='#L_DEMANDED_720'><pre>720</pre></a></td><td class='covered-line'><pre>3.12k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_721' href='#L_DEMANDED_721'><pre>721</pre></a></td><td class='covered-line'><pre>3.31k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_722' href='#L_DEMANDED_722'><pre>722</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> case Instruction::URem: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_723' href='#L_DEMANDED_723'><pre>723</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> APInt KnownZero2(BitWidth, 0), KnownOne2(BitWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_724' href='#L_DEMANDED_724'><pre>724</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> APInt AllOnes = APInt::getAllOnesValue(BitWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_725' href='#L_DEMANDED_725'><pre>725</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> if (SimplifyDemandedBits(I->getOperandUse(0), AllOnes, KnownZero2,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_726' href='#L_DEMANDED_726'><pre>726</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> KnownOne2, Depth + 1) ||</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_727' href='#L_DEMANDED_727'><pre>727</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> SimplifyDemandedBits(I->getOperandUse(1), AllOnes, KnownZero2,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_728' href='#L_DEMANDED_728'><pre>728</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> KnownOne2, Depth + 1))</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_729' href='#L_DEMANDED_729'><pre>729</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return I</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_730' href='#L_DEMANDED_730'><pre>730</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_731' href='#L_DEMANDED_731'><pre>731</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> unsigned Leaders = KnownZero2.countLeadingOnes();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_732' href='#L_DEMANDED_732'><pre>732</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> Leaders = std::max(Leaders,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_733' href='#L_DEMANDED_733'><pre>733</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> KnownZero2.countLeadingOnes());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_734' href='#L_DEMANDED_734'><pre>734</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> KnownZero = APInt::getHighBitsSet(BitWidth, Leaders) & DemandedMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_735' href='#L_DEMANDED_735'><pre>735</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_736' href='#L_DEMANDED_736'><pre>736</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_737' href='#L_DEMANDED_737'><pre>737</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> case Instruction::Call:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_738' href='#L_DEMANDED_738'><pre>738</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> if (IntrinsicInst *<div class='tooltip'>II<span class='tooltip-content'>196k</span></div> = dyn_cast<IntrinsicInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>1.49k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_739' href='#L_DEMANDED_739'><pre>739</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre> switch (II->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_740' href='#L_DEMANDED_740'><pre>740</pre></a></td><td class='covered-line'><pre>1.18k</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_741' href='#L_DEMANDED_741'><pre>741</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> case Intrinsic::bswap: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_742' href='#L_DEMANDED_742'><pre>742</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // If the only bits demanded come from one byte of the bswap result,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_743' href='#L_DEMANDED_743'><pre>743</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // just shift the input byte into position to eliminate the bswap.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_744' href='#L_DEMANDED_744'><pre>744</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> unsigned NLZ = DemandedMask.countLeadingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_745' href='#L_DEMANDED_745'><pre>745</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> unsigned NTZ = DemandedMask.countTrailingZeros();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_746' href='#L_DEMANDED_746'><pre>746</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_747' href='#L_DEMANDED_747'><pre>747</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // Round NTZ down to the next byte. If we have 11 trailing zeros, then</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_748' href='#L_DEMANDED_748'><pre>748</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // we need all the bits down to bit 8. Likewise, round NLZ. If we</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_749' href='#L_DEMANDED_749'><pre>749</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // have 14 leading zeros, round to 8.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_750' href='#L_DEMANDED_750'><pre>750</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> NLZ &= ~7;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_751' href='#L_DEMANDED_751'><pre>751</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> NTZ &= ~7;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_752' href='#L_DEMANDED_752'><pre>752</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // If we need exactly one byte, we can do this transformation.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_753' href='#L_DEMANDED_753'><pre>753</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> if (<div class='tooltip'>BitWidth-NLZ-NTZ == 8<span class='tooltip-content'>314</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_754' href='#L_DEMANDED_754'><pre>754</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> unsigned ResultBit = NTZ;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_755' href='#L_DEMANDED_755'><pre>755</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> unsigned InputBit = BitWidth-NTZ-8;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_756' href='#L_DEMANDED_756'><pre>756</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_757' href='#L_DEMANDED_757'><pre>757</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // Replace this with either a left or right shift to get the byte into</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_758' href='#L_DEMANDED_758'><pre>758</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> // the right place.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_759' href='#L_DEMANDED_759'><pre>759</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> Instruction *NewVal;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_760' href='#L_DEMANDED_760'><pre>760</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> if (InputBit > ResultBit)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_761' href='#L_DEMANDED_761'><pre>761</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> NewVal = BinaryOperator::CreateLShr(II->getArgOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_762' href='#L_DEMANDED_762'><pre>762</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> ConstantInt::get(I->getType(), InputBit-ResultBit));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_763' href='#L_DEMANDED_763'><pre>763</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_764' href='#L_DEMANDED_764'><pre>764</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>NewVal = BinaryOperator::CreateShl(II->getArgOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_765' href='#L_DEMANDED_765'><pre>765</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantInt::get(I->getType(), ResultBit-InputBit))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_766' href='#L_DEMANDED_766'><pre>766</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> NewVal->takeName(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_767' href='#L_DEMANDED_767'><pre>767</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> return InsertNewInstWith(NewVal, *I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_768' href='#L_DEMANDED_768'><pre>768</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_769' href='#L_DEMANDED_769'><pre>769</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_770' href='#L_DEMANDED_770'><pre>770</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> // TODO: Could compute known zero/one bits based on the input.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_771' href='#L_DEMANDED_771'><pre>771</pre></a></td><td class='covered-line'><pre>311</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_772' href='#L_DEMANDED_772'><pre>772</pre></a></td><td class='covered-line'><pre>314</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_773' href='#L_DEMANDED_773'><pre>773</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::x86_mmx_pmovmskb:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_774' href='#L_DEMANDED_774'><pre>774</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_movmsk_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_775' href='#L_DEMANDED_775'><pre>775</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_movmsk_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_776' href='#L_DEMANDED_776'><pre>776</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pmovmskb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_777' href='#L_DEMANDED_777'><pre>777</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_movmsk_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_778' href='#L_DEMANDED_778'><pre>778</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_movmsk_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_779' href='#L_DEMANDED_779'><pre>779</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmovmskb: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_780' href='#L_DEMANDED_780'><pre>780</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // MOVMSK copies the vector elements' sign bits to the low bits</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_781' href='#L_DEMANDED_781'><pre>781</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // and zeros the high bits.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_782' href='#L_DEMANDED_782'><pre>782</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned ArgWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_783' href='#L_DEMANDED_783'><pre>783</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>II->getIntrinsicID() == Intrinsic::x86_mmx_pmovmskb</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_784' href='#L_DEMANDED_784'><pre>784</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ArgWidth = 8; // Arg is x86_mmx, but treated as <8 x i8>.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_785' href='#L_DEMANDED_785'><pre>785</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_786' href='#L_DEMANDED_786'><pre>786</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto Arg = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_787' href='#L_DEMANDED_787'><pre>787</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto ArgType = cast<VectorType>(Arg->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_788' href='#L_DEMANDED_788'><pre>788</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ArgWidth = ArgType->getNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_789' href='#L_DEMANDED_789'><pre>789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_790' href='#L_DEMANDED_790'><pre>790</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_791' href='#L_DEMANDED_791'><pre>791</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If we don't need any of low bits then return zero,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_792' href='#L_DEMANDED_792'><pre>792</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // we know that DemandedMask is non-zero already.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_793' href='#L_DEMANDED_793'><pre>793</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt DemandedElts = DemandedMask.zextOrTrunc(ArgWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_794' href='#L_DEMANDED_794'><pre>794</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DemandedElts == 0</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_795' href='#L_DEMANDED_795'><pre>795</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return ConstantInt::getNullValue(VTy)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_796' href='#L_DEMANDED_796'><pre>796</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_797' href='#L_DEMANDED_797'><pre>797</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We know that the upper bits are set to zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_798' href='#L_DEMANDED_798'><pre>798</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>KnownZero = APInt::getHighBitsSet(BitWidth, BitWidth - ArgWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_799' href='#L_DEMANDED_799'><pre>799</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_800' href='#L_DEMANDED_800'><pre>800</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_801' href='#L_DEMANDED_801'><pre>801</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse42_crc32_64_64:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_802' href='#L_DEMANDED_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> KnownZero = APInt::getHighBitsSet(64, 32);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_803' href='#L_DEMANDED_803'><pre>803</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_804' href='#L_DEMANDED_804'><pre>804</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_805' href='#L_DEMANDED_805'><pre>805</pre></a></td><td class='covered-line'><pre>1.49k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_806' href='#L_DEMANDED_806'><pre>806</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> computeKnownBits(V, KnownZero, KnownOne, Depth, CxtI);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_807' href='#L_DEMANDED_807'><pre>807</pre></a></td><td class='covered-line'><pre>196k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_808' href='#L_DEMANDED_808'><pre>808</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_809' href='#L_DEMANDED_809'><pre>809</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_810' href='#L_DEMANDED_810'><pre>810</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre> // If the client is only demanding bits that we know, return the known</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_811' href='#L_DEMANDED_811'><pre>811</pre></a></td><td class='covered-line'><pre>2.98M</pre></td><td class='code'><pre> // constant.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_812' href='#L_DEMANDED_812'><pre>812</pre></a></td><td class='covered-line'><pre>2.96M</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.96M</span></div><div class='tooltip'>(DemandedMask & (KnownZero|KnownOne)) == DemandedMask<span class='tooltip-content'>2.96M</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_813' href='#L_DEMANDED_813'><pre>813</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return Constant::getIntegerValue(VTy, KnownOne);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_814' href='#L_DEMANDED_814'><pre>814</pre></a></td><td class='covered-line'><pre>2.96M</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_815' href='#L_DEMANDED_815'><pre>815</pre></a></td><td class='covered-line'><pre>2.96M</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_816' href='#L_DEMANDED_816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_817' href='#L_DEMANDED_817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Helper routine of SimplifyDemandedUseBits. It tries to simplify</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_818' href='#L_DEMANDED_818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// "E1 = (X lsr C1) << C2", where the C1 and C2 are constant, into</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_819' href='#L_DEMANDED_819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// "E2 = X << (C2 - C1)" or "E2 = X >> (C1 - C2)", depending on the sign</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_820' href='#L_DEMANDED_820'><pre>820</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// of "C2-C1".</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_821' href='#L_DEMANDED_821'><pre>821</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_822' href='#L_DEMANDED_822'><pre>822</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Suppose E1 and E2 are generally different in bits S={bm, bm+1,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_823' href='#L_DEMANDED_823'><pre>823</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// ..., bn}, without considering the specific value X is holding.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_824' href='#L_DEMANDED_824'><pre>824</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// This transformation is legal iff one of following conditions is hold:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_825' href='#L_DEMANDED_825'><pre>825</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 1) All the bit in S are 0, in this case E1 == E2.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_826' href='#L_DEMANDED_826'><pre>826</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 2) We don't care those bits in S, per the input DemandedMask.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_827' href='#L_DEMANDED_827'><pre>827</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// 3) Combination of 1) and 2). Some bits in S are 0, and we don't care the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_828' href='#L_DEMANDED_828'><pre>828</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// rest bits.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_829' href='#L_DEMANDED_829'><pre>829</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_830' href='#L_DEMANDED_830'><pre>830</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Currently we only test condition 2).</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_831' href='#L_DEMANDED_831'><pre>831</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_832' href='#L_DEMANDED_832'><pre>832</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// As with SimplifyDemandedUseBits, it returns NULL if the simplification was</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_833' href='#L_DEMANDED_833'><pre>833</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// not successful.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_834' href='#L_DEMANDED_834'><pre>834</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_835' href='#L_DEMANDED_835'><pre>835</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Instruction *Shl,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_836' href='#L_DEMANDED_836'><pre>836</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> const APInt &DemandedMask,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_837' href='#L_DEMANDED_837'><pre>837</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt &KnownZero,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_838' href='#L_DEMANDED_838'><pre>838</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> APInt &KnownOne) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_839' href='#L_DEMANDED_839'><pre>839</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_840' href='#L_DEMANDED_840'><pre>840</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> const APInt &ShlOp1 = cast<ConstantInt>(Shl->getOperand(1))->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_841' href='#L_DEMANDED_841'><pre>841</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> const APInt &ShrOp1 = cast<ConstantInt>(Shr->getOperand(1))->getValue();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_842' href='#L_DEMANDED_842'><pre>842</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> if (<div class='tooltip'>!ShlOp1 || <span class='tooltip-content'>1.81k</span></div><div class='tooltip'>!ShrOp1<span class='tooltip-content'>1.81k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_843' href='#L_DEMANDED_843'><pre>843</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>; // Noop.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_844' href='#L_DEMANDED_844'><pre>844</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_845' href='#L_DEMANDED_845'><pre>845</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> Value *VarX = Shr->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_846' href='#L_DEMANDED_846'><pre>846</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> Type *Ty = VarX->getType();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_847' href='#L_DEMANDED_847'><pre>847</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> unsigned BitWidth = Ty->getIntegerBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_848' href='#L_DEMANDED_848'><pre>848</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> if (<div class='tooltip'>ShlOp1.uge(BitWidth) || <span class='tooltip-content'>1.81k</span></div><div class='tooltip'>ShrOp1.uge(BitWidth)<span class='tooltip-content'>1.81k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_849' href='#L_DEMANDED_849'><pre>849</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>; // Undef.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_850' href='#L_DEMANDED_850'><pre>850</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_851' href='#L_DEMANDED_851'><pre>851</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> unsigned ShlAmt = ShlOp1.getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_852' href='#L_DEMANDED_852'><pre>852</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> unsigned ShrAmt = ShrOp1.getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_853' href='#L_DEMANDED_853'><pre>853</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_854' href='#L_DEMANDED_854'><pre>854</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> KnownOne.clearAllBits();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_855' href='#L_DEMANDED_855'><pre>855</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> KnownZero = APInt::getLowBitsSet(KnownZero.getBitWidth(), ShlAmt - 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_856' href='#L_DEMANDED_856'><pre>856</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> KnownZero &= DemandedMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_857' href='#L_DEMANDED_857'><pre>857</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_858' href='#L_DEMANDED_858'><pre>858</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> APInt BitMask1(APInt::getAllOnesValue(BitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_859' href='#L_DEMANDED_859'><pre>859</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> APInt BitMask2(APInt::getAllOnesValue(BitWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_860' href='#L_DEMANDED_860'><pre>860</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_861' href='#L_DEMANDED_861'><pre>861</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> bool isLshr = (Shr->getOpcode() == Instruction::LShr);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_862' href='#L_DEMANDED_862'><pre>862</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> BitMask1 = isLshr ? (BitMask1.lshr(ShrAmt) << ShlAmt) :</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_863' href='#L_DEMANDED_863'><pre>863</pre></a></td><td class='covered-line'><pre>651</pre></td><td class='code'><pre> (BitMask1.ashr(ShrAmt) << ShlAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_864' href='#L_DEMANDED_864'><pre>864</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_865' href='#L_DEMANDED_865'><pre>865</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> if (<div class='tooltip'>ShrAmt <= ShlAmt<span class='tooltip-content'>1.81k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.25k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_866' href='#L_DEMANDED_866'><pre>866</pre></a></td><td class='covered-line'><pre>1.25k</pre></td><td class='code'><pre> BitMask2 <<= (ShlAmt - ShrAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_867' href='#L_DEMANDED_867'><pre>867</pre></a></td><td class='covered-line'><pre>559</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_868' href='#L_DEMANDED_868'><pre>868</pre></a></td><td class='covered-line'><pre>254</pre></td><td class='code'><pre> BitMask2 = isLshr ? BitMask2.lshr(ShrAmt - ShlAmt):</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_869' href='#L_DEMANDED_869'><pre>869</pre></a></td><td class='covered-line'><pre>305</pre></td><td class='code'><pre> BitMask2.ashr(ShrAmt - ShlAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_870' href='#L_DEMANDED_870'><pre>870</pre></a></td><td class='covered-line'><pre>559</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_871' href='#L_DEMANDED_871'><pre>871</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_872' href='#L_DEMANDED_872'><pre>872</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> // Check if condition-2 (see the comment to this function) is satified.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_873' href='#L_DEMANDED_873'><pre>873</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre> if (<div class='tooltip'>(BitMask1 & DemandedMask) == (BitMask2 & DemandedMask)<span class='tooltip-content'>1.81k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>83</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_874' href='#L_DEMANDED_874'><pre>874</pre></a></td><td class='covered-line'><pre>83</pre></td><td class='code'><pre> if (ShrAmt == ShlAmt)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_875' href='#L_DEMANDED_875'><pre>875</pre></a></td><td class='covered-line'><pre>15</pre></td><td class='code'><pre> return VarX;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_876' href='#L_DEMANDED_876'><pre>876</pre></a></td><td class='covered-line'><pre>83</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_877' href='#L_DEMANDED_877'><pre>877</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>68</span></div><div class='tooltip'>!Shr->hasOneUse()<span class='tooltip-content'>68</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_878' href='#L_DEMANDED_878'><pre>878</pre></a></td><td class='covered-line'><pre>31</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_879' href='#L_DEMANDED_879'><pre>879</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_880' href='#L_DEMANDED_880'><pre>880</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> BinaryOperator *New;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_881' href='#L_DEMANDED_881'><pre>881</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> if (<div class='tooltip'>ShrAmt < ShlAmt<span class='tooltip-content'>37</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_882' href='#L_DEMANDED_882'><pre>882</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Constant *Amt = ConstantInt::get(VarX->getType(), ShlAmt - ShrAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_883' href='#L_DEMANDED_883'><pre>883</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> New = BinaryOperator::CreateShl(VarX, Amt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_884' href='#L_DEMANDED_884'><pre>884</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> BinaryOperator *Orig = cast<BinaryOperator>(Shl);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_885' href='#L_DEMANDED_885'><pre>885</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> New->setHasNoSignedWrap(Orig->hasNoSignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_886' href='#L_DEMANDED_886'><pre>886</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> New->setHasNoUnsignedWrap(Orig->hasNoUnsignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_887' href='#L_DEMANDED_887'><pre>887</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_888' href='#L_DEMANDED_888'><pre>888</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> Constant *Amt = ConstantInt::get(VarX->getType(), ShrAmt - ShlAmt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_889' href='#L_DEMANDED_889'><pre>889</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> New = isLshr ? BinaryOperator::CreateLShr(VarX, Amt) :</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_890' href='#L_DEMANDED_890'><pre>890</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>BinaryOperator::CreateAShr(VarX, Amt)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_891' href='#L_DEMANDED_891'><pre>891</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> if (cast<BinaryOperator>(Shr)->isExact())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_892' href='#L_DEMANDED_892'><pre>892</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>New->setIsExact(true)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_893' href='#L_DEMANDED_893'><pre>893</pre></a></td><td class='covered-line'><pre>20</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_894' href='#L_DEMANDED_894'><pre>894</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_895' href='#L_DEMANDED_895'><pre>895</pre></a></td><td class='covered-line'><pre>37</pre></td><td class='code'><pre> return InsertNewInstWith(New, *Shl);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_896' href='#L_DEMANDED_896'><pre>896</pre></a></td><td class='covered-line'><pre>68</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_897' href='#L_DEMANDED_897'><pre>897</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_898' href='#L_DEMANDED_898'><pre>898</pre></a></td><td class='covered-line'><pre>1.73k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_899' href='#L_DEMANDED_899'><pre>899</pre></a></td><td class='covered-line'><pre>1.81k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_900' href='#L_DEMANDED_900'><pre>900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_901' href='#L_DEMANDED_901'><pre>901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// The specified value produces a vector with any number of elements.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_902' href='#L_DEMANDED_902'><pre>902</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// DemandedElts contains the set of elements that are actually used by the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_903' href='#L_DEMANDED_903'><pre>903</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// caller. This method analyzes which elements of the operand are undef and</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_904' href='#L_DEMANDED_904'><pre>904</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// returns that information in UndefElts.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_905' href='#L_DEMANDED_905'><pre>905</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_906' href='#L_DEMANDED_906'><pre>906</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If the information about demanded elements can be used to simplify the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_907' href='#L_DEMANDED_907'><pre>907</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// operation, the operation is simplified, then the resultant value is</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_908' href='#L_DEMANDED_908'><pre>908</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// returned. This returns null if no change was made.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_909' href='#L_DEMANDED_909'><pre>909</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_910' href='#L_DEMANDED_910'><pre>910</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> APInt &UndefElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_911' href='#L_DEMANDED_911'><pre>911</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre> unsigned Depth) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_912' href='#L_DEMANDED_912'><pre>912</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre> unsigned VWidth = V->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_913' href='#L_DEMANDED_913'><pre>913</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre> APInt EltMask(APInt::getAllOnesValue(VWidth));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_914' href='#L_DEMANDED_914'><pre>914</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre> assert((DemandedElts & ~EltMask) == 0 && "Invalid DemandedElts!");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_915' href='#L_DEMANDED_915'><pre>915</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_916' href='#L_DEMANDED_916'><pre>916</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(V)<span class='tooltip-content'>233k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>91.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_917' href='#L_DEMANDED_917'><pre>917</pre></a></td><td class='covered-line'><pre>91.2k</pre></td><td class='code'><pre> // If the entire vector is undefined, just return this info.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_918' href='#L_DEMANDED_918'><pre>918</pre></a></td><td class='covered-line'><pre>91.2k</pre></td><td class='code'><pre> UndefElts = EltMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_919' href='#L_DEMANDED_919'><pre>919</pre></a></td><td class='covered-line'><pre>91.2k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_920' href='#L_DEMANDED_920'><pre>920</pre></a></td><td class='covered-line'><pre>91.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_921' href='#L_DEMANDED_921'><pre>921</pre></a></td><td class='covered-line'><pre>233k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_922' href='#L_DEMANDED_922'><pre>922</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>142k</span></div><div class='tooltip'>DemandedElts == 0<span class='tooltip-content'>142k</span></div>) <div class='tooltip'>{ // If nothing is demanded, provide undef.<span class='tooltip-content'>82</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_923' href='#L_DEMANDED_923'><pre>923</pre></a></td><td class='covered-line'><pre>82</pre></td><td class='code'><pre> UndefElts = EltMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_924' href='#L_DEMANDED_924'><pre>924</pre></a></td><td class='covered-line'><pre>82</pre></td><td class='code'><pre> return UndefValue::get(V->getType());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_925' href='#L_DEMANDED_925'><pre>925</pre></a></td><td class='covered-line'><pre>82</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_926' href='#L_DEMANDED_926'><pre>926</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_927' href='#L_DEMANDED_927'><pre>927</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> UndefElts = 0;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_928' href='#L_DEMANDED_928'><pre>928</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_929' href='#L_DEMANDED_929'><pre>929</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> // Handle ConstantAggregateZero, ConstantVector, ConstantDataSequential.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_930' href='#L_DEMANDED_930'><pre>930</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>142k</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'>{<span class='tooltip-content'>582</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_931' href='#L_DEMANDED_931'><pre>931</pre></a></td><td class='covered-line'><pre>582</pre></td><td class='code'><pre> // Check if this is identity. If so, return 0 since we are not simplifying</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_932' href='#L_DEMANDED_932'><pre>932</pre></a></td><td class='covered-line'><pre>582</pre></td><td class='code'><pre> // anything.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_933' href='#L_DEMANDED_933'><pre>933</pre></a></td><td class='covered-line'><pre>582</pre></td><td class='code'><pre> if (DemandedElts.isAllOnesValue())</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_934' href='#L_DEMANDED_934'><pre>934</pre></a></td><td class='covered-line'><pre>252</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_935' href='#L_DEMANDED_935'><pre>935</pre></a></td><td class='covered-line'><pre>582</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_936' href='#L_DEMANDED_936'><pre>936</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> Type *EltTy = cast<VectorType>(V->getType())->getElementType();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_937' href='#L_DEMANDED_937'><pre>937</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> Constant *Undef = UndefValue::get(EltTy);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_938' href='#L_DEMANDED_938'><pre>938</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_939' href='#L_DEMANDED_939'><pre>939</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> SmallVector<Constant*, 16> Elts;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_940' href='#L_DEMANDED_940'><pre>940</pre></a></td><td class='covered-line'><pre>1.01k</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i != VWidth<span class='tooltip-content'>1.01k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>684</span></div>) <div class='tooltip'>{<span class='tooltip-content'>684</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_941' href='#L_DEMANDED_941'><pre>941</pre></a></td><td class='covered-line'><pre>684</pre></td><td class='code'><pre> if (<div class='tooltip'>!DemandedElts[i]<span class='tooltip-content'>684</span></div>) <div class='tooltip'>{ // If not demanded, set to undef.<span class='tooltip-content'>330</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_942' href='#L_DEMANDED_942'><pre>942</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> Elts.push_back(Undef);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_943' href='#L_DEMANDED_943'><pre>943</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> UndefElts.setBit(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_944' href='#L_DEMANDED_944'><pre>944</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_945' href='#L_DEMANDED_945'><pre>945</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_946' href='#L_DEMANDED_946'><pre>946</pre></a></td><td class='covered-line'><pre>684</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_947' href='#L_DEMANDED_947'><pre>947</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> Constant *Elt = C->getAggregateElement(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_948' href='#L_DEMANDED_948'><pre>948</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> if (<div class='tooltip'>!Elt<span class='tooltip-content'>354</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_949' href='#L_DEMANDED_949'><pre>949</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_950' href='#L_DEMANDED_950'><pre>950</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>354</span></div><div class='tooltip'>isa<UndefValue>(Elt)<span class='tooltip-content'>354</span></div>) <div class='tooltip'><span class='red'>{ // Already undef.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_951' href='#L_DEMANDED_951'><pre>951</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Elts.push_back(Undef);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_952' href='#L_DEMANDED_952'><pre>952</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts.setBit(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_953' href='#L_DEMANDED_953'><pre>953</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre><span class='red'> }</span> else { // Otherwise, defined.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_954' href='#L_DEMANDED_954'><pre>954</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> Elts.push_back(Elt);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_955' href='#L_DEMANDED_955'><pre>955</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_956' href='#L_DEMANDED_956'><pre>956</pre></a></td><td class='covered-line'><pre>354</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_957' href='#L_DEMANDED_957'><pre>957</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_958' href='#L_DEMANDED_958'><pre>958</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> // If we changed the constant, return it.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_959' href='#L_DEMANDED_959'><pre>959</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> Constant *NewCV = ConstantVector::get(Elts);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_960' href='#L_DEMANDED_960'><pre>960</pre></a></td><td class='covered-line'><pre>325</pre></td><td class='code'><pre> return NewCV != C ? <div class='tooltip'>NewCV<span class='tooltip-content'>5</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>325</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_961' href='#L_DEMANDED_961'><pre>961</pre></a></td><td class='covered-line'><pre>330</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_962' href='#L_DEMANDED_962'><pre>962</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_963' href='#L_DEMANDED_963'><pre>963</pre></a></td><td class='covered-line'><pre>142k</pre></td><td class='code'><pre> // Limit search depth.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_964' href='#L_DEMANDED_964'><pre>964</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>141k</span></div><div class='tooltip'>Depth == 10<span class='tooltip-content'>141k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_965' href='#L_DEMANDED_965'><pre>965</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_966' href='#L_DEMANDED_966'><pre>966</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_967' href='#L_DEMANDED_967'><pre>967</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre> // If multiple users are using the root value, proceed with</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_968' href='#L_DEMANDED_968'><pre>968</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre> // simplification conservatively assuming that all elements</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_969' href='#L_DEMANDED_969'><pre>969</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre> // are needed.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_970' href='#L_DEMANDED_970'><pre>970</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>141k</span></div><div class='tooltip'>!V->hasOneUse()<span class='tooltip-content'>141k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9.65k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_971' href='#L_DEMANDED_971'><pre>971</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // Quit if we find multiple users of a non-root value though.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_972' href='#L_DEMANDED_972'><pre>972</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // They'll be handled when it's their turn to be visited by</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_973' href='#L_DEMANDED_973'><pre>973</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // the main instcombine process.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_974' href='#L_DEMANDED_974'><pre>974</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> if (Depth != 0)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_975' href='#L_DEMANDED_975'><pre>975</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // TODO: Just compute the UndefElts information recursively.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_976' href='#L_DEMANDED_976'><pre>976</pre></a></td><td class='covered-line'><pre>4.99k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_977' href='#L_DEMANDED_977'><pre>977</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_978' href='#L_DEMANDED_978'><pre>978</pre></a></td><td class='covered-line'><pre>9.65k</pre></td><td class='code'><pre> // Conservatively assume that all elements are needed.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_979' href='#L_DEMANDED_979'><pre>979</pre></a></td><td class='covered-line'><pre>4.66k</pre></td><td class='code'><pre> DemandedElts = EltMask;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_980' href='#L_DEMANDED_980'><pre>980</pre></a></td><td class='covered-line'><pre>4.66k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_981' href='#L_DEMANDED_981'><pre>981</pre></a></td><td class='covered-line'><pre>141k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_982' href='#L_DEMANDED_982'><pre>982</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_983' href='#L_DEMANDED_983'><pre>983</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>136k</span></div>) <div class='tooltip'><span class='red'>return nullptr</span><span class='tooltip-content'>0</span></div>; // Only analyze instructions.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_984' href='#L_DEMANDED_984'><pre>984</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_985' href='#L_DEMANDED_985'><pre>985</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> bool MadeChange = false;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_986' href='#L_DEMANDED_986'><pre>986</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> APInt UndefElts2(VWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_987' href='#L_DEMANDED_987'><pre>987</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> APInt UndefElts3(VWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_988' href='#L_DEMANDED_988'><pre>988</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> Value *TmpV;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_989' href='#L_DEMANDED_989'><pre>989</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_990' href='#L_DEMANDED_990'><pre>990</pre></a></td><td class='covered-line'><pre>2.23k</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_991' href='#L_DEMANDED_991'><pre>991</pre></a></td><td class='covered-line'><pre>2.23k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_992' href='#L_DEMANDED_992'><pre>992</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> case Instruction::InsertElement: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_993' href='#L_DEMANDED_993'><pre>993</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // If this is a variable index, we don't know which element it overwrites.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_994' href='#L_DEMANDED_994'><pre>994</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // demand exactly the same input as we produce.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_995' href='#L_DEMANDED_995'><pre>995</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> ConstantInt *Idx = dyn_cast<ConstantInt>(I->getOperand(2));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_996' href='#L_DEMANDED_996'><pre>996</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Idx<span class='tooltip-content'>124k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_997' href='#L_DEMANDED_997'><pre>997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Note that we can't propagate undef elt info, because we don't know</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_998' href='#L_DEMANDED_998'><pre>998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // which elt is getting updated.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_999' href='#L_DEMANDED_999'><pre>999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1000' href='#L_DEMANDED_1000'><pre>1000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1001' href='#L_DEMANDED_1001'><pre>1001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ I->setOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1002' href='#L_DEMANDED_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1003' href='#L_DEMANDED_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1004' href='#L_DEMANDED_1004'><pre>1004</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1005' href='#L_DEMANDED_1005'><pre>1005</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // If this is inserting an element that isn't demanded, remove this</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1006' href='#L_DEMANDED_1006'><pre>1006</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // insertelement.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1007' href='#L_DEMANDED_1007'><pre>1007</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> unsigned IdxNo = Idx->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1008' href='#L_DEMANDED_1008'><pre>1008</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> if (<div class='tooltip'>IdxNo >= VWidth || <span class='tooltip-content'>124k</span></div><div class='tooltip'>!DemandedElts[IdxNo]<span class='tooltip-content'>124k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1009' href='#L_DEMANDED_1009'><pre>1009</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> Worklist.Add(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1010' href='#L_DEMANDED_1010'><pre>1010</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return I->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1011' href='#L_DEMANDED_1011'><pre>1011</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1012' href='#L_DEMANDED_1012'><pre>1012</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1013' href='#L_DEMANDED_1013'><pre>1013</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // Otherwise, the element inserted overwrites whatever was there, so the</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1014' href='#L_DEMANDED_1014'><pre>1014</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // input demanded set is simpler than the output set.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1015' href='#L_DEMANDED_1015'><pre>1015</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> APInt DemandedElts2 = DemandedElts;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1016' href='#L_DEMANDED_1016'><pre>1016</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> DemandedElts2.clearBit(IdxNo);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1017' href='#L_DEMANDED_1017'><pre>1017</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), DemandedElts2,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1018' href='#L_DEMANDED_1018'><pre>1018</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> UndefElts, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1019' href='#L_DEMANDED_1019'><pre>1019</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>124k</span></div>) <div class='tooltip'>{ I->setOperand(0, TmpV); MadeChange = true; }<span class='tooltip-content'>147</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1020' href='#L_DEMANDED_1020'><pre>1020</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1021' href='#L_DEMANDED_1021'><pre>1021</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> // The inserted element is defined.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1022' href='#L_DEMANDED_1022'><pre>1022</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> UndefElts.clearBit(IdxNo);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1023' href='#L_DEMANDED_1023'><pre>1023</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1024' href='#L_DEMANDED_1024'><pre>1024</pre></a></td><td class='covered-line'><pre>124k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1025' href='#L_DEMANDED_1025'><pre>1025</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> case Instruction::ShuffleVector: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1026' href='#L_DEMANDED_1026'><pre>1026</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> ShuffleVectorInst *Shuffle = cast<ShuffleVectorInst>(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1027' href='#L_DEMANDED_1027'><pre>1027</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> unsigned LHSVWidth =</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1028' href='#L_DEMANDED_1028'><pre>1028</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> Shuffle->getOperand(0)->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1029' href='#L_DEMANDED_1029'><pre>1029</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> APInt LeftDemanded(LHSVWidth, 0), RightDemanded(LHSVWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1030' href='#L_DEMANDED_1030'><pre>1030</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < VWidth<span class='tooltip-content'>26.9k</span></div>; <div class='tooltip'>i++<span class='tooltip-content'>18.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1031' href='#L_DEMANDED_1031'><pre>1031</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>DemandedElts[i]<span class='tooltip-content'>18.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.2k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1032' href='#L_DEMANDED_1032'><pre>1032</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> unsigned MaskVal = Shuffle->getMaskValue(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1033' href='#L_DEMANDED_1033'><pre>1033</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskVal != -1u<span class='tooltip-content'>18.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1034' href='#L_DEMANDED_1034'><pre>1034</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> assert(MaskVal < LHSVWidth * 2 &&</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1035' href='#L_DEMANDED_1035'><pre>1035</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> "shufflevector mask index out of range!");</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1036' href='#L_DEMANDED_1036'><pre>1036</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> if (MaskVal < LHSVWidth)</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1037' href='#L_DEMANDED_1037'><pre>1037</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> LeftDemanded.setBit(MaskVal);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1038' href='#L_DEMANDED_1038'><pre>1038</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1039' href='#L_DEMANDED_1039'><pre>1039</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> RightDemanded.setBit(MaskVal - LHSVWidth);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1040' href='#L_DEMANDED_1040'><pre>1040</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1041' href='#L_DEMANDED_1041'><pre>1041</pre></a></td><td class='covered-line'><pre>18.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1042' href='#L_DEMANDED_1042'><pre>1042</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1043' href='#L_DEMANDED_1043'><pre>1043</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1044' href='#L_DEMANDED_1044'><pre>1044</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> APInt LHSUndefElts(LHSVWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1045' href='#L_DEMANDED_1045'><pre>1045</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), LeftDemanded,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1046' href='#L_DEMANDED_1046'><pre>1046</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> LHSUndefElts, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1047' href='#L_DEMANDED_1047'><pre>1047</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>8.46k</span></div>) <div class='tooltip'>{ I->setOperand(0, TmpV); MadeChange = true; }<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1048' href='#L_DEMANDED_1048'><pre>1048</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1049' href='#L_DEMANDED_1049'><pre>1049</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> APInt RHSUndefElts(LHSVWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1050' href='#L_DEMANDED_1050'><pre>1050</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(1), RightDemanded,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1051' href='#L_DEMANDED_1051'><pre>1051</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> RHSUndefElts, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1052' href='#L_DEMANDED_1052'><pre>1052</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>8.46k</span></div>) <div class='tooltip'>{ I->setOperand(1, TmpV); MadeChange = true; }<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1053' href='#L_DEMANDED_1053'><pre>1053</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1054' href='#L_DEMANDED_1054'><pre>1054</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> bool NewUndefElts = false;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1055' href='#L_DEMANDED_1055'><pre>1055</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> unsigned LHSIdx = -1u, LHSValIdx = -1u;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1056' href='#L_DEMANDED_1056'><pre>1056</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> unsigned RHSIdx = -1u, RHSValIdx = -1u;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1057' href='#L_DEMANDED_1057'><pre>1057</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> bool LHSUniform = true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1058' href='#L_DEMANDED_1058'><pre>1058</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> bool RHSUniform = true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1059' href='#L_DEMANDED_1059'><pre>1059</pre></a></td><td class='covered-line'><pre>26.9k</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < VWidth<span class='tooltip-content'>26.9k</span></div>; <div class='tooltip'>i++<span class='tooltip-content'>18.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1060' href='#L_DEMANDED_1060'><pre>1060</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> unsigned MaskVal = Shuffle->getMaskValue(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1061' href='#L_DEMANDED_1061'><pre>1061</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>MaskVal == -1u<span class='tooltip-content'>18.4k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>679</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1062' href='#L_DEMANDED_1062'><pre>1062</pre></a></td><td class='covered-line'><pre>679</pre></td><td class='code'><pre> UndefElts.setBit(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1063' href='#L_DEMANDED_1063'><pre>1063</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>17.7k</span></div><div class='tooltip'>!DemandedElts[i]<span class='tooltip-content'>17.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1064' href='#L_DEMANDED_1064'><pre>1064</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> NewUndefElts = true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1065' href='#L_DEMANDED_1065'><pre>1065</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> UndefElts.setBit(i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1066' href='#L_DEMANDED_1066'><pre>1066</pre></a></td><td class='covered-line'><pre>17.7k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>17.7k</span></div><div class='tooltip'>MaskVal < LHSVWidth<span class='tooltip-content'>17.7k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>14.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1067' href='#L_DEMANDED_1067'><pre>1067</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSUndefElts[MaskVal]<span class='tooltip-content'>14.4k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1068' href='#L_DEMANDED_1068'><pre>1068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewUndefElts = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1069' href='#L_DEMANDED_1069'><pre>1069</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts.setBit(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1070' href='#L_DEMANDED_1070'><pre>1070</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1071' href='#L_DEMANDED_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>7.38k</pre></td><td class='code'><pre> LHSIdx = LHSIdx == -1u ? <div class='tooltip'>i<span class='tooltip-content'>7.38k</span></div> : <div class='tooltip'>LHSVWidth<span class='tooltip-content'>7.10k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1072' href='#L_DEMANDED_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>7.38k</pre></td><td class='code'><pre> LHSValIdx = LHSValIdx == -1u ? <div class='tooltip'>MaskVal<span class='tooltip-content'>7.38k</span></div> : <div class='tooltip'>LHSVWidth<span class='tooltip-content'>7.10k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1073' href='#L_DEMANDED_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>12.8k</pre></td><td class='code'><pre> LHSUniform = LHSUniform && (MaskVal == i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1074' href='#L_DEMANDED_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>14.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1075' href='#L_DEMANDED_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1076' href='#L_DEMANDED_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSUndefElts[MaskVal - LHSVWidth]<span class='tooltip-content'>3.28k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1077' href='#L_DEMANDED_1077'><pre>1077</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewUndefElts = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1078' href='#L_DEMANDED_1078'><pre>1078</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts.setBit(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1079' href='#L_DEMANDED_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1080' href='#L_DEMANDED_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>2.22k</pre></td><td class='code'><pre> RHSIdx = RHSIdx == -1u ? <div class='tooltip'>i<span class='tooltip-content'>2.22k</span></div> : <div class='tooltip'>LHSVWidth<span class='tooltip-content'>1.05k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1081' href='#L_DEMANDED_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>2.22k</pre></td><td class='code'><pre> RHSValIdx = RHSValIdx == -1u ? <div class='tooltip'>MaskVal - LHSVWidth<span class='tooltip-content'>2.22k</span></div> : <div class='tooltip'>LHSVWidth<span class='tooltip-content'>1.05k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1082' href='#L_DEMANDED_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>3.16k</pre></td><td class='code'><pre> RHSUniform = RHSUniform && (MaskVal - LHSVWidth == i);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1083' href='#L_DEMANDED_1083'><pre>1083</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1084' href='#L_DEMANDED_1084'><pre>1084</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1085' href='#L_DEMANDED_1085'><pre>1085</pre></a></td><td class='covered-line'><pre>18.4k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1086' href='#L_DEMANDED_1086'><pre>1086</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1087' href='#L_DEMANDED_1087'><pre>1087</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> // Try to transform shuffle with constant vector and single element from</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1088' href='#L_DEMANDED_1088'><pre>1088</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> // this constant vector to single insertelement instruction.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1089' href='#L_DEMANDED_1089'><pre>1089</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> // shufflevector V, C, <v1, v2, .., ci, .., vm> -></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1090' href='#L_DEMANDED_1090'><pre>1090</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> // insertelement V, C[ci], ci-n</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1091' href='#L_DEMANDED_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSVWidth == Shuffle->getType()->getNumElements()<span class='tooltip-content'>8.46k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8.41k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1092' href='#L_DEMANDED_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> Value *Op = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1093' href='#L_DEMANDED_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> Constant *Value = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1094' href='#L_DEMANDED_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> unsigned Idx = -1u;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1095' href='#L_DEMANDED_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1096' href='#L_DEMANDED_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> // Find constant vector with the single element in shuffle (LHS or RHS).</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1097' href='#L_DEMANDED_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSIdx < LHSVWidth && <span class='tooltip-content'>8.41k</span></div><div class='tooltip'>RHSUniform<span class='tooltip-content'>1.42k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>606</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1098' href='#L_DEMANDED_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>606</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>CV<span class='tooltip-content'>606</span></div> = dyn_cast<ConstantVector>(Shuffle->getOperand(0))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1099' href='#L_DEMANDED_1099'><pre>1099</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op = Shuffle->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1100' href='#L_DEMANDED_1100'><pre>1100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value = CV->getOperand(LHSValIdx);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1101' href='#L_DEMANDED_1101'><pre>1101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Idx = LHSIdx;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1102' href='#L_DEMANDED_1102'><pre>1102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1103' href='#L_DEMANDED_1103'><pre>1103</pre></a></td><td class='covered-line'><pre>606</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1104' href='#L_DEMANDED_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSIdx < LHSVWidth && <span class='tooltip-content'>8.41k</span></div><div class='tooltip'>LHSUniform<span class='tooltip-content'>1.17k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.03k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1105' href='#L_DEMANDED_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> if (auto *<div class='tooltip'>CV<span class='tooltip-content'>1.03k</span></div> = dyn_cast<ConstantVector>(Shuffle->getOperand(1))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1106' href='#L_DEMANDED_1106'><pre>1106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op = Shuffle->getOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1107' href='#L_DEMANDED_1107'><pre>1107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value = CV->getOperand(RHSValIdx);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1108' href='#L_DEMANDED_1108'><pre>1108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Idx = RHSIdx;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1109' href='#L_DEMANDED_1109'><pre>1109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1110' href='#L_DEMANDED_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>1.03k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1111' href='#L_DEMANDED_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> // Found constant vector with single element - convert to insertelement.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1112' href='#L_DEMANDED_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> if (<div class='tooltip'>Op && <span class='tooltip-content'>8.41k</span></div><div class='tooltip'><span class='red'>Value</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1113' href='#L_DEMANDED_1113'><pre>1113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *New = InsertElementInst::Create(</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1114' href='#L_DEMANDED_1114'><pre>1114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Op, Value, ConstantInt::get(Type::getInt32Ty(I->getContext()), Idx),</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1115' href='#L_DEMANDED_1115'><pre>1115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Shuffle->getName());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1116' href='#L_DEMANDED_1116'><pre>1116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstWith(New, *Shuffle);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1117' href='#L_DEMANDED_1117'><pre>1117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return New;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1118' href='#L_DEMANDED_1118'><pre>1118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1119' href='#L_DEMANDED_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>8.41k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1120' href='#L_DEMANDED_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8.46k</span></div><div class='tooltip'>NewUndefElts<span class='tooltip-content'>8.46k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1121' href='#L_DEMANDED_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> // Add additional discovered undefs.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1122' href='#L_DEMANDED_1122'><pre>1122</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> SmallVector<Constant*, 16> Elts;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1123' href='#L_DEMANDED_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < VWidth<span class='tooltip-content'>6</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>4</span></div>) <div class='tooltip'>{<span class='tooltip-content'>4</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1124' href='#L_DEMANDED_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> if (UndefElts[i])</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1125' href='#L_DEMANDED_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Elts.push_back(UndefValue::get(Type::getInt32Ty(I->getContext())));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1126' href='#L_DEMANDED_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1127' href='#L_DEMANDED_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Elts.push_back(ConstantInt::get(Type::getInt32Ty(I->getContext()),</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1128' href='#L_DEMANDED_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> Shuffle->getMaskValue(i)));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1129' href='#L_DEMANDED_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>4</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1130' href='#L_DEMANDED_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> I->setOperand(2, ConstantVector::get(Elts));</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1131' href='#L_DEMANDED_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> MadeChange = true;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1132' href='#L_DEMANDED_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1133' href='#L_DEMANDED_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1134' href='#L_DEMANDED_1134'><pre>1134</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1135' href='#L_DEMANDED_1135'><pre>1135</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> case Instruction::Select: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1136' href='#L_DEMANDED_1136'><pre>1136</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> APInt LeftDemanded(DemandedElts), RightDemanded(DemandedElts);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1137' href='#L_DEMANDED_1137'><pre>1137</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> if (ConstantVector* <div class='tooltip'>CV<span class='tooltip-content'>491</span></div> = dyn_cast<ConstantVector>(I->getOperand(0))) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1138' href='#L_DEMANDED_1138'><pre>1138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>i++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1139' href='#L_DEMANDED_1139'><pre>1139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Constant *CElt = CV->getAggregateElement(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1140' href='#L_DEMANDED_1140'><pre>1140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Method isNullValue always returns false when called on a</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1141' href='#L_DEMANDED_1141'><pre>1141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // ConstantExpr. If CElt is a ConstantExpr then skip it in order to</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1142' href='#L_DEMANDED_1142'><pre>1142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // to avoid propagating incorrect information.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1143' href='#L_DEMANDED_1143'><pre>1143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>isa<ConstantExpr>(CElt)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1144' href='#L_DEMANDED_1144'><pre>1144</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1145' href='#L_DEMANDED_1145'><pre>1145</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CElt->isNullValue()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1146' href='#L_DEMANDED_1146'><pre>1146</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>LeftDemanded.clearBit(i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1147' href='#L_DEMANDED_1147'><pre>1147</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1148' href='#L_DEMANDED_1148'><pre>1148</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>RightDemanded.clearBit(i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1149' href='#L_DEMANDED_1149'><pre>1149</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1150' href='#L_DEMANDED_1150'><pre>1150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1151' href='#L_DEMANDED_1151'><pre>1151</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1152' href='#L_DEMANDED_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(1), LeftDemanded, UndefElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1153' href='#L_DEMANDED_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1154' href='#L_DEMANDED_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>491</span></div>) <div class='tooltip'>{ I->setOperand(1, TmpV); MadeChange = true; }<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1155' href='#L_DEMANDED_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1156' href='#L_DEMANDED_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(2), RightDemanded,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1157' href='#L_DEMANDED_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> UndefElts2, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1158' href='#L_DEMANDED_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>491</span></div>) <div class='tooltip'>{ I->setOperand(2, TmpV); MadeChange = true; }<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1159' href='#L_DEMANDED_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1160' href='#L_DEMANDED_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> // Output elements are undefined if both are undefined.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1161' href='#L_DEMANDED_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> UndefElts &= UndefElts2;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1162' href='#L_DEMANDED_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>491</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1163' href='#L_DEMANDED_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1164' href='#L_DEMANDED_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> case Instruction::BitCast: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1165' href='#L_DEMANDED_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> // Vector->vector casts only.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1166' href='#L_DEMANDED_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> VectorType *VTy = dyn_cast<VectorType>(I->getOperand(0)->getType());</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1167' href='#L_DEMANDED_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> if (<div class='tooltip'>!VTy<span class='tooltip-content'>736</span></div>) <div class='tooltip'><span class='red'>break</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1168' href='#L_DEMANDED_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> unsigned InVWidth = VTy->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1169' href='#L_DEMANDED_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> APInt InputDemandedElts(InVWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1170' href='#L_DEMANDED_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> UndefElts2 = APInt(InVWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1171' href='#L_DEMANDED_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> unsigned Ratio;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1172' href='#L_DEMANDED_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1173' href='#L_DEMANDED_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> if (<div class='tooltip'>VWidth == InVWidth<span class='tooltip-content'>736</span></div>) <div class='tooltip'>{<span class='tooltip-content'>736</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1174' href='#L_DEMANDED_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> // If we are converting from <4 x i32> -> <4 x f32>, we demand the same</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1175' href='#L_DEMANDED_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> // elements as are demanded of us.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1176' href='#L_DEMANDED_1176'><pre>1176</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> Ratio = 1;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1177' href='#L_DEMANDED_1177'><pre>1177</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> InputDemandedElts = DemandedElts;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1178' href='#L_DEMANDED_1178'><pre>1178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(VWidth % InVWidth) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1179' href='#L_DEMANDED_1179'><pre>1179</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the number of elements in the output is a multiple of the number of</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1180' href='#L_DEMANDED_1180'><pre>1180</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements in the input then an input element is live if any of the</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1181' href='#L_DEMANDED_1181'><pre>1181</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // corresponding output elements are live.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1182' href='#L_DEMANDED_1182'><pre>1182</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ratio = VWidth / InVWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1183' href='#L_DEMANDED_1183'><pre>1183</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned OutIdx = 0; </span><div class='tooltip'><span class='red'>OutIdx != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++OutIdx</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1184' href='#L_DEMANDED_1184'><pre>1184</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DemandedElts[OutIdx]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1185' href='#L_DEMANDED_1185'><pre>1185</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InputDemandedElts.setBit(OutIdx / Ratio)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1186' href='#L_DEMANDED_1186'><pre>1186</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(InVWidth % VWidth) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1187' href='#L_DEMANDED_1187'><pre>1187</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the number of elements in the input is a multiple of the number of</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1188' href='#L_DEMANDED_1188'><pre>1188</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements in the output then an input element is live if the</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1189' href='#L_DEMANDED_1189'><pre>1189</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // corresponding output element is live.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1190' href='#L_DEMANDED_1190'><pre>1190</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Ratio = InVWidth / VWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1191' href='#L_DEMANDED_1191'><pre>1191</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned InIdx = 0; </span><div class='tooltip'><span class='red'>InIdx != InVWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++InIdx</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1192' href='#L_DEMANDED_1192'><pre>1192</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DemandedElts[InIdx / Ratio]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1193' href='#L_DEMANDED_1193'><pre>1193</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InputDemandedElts.setBit(InIdx)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1194' href='#L_DEMANDED_1194'><pre>1194</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1195' href='#L_DEMANDED_1195'><pre>1195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Unsupported so far.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1196' href='#L_DEMANDED_1196'><pre>1196</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1197' href='#L_DEMANDED_1197'><pre>1197</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1198' href='#L_DEMANDED_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1199' href='#L_DEMANDED_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> // div/rem demand all inputs, because they don't want divide by zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1200' href='#L_DEMANDED_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), InputDemandedElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1201' href='#L_DEMANDED_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> UndefElts2, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1202' href='#L_DEMANDED_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>736</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1203' href='#L_DEMANDED_1203'><pre>1203</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> I->setOperand(0, TmpV);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1204' href='#L_DEMANDED_1204'><pre>1204</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1205' href='#L_DEMANDED_1205'><pre>1205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1206' href='#L_DEMANDED_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1207' href='#L_DEMANDED_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> if (<div class='tooltip'>VWidth == InVWidth<span class='tooltip-content'>736</span></div>) <div class='tooltip'>{<span class='tooltip-content'>736</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1208' href='#L_DEMANDED_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> UndefElts = UndefElts2;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1209' href='#L_DEMANDED_1209'><pre>1209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> } else <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(VWidth % InVWidth) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1210' href='#L_DEMANDED_1210'><pre>1210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the number of elements in the output is a multiple of the number of</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1211' href='#L_DEMANDED_1211'><pre>1211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements in the input then an output element is undef if the</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1212' href='#L_DEMANDED_1212'><pre>1212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // corresponding input element is undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1213' href='#L_DEMANDED_1213'><pre>1213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned OutIdx = 0; </span><div class='tooltip'><span class='red'>OutIdx != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++OutIdx</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1214' href='#L_DEMANDED_1214'><pre>1214</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>UndefElts2[OutIdx / Ratio]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1215' href='#L_DEMANDED_1215'><pre>1215</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>UndefElts.setBit(OutIdx)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1216' href='#L_DEMANDED_1216'><pre>1216</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>(InVWidth % VWidth) == 0</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1217' href='#L_DEMANDED_1217'><pre>1217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the number of elements in the input is a multiple of the number of</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1218' href='#L_DEMANDED_1218'><pre>1218</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements in the output then an output element is undef if all of the</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1219' href='#L_DEMANDED_1219'><pre>1219</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // corresponding input elements are undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1220' href='#L_DEMANDED_1220'><pre>1220</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned OutIdx = 0; </span><div class='tooltip'><span class='red'>OutIdx != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++OutIdx</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1221' href='#L_DEMANDED_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt SubUndef = UndefElts2.lshr(OutIdx * Ratio).zextOrTrunc(Ratio);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1222' href='#L_DEMANDED_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>SubUndef.countPopulation() == Ratio</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1223' href='#L_DEMANDED_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>UndefElts.setBit(OutIdx)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1224' href='#L_DEMANDED_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1225' href='#L_DEMANDED_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1226' href='#L_DEMANDED_1226'><pre>1226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>llvm_unreachable</span><span class='red'>("Unimp");</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1227' href='#L_DEMANDED_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1228' href='#L_DEMANDED_1228'><pre>1228</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1229' href='#L_DEMANDED_1229'><pre>1229</pre></a></td><td class='covered-line'><pre>736</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1230' href='#L_DEMANDED_1230'><pre>1230</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1231' href='#L_DEMANDED_1231'><pre>1231</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1232' href='#L_DEMANDED_1232'><pre>1232</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1233' href='#L_DEMANDED_1233'><pre>1233</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1234' href='#L_DEMANDED_1234'><pre>1234</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1235' href='#L_DEMANDED_1235'><pre>1235</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1236' href='#L_DEMANDED_1236'><pre>1236</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // div/rem demand all inputs, because they don't want divide by zero.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1237' href='#L_DEMANDED_1237'><pre>1237</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), DemandedElts, UndefElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1238' href='#L_DEMANDED_1238'><pre>1238</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1239' href='#L_DEMANDED_1239'><pre>1239</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>70</span></div>) <div class='tooltip'><span class='red'>{ I->setOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1240' href='#L_DEMANDED_1240'><pre>1240</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(1), DemandedElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1241' href='#L_DEMANDED_1241'><pre>1241</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> UndefElts2, Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1242' href='#L_DEMANDED_1242'><pre>1242</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>70</span></div>) <div class='tooltip'><span class='red'>{ I->setOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1243' href='#L_DEMANDED_1243'><pre>1243</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1244' href='#L_DEMANDED_1244'><pre>1244</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // Output elements are undefined if both are undefined. Consider things</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1245' href='#L_DEMANDED_1245'><pre>1245</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> // like undef&0. The result is known zero, not undef.</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1246' href='#L_DEMANDED_1246'><pre>1246</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> UndefElts &= UndefElts2;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1247' href='#L_DEMANDED_1247'><pre>1247</pre></a></td><td class='covered-line'><pre>70</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1248' href='#L_DEMANDED_1248'><pre>1248</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case Instruction::FPTrunc:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1249' href='#L_DEMANDED_1249'><pre>1249</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> case Instruction::FPExt:</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1250' href='#L_DEMANDED_1250'><pre>1250</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> TmpV = SimplifyDemandedVectorElts(I->getOperand(0), DemandedElts, UndefElts,</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1251' href='#L_DEMANDED_1251'><pre>1251</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Depth + 1);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1252' href='#L_DEMANDED_1252'><pre>1252</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (<div class='tooltip'>TmpV<span class='tooltip-content'>1</span></div>) <div class='tooltip'><span class='red'>{ I->setOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1253' href='#L_DEMANDED_1253'><pre>1253</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1254' href='#L_DEMANDED_1254'><pre>1254</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1255' href='#L_DEMANDED_1255'><pre>1255</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> case Instruction::Call: {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1256' href='#L_DEMANDED_1256'><pre>1256</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> IntrinsicInst *II = dyn_cast<IntrinsicInst>(I);</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1257' href='#L_DEMANDED_1257'><pre>1257</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> if (<div class='tooltip'>!II<span class='tooltip-content'>2</span></div>) <div class='tooltip'><span class='red'>break</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1258' href='#L_DEMANDED_1258'><pre>1258</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> switch (II->getIntrinsicID()) {</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1259' href='#L_DEMANDED_1259'><pre>1259</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> default: break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1260' href='#L_DEMANDED_1260'><pre>1260</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1261' href='#L_DEMANDED_1261'><pre>1261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>case Intrinsic::x86_xop_vfrcz_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1262' href='#L_DEMANDED_1262'><pre>1262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_xop_vfrcz_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1263' href='#L_DEMANDED_1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The instructions for these intrinsics are speced to zero upper bits not</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1264' href='#L_DEMANDED_1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // pass them through like other scalar intrinsics. So we shouldn't just</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1265' href='#L_DEMANDED_1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // use Arg0 if DemandedElts[0] is clear like we do for other intrinsics.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1266' href='#L_DEMANDED_1266'><pre>1266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Instead we should return a zero vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1267' href='#L_DEMANDED_1267'><pre>1267</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1268' href='#L_DEMANDED_1268'><pre>1268</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1269' href='#L_DEMANDED_1269'><pre>1269</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantAggregateZero::get(II->getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1270' href='#L_DEMANDED_1270'><pre>1270</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1271' href='#L_DEMANDED_1271'><pre>1271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1272' href='#L_DEMANDED_1272'><pre>1272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only the lower element is used.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1273' href='#L_DEMANDED_1273'><pre>1273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DemandedElts = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1274' href='#L_DEMANDED_1274'><pre>1274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1275' href='#L_DEMANDED_1275'><pre>1275</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1276' href='#L_DEMANDED_1276'><pre>1276</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1277' href='#L_DEMANDED_1277'><pre>1277</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1278' href='#L_DEMANDED_1278'><pre>1278</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only the lower element is undefined. The high elements are zero.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1279' href='#L_DEMANDED_1279'><pre>1279</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts = UndefElts[0];</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1280' href='#L_DEMANDED_1280'><pre>1280</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1281' href='#L_DEMANDED_1281'><pre>1281</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1282' href='#L_DEMANDED_1282'><pre>1282</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Unary scalar-as-vector operations that work column-wise.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1283' href='#L_DEMANDED_1283'><pre>1283</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_rcp_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1284' href='#L_DEMANDED_1284'><pre>1284</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_rsqrt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1285' href='#L_DEMANDED_1285'><pre>1285</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_sqrt_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1286' href='#L_DEMANDED_1286'><pre>1286</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_sqrt_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1287' href='#L_DEMANDED_1287'><pre>1287</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1288' href='#L_DEMANDED_1288'><pre>1288</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1289' href='#L_DEMANDED_1289'><pre>1289</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1290' href='#L_DEMANDED_1290'><pre>1290</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1291' href='#L_DEMANDED_1291'><pre>1291</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If lowest element of a scalar op isn't used then use Arg0.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1292' href='#L_DEMANDED_1292'><pre>1292</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1293' href='#L_DEMANDED_1293'><pre>1293</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1294' href='#L_DEMANDED_1294'><pre>1294</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1295' href='#L_DEMANDED_1295'><pre>1295</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1296' href='#L_DEMANDED_1296'><pre>1296</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: If only low elt lower SQRT to FSQRT (with rounding/exceptions</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1297' href='#L_DEMANDED_1297'><pre>1297</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // checks).</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1298' href='#L_DEMANDED_1298'><pre>1298</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1299' href='#L_DEMANDED_1299'><pre>1299</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1300' href='#L_DEMANDED_1300'><pre>1300</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Binary scalar-as-vector operations that work column-wise. The high</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1301' href='#L_DEMANDED_1301'><pre>1301</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements come from operand 0. The low element is a function of both</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1302' href='#L_DEMANDED_1302'><pre>1302</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operands.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1303' href='#L_DEMANDED_1303'><pre>1303</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_min_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1304' href='#L_DEMANDED_1304'><pre>1304</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_max_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1305' href='#L_DEMANDED_1305'><pre>1305</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse_cmp_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1306' href='#L_DEMANDED_1306'><pre>1306</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_min_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1307' href='#L_DEMANDED_1307'><pre>1307</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_max_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1308' href='#L_DEMANDED_1308'><pre>1308</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_cmp_sd: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1309' href='#L_DEMANDED_1309'><pre>1309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1310' href='#L_DEMANDED_1310'><pre>1310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1311' href='#L_DEMANDED_1311'><pre>1311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1312' href='#L_DEMANDED_1312'><pre>1312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1313' href='#L_DEMANDED_1313'><pre>1313</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If lowest element of a scalar op isn't used then use Arg0.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1314' href='#L_DEMANDED_1314'><pre>1314</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1315' href='#L_DEMANDED_1315'><pre>1315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1316' href='#L_DEMANDED_1316'><pre>1316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1317' href='#L_DEMANDED_1317'><pre>1317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1318' href='#L_DEMANDED_1318'><pre>1318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1319' href='#L_DEMANDED_1319'><pre>1319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only lower element is used for operand 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1320' href='#L_DEMANDED_1320'><pre>1320</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DemandedElts = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1321' href='#L_DEMANDED_1321'><pre>1321</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(1), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1322' href='#L_DEMANDED_1322'><pre>1322</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1323' href='#L_DEMANDED_1323'><pre>1323</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1324' href='#L_DEMANDED_1324'><pre>1324</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1325' href='#L_DEMANDED_1325'><pre>1325</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Lower element is undefined if both lower elements are undefined.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1326' href='#L_DEMANDED_1326'><pre>1326</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Consider things like undef&0. The result is known zero, not undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1327' href='#L_DEMANDED_1327'><pre>1327</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!UndefElts2[0]</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1328' href='#L_DEMANDED_1328'><pre>1328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>UndefElts.clearBit(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1329' href='#L_DEMANDED_1329'><pre>1329</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1330' href='#L_DEMANDED_1330'><pre>1330</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1331' href='#L_DEMANDED_1331'><pre>1331</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1332' href='#L_DEMANDED_1332'><pre>1332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1333' href='#L_DEMANDED_1333'><pre>1333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Binary scalar-as-vector operations that work column-wise. The high</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1334' href='#L_DEMANDED_1334'><pre>1334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements come from operand 0 and the low element comes from operand 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1335' href='#L_DEMANDED_1335'><pre>1335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_round_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1336' href='#L_DEMANDED_1336'><pre>1336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_round_sd: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1337' href='#L_DEMANDED_1337'><pre>1337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Don't use the low element of operand 0.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1338' href='#L_DEMANDED_1338'><pre>1338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt DemandedElts2 = DemandedElts;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1339' href='#L_DEMANDED_1339'><pre>1339</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> DemandedElts2.clearBit(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1340' href='#L_DEMANDED_1340'><pre>1340</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts2,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1341' href='#L_DEMANDED_1341'><pre>1341</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1342' href='#L_DEMANDED_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1343' href='#L_DEMANDED_1343'><pre>1343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1344' href='#L_DEMANDED_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If lowest element of a scalar op isn't used then use Arg0.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1345' href='#L_DEMANDED_1345'><pre>1345</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1346' href='#L_DEMANDED_1346'><pre>1346</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1347' href='#L_DEMANDED_1347'><pre>1347</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1348' href='#L_DEMANDED_1348'><pre>1348</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1349' href='#L_DEMANDED_1349'><pre>1349</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1350' href='#L_DEMANDED_1350'><pre>1350</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only lower element is used for operand 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1351' href='#L_DEMANDED_1351'><pre>1351</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DemandedElts = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1352' href='#L_DEMANDED_1352'><pre>1352</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(1), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1353' href='#L_DEMANDED_1353'><pre>1353</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1354' href='#L_DEMANDED_1354'><pre>1354</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1355' href='#L_DEMANDED_1355'><pre>1355</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1356' href='#L_DEMANDED_1356'><pre>1356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Take the high undef elements from operand 0 and take the lower element</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1357' href='#L_DEMANDED_1357'><pre>1357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // from operand 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1358' href='#L_DEMANDED_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts.clearBit(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1359' href='#L_DEMANDED_1359'><pre>1359</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts |= UndefElts2[0];</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1360' href='#L_DEMANDED_1360'><pre>1360</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1361' href='#L_DEMANDED_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1362' href='#L_DEMANDED_1362'><pre>1362</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1363' href='#L_DEMANDED_1363'><pre>1363</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Three input scalar-as-vector operations that work column-wise. The high</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1364' href='#L_DEMANDED_1364'><pre>1364</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // elements come from operand 0 and the low element is a function of all</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1365' href='#L_DEMANDED_1365'><pre>1365</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // three inputs.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1366' href='#L_DEMANDED_1366'><pre>1366</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1367' href='#L_DEMANDED_1367'><pre>1367</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1368' href='#L_DEMANDED_1368'><pre>1368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1369' href='#L_DEMANDED_1369'><pre>1369</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1370' href='#L_DEMANDED_1370'><pre>1370</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_max_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1371' href='#L_DEMANDED_1371'><pre>1371</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_min_ss_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1372' href='#L_DEMANDED_1372'><pre>1372</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_add_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1373' href='#L_DEMANDED_1373'><pre>1373</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_div_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1374' href='#L_DEMANDED_1374'><pre>1374</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_mul_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1375' href='#L_DEMANDED_1375'><pre>1375</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_sub_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1376' href='#L_DEMANDED_1376'><pre>1376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_max_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1377' href='#L_DEMANDED_1377'><pre>1377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_min_sd_round:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1378' href='#L_DEMANDED_1378'><pre>1378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1379' href='#L_DEMANDED_1379'><pre>1379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1380' href='#L_DEMANDED_1380'><pre>1380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1381' href='#L_DEMANDED_1381'><pre>1381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1382' href='#L_DEMANDED_1382'><pre>1382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1383' href='#L_DEMANDED_1383'><pre>1383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1384' href='#L_DEMANDED_1384'><pre>1384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1385' href='#L_DEMANDED_1385'><pre>1385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_fma_vfnmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1386' href='#L_DEMANDED_1386'><pre>1386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1387' href='#L_DEMANDED_1387'><pre>1387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1388' href='#L_DEMANDED_1388'><pre>1388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_maskz_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1389' href='#L_DEMANDED_1389'><pre>1389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_maskz_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1390' href='#L_DEMANDED_1390'><pre>1390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1391' href='#L_DEMANDED_1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1392' href='#L_DEMANDED_1392'><pre>1392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1393' href='#L_DEMANDED_1393'><pre>1393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1394' href='#L_DEMANDED_1394'><pre>1394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If lowest element of a scalar op isn't used then use Arg0.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1395' href='#L_DEMANDED_1395'><pre>1395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1396' href='#L_DEMANDED_1396'><pre>1396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1397' href='#L_DEMANDED_1397'><pre>1397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1398' href='#L_DEMANDED_1398'><pre>1398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1399' href='#L_DEMANDED_1399'><pre>1399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1400' href='#L_DEMANDED_1400'><pre>1400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only lower element is used for operand 1 and 2.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1401' href='#L_DEMANDED_1401'><pre>1401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DemandedElts = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1402' href='#L_DEMANDED_1402'><pre>1402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(1), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1403' href='#L_DEMANDED_1403'><pre>1403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1404' href='#L_DEMANDED_1404'><pre>1404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1405' href='#L_DEMANDED_1405'><pre>1405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(2), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1406' href='#L_DEMANDED_1406'><pre>1406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts3, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1407' href='#L_DEMANDED_1407'><pre>1407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(2, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1408' href='#L_DEMANDED_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1409' href='#L_DEMANDED_1409'><pre>1409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Lower element is undefined if all three lower elements are undefined.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1410' href='#L_DEMANDED_1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Consider things like undef&0. The result is known zero, not undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1411' href='#L_DEMANDED_1411'><pre>1411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!UndefElts2[0] || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!UndefElts3[0]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1412' href='#L_DEMANDED_1412'><pre>1412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>UndefElts.clearBit(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1413' href='#L_DEMANDED_1413'><pre>1413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1414' href='#L_DEMANDED_1414'><pre>1414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1415' href='#L_DEMANDED_1415'><pre>1415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1416' href='#L_DEMANDED_1416'><pre>1416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmadd_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1417' href='#L_DEMANDED_1417'><pre>1417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmadd_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1418' href='#L_DEMANDED_1418'><pre>1418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1419' href='#L_DEMANDED_1419'><pre>1419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1420' href='#L_DEMANDED_1420'><pre>1420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfnmsub_ss:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1421' href='#L_DEMANDED_1421'><pre>1421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_mask3_vfnmsub_sd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1422' href='#L_DEMANDED_1422'><pre>1422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // These intrinsics get the passthru bits from operand 2.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1423' href='#L_DEMANDED_1423'><pre>1423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(2), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1424' href='#L_DEMANDED_1424'><pre>1424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1425' href='#L_DEMANDED_1425'><pre>1425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(2, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1426' href='#L_DEMANDED_1426'><pre>1426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1427' href='#L_DEMANDED_1427'><pre>1427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If lowest element of a scalar op isn't used then use Arg2.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1428' href='#L_DEMANDED_1428'><pre>1428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!DemandedElts[0]</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1429' href='#L_DEMANDED_1429'><pre>1429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.Add(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1430' href='#L_DEMANDED_1430'><pre>1430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return II->getArgOperand(2);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1431' href='#L_DEMANDED_1431'><pre>1431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1432' href='#L_DEMANDED_1432'><pre>1432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1433' href='#L_DEMANDED_1433'><pre>1433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only lower element is used for operand 0 and 1.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1434' href='#L_DEMANDED_1434'><pre>1434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>DemandedElts = 1;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1435' href='#L_DEMANDED_1435'><pre>1435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1436' href='#L_DEMANDED_1436'><pre>1436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1437' href='#L_DEMANDED_1437'><pre>1437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1438' href='#L_DEMANDED_1438'><pre>1438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(II->getArgOperand(1), DemandedElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1439' href='#L_DEMANDED_1439'><pre>1439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts3, Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1440' href='#L_DEMANDED_1440'><pre>1440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1441' href='#L_DEMANDED_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1442' href='#L_DEMANDED_1442'><pre>1442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Lower element is undefined if all three lower elements are undefined.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1443' href='#L_DEMANDED_1443'><pre>1443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Consider things like undef&0. The result is known zero, not undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1444' href='#L_DEMANDED_1444'><pre>1444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!UndefElts2[0] || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!UndefElts3[0]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1445' href='#L_DEMANDED_1445'><pre>1445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>UndefElts.clearBit(0)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1446' href='#L_DEMANDED_1446'><pre>1446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1447' href='#L_DEMANDED_1447'><pre>1447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1448' href='#L_DEMANDED_1448'><pre>1448</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1449' href='#L_DEMANDED_1449'><pre>1449</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_pmulu_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1450' href='#L_DEMANDED_1450'><pre>1450</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_pmuldq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1451' href='#L_DEMANDED_1451'><pre>1451</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmul_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1452' href='#L_DEMANDED_1452'><pre>1452</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pmulu_dq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1453' href='#L_DEMANDED_1453'><pre>1453</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pmul_dq_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1454' href='#L_DEMANDED_1454'><pre>1454</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pmulu_dq_512: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1455' href='#L_DEMANDED_1455'><pre>1455</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op0 = II->getArgOperand(0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1456' href='#L_DEMANDED_1456'><pre>1456</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1457' href='#L_DEMANDED_1457'><pre>1457</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InnerVWidth = Op0->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1458' href='#L_DEMANDED_1458'><pre>1458</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert((VWidth * 2) == InnerVWidth && "Unexpected input size");</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1459' href='#L_DEMANDED_1459'><pre>1459</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1460' href='#L_DEMANDED_1460'><pre>1460</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt InnerDemandedElts(InnerVWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1461' href='#L_DEMANDED_1461'><pre>1461</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1462' href='#L_DEMANDED_1462'><pre>1462</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>DemandedElts[i]</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1463' href='#L_DEMANDED_1463'><pre>1463</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>InnerDemandedElts.setBit(i * 2)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1464' href='#L_DEMANDED_1464'><pre>1464</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1465' href='#L_DEMANDED_1465'><pre>1465</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts2 = APInt(InnerVWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1466' href='#L_DEMANDED_1466'><pre>1466</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(Op0, InnerDemandedElts, UndefElts2,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1467' href='#L_DEMANDED_1467'><pre>1467</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1468' href='#L_DEMANDED_1468'><pre>1468</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(0, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1469' href='#L_DEMANDED_1469'><pre>1469</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1470' href='#L_DEMANDED_1470'><pre>1470</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts3 = APInt(InnerVWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1471' href='#L_DEMANDED_1471'><pre>1471</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(Op1, InnerDemandedElts, UndefElts3,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1472' href='#L_DEMANDED_1472'><pre>1472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1473' href='#L_DEMANDED_1473'><pre>1473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1474' href='#L_DEMANDED_1474'><pre>1474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1475' href='#L_DEMANDED_1475'><pre>1475</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1476' href='#L_DEMANDED_1476'><pre>1476</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1477' href='#L_DEMANDED_1477'><pre>1477</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1478' href='#L_DEMANDED_1478'><pre>1478</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packssdw_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1479' href='#L_DEMANDED_1479'><pre>1479</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packsswb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1480' href='#L_DEMANDED_1480'><pre>1480</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse2_packuswb_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1481' href='#L_DEMANDED_1481'><pre>1481</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse41_packusdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1482' href='#L_DEMANDED_1482'><pre>1482</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packssdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1483' href='#L_DEMANDED_1483'><pre>1483</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packsswb:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1484' href='#L_DEMANDED_1484'><pre>1484</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packusdw:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1485' href='#L_DEMANDED_1485'><pre>1485</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_packuswb:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1486' href='#L_DEMANDED_1486'><pre>1486</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packssdw_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1487' href='#L_DEMANDED_1487'><pre>1487</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packsswb_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1488' href='#L_DEMANDED_1488'><pre>1488</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packusdw_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1489' href='#L_DEMANDED_1489'><pre>1489</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_packuswb_512: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1490' href='#L_DEMANDED_1490'><pre>1490</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Ty0 = II->getArgOperand(0)->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1491' href='#L_DEMANDED_1491'><pre>1491</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InnerVWidth = Ty0->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1492' href='#L_DEMANDED_1492'><pre>1492</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(VWidth == (InnerVWidth * 2) && "Unexpected input size");</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1493' href='#L_DEMANDED_1493'><pre>1493</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1494' href='#L_DEMANDED_1494'><pre>1494</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumLanes = Ty0->getPrimitiveSizeInBits() / 128;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1495' href='#L_DEMANDED_1495'><pre>1495</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned VWidthPerLane = VWidth / NumLanes;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1496' href='#L_DEMANDED_1496'><pre>1496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned InnerVWidthPerLane = InnerVWidth / NumLanes;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1497' href='#L_DEMANDED_1497'><pre>1497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1498' href='#L_DEMANDED_1498'><pre>1498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Per lane, pack the elements of the first input and then the second.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1499' href='#L_DEMANDED_1499'><pre>1499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // e.g.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1500' href='#L_DEMANDED_1500'><pre>1500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // v8i16 PACK(v4i32 X, v4i32 Y) - (X[0..3],Y[0..3])</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1501' href='#L_DEMANDED_1501'><pre>1501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // v32i8 PACK(v16i16 X, v16i16 Y) - (X[0..7],Y[0..7]),(X[8..15],Y[8..15])</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1502' href='#L_DEMANDED_1502'><pre>1502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int OpNum = 0; </span><div class='tooltip'><span class='red'>OpNum != 2</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++OpNum</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1503' href='#L_DEMANDED_1503'><pre>1503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt OpDemandedElts(InnerVWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1504' href='#L_DEMANDED_1504'><pre>1504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Lane = 0; </span><div class='tooltip'><span class='red'>Lane != NumLanes</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Lane</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1505' href='#L_DEMANDED_1505'><pre>1505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned LaneIdx = Lane * VWidthPerLane;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1506' href='#L_DEMANDED_1506'><pre>1506</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Elt = 0; </span><div class='tooltip'><span class='red'>Elt != InnerVWidthPerLane</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Elt</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1507' href='#L_DEMANDED_1507'><pre>1507</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned Idx = LaneIdx + Elt + InnerVWidthPerLane * OpNum;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1508' href='#L_DEMANDED_1508'><pre>1508</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>DemandedElts[Idx]</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1509' href='#L_DEMANDED_1509'><pre>1509</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>OpDemandedElts.setBit((Lane * InnerVWidthPerLane) + Elt)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1510' href='#L_DEMANDED_1510'><pre>1510</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1511' href='#L_DEMANDED_1511'><pre>1511</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1512' href='#L_DEMANDED_1512'><pre>1512</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1513' href='#L_DEMANDED_1513'><pre>1513</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Demand elements from the operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1514' href='#L_DEMANDED_1514'><pre>1514</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Op = II->getArgOperand(OpNum);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1515' href='#L_DEMANDED_1515'><pre>1515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt OpUndefElts(InnerVWidth, 0);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1516' href='#L_DEMANDED_1516'><pre>1516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(Op, OpDemandedElts, OpUndefElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1517' href='#L_DEMANDED_1517'><pre>1517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1518' href='#L_DEMANDED_1518'><pre>1518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1519' href='#L_DEMANDED_1519'><pre>1519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> II->setArgOperand(OpNum, TmpV);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1520' href='#L_DEMANDED_1520'><pre>1520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1521' href='#L_DEMANDED_1521'><pre>1521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1522' href='#L_DEMANDED_1522'><pre>1522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1523' href='#L_DEMANDED_1523'><pre>1523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Pack the operand's UNDEF elements, one lane at a time.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1524' href='#L_DEMANDED_1524'><pre>1524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> OpUndefElts = OpUndefElts.zext(VWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1525' href='#L_DEMANDED_1525'><pre>1525</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned Lane = 0; </span><div class='tooltip'><span class='red'>Lane != NumLanes</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Lane</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1526' href='#L_DEMANDED_1526'><pre>1526</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> APInt LaneElts = OpUndefElts.lshr(InnerVWidthPerLane * Lane);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1527' href='#L_DEMANDED_1527'><pre>1527</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LaneElts = LaneElts.getLoBits(InnerVWidthPerLane);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1528' href='#L_DEMANDED_1528'><pre>1528</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> LaneElts = LaneElts.shl(InnerVWidthPerLane * (2 * Lane + OpNum));</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1529' href='#L_DEMANDED_1529'><pre>1529</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts |= LaneElts;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1530' href='#L_DEMANDED_1530'><pre>1530</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1531' href='#L_DEMANDED_1531'><pre>1531</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1532' href='#L_DEMANDED_1532'><pre>1532</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1533' href='#L_DEMANDED_1533'><pre>1533</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1534' href='#L_DEMANDED_1534'><pre>1534</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1535' href='#L_DEMANDED_1535'><pre>1535</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PSHUFB</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1536' href='#L_DEMANDED_1536'><pre>1536</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_ssse3_pshuf_b_128:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1537' href='#L_DEMANDED_1537'><pre>1537</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_pshuf_b:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1538' href='#L_DEMANDED_1538'><pre>1538</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_pshuf_b_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1539' href='#L_DEMANDED_1539'><pre>1539</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PERMILVAR</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1540' href='#L_DEMANDED_1540'><pre>1540</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_ps:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1541' href='#L_DEMANDED_1541'><pre>1541</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_ps_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1542' href='#L_DEMANDED_1542'><pre>1542</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vpermilvar_ps_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1543' href='#L_DEMANDED_1543'><pre>1543</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_pd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1544' href='#L_DEMANDED_1544'><pre>1544</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx_vpermilvar_pd_256:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1545' href='#L_DEMANDED_1545'><pre>1545</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx512_vpermilvar_pd_512:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1546' href='#L_DEMANDED_1546'><pre>1546</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // PERMV</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1547' href='#L_DEMANDED_1547'><pre>1547</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_permd:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1548' href='#L_DEMANDED_1548'><pre>1548</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_avx2_permps: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1549' href='#L_DEMANDED_1549'><pre>1549</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op1 = II->getArgOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1550' href='#L_DEMANDED_1550'><pre>1550</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> TmpV = SimplifyDemandedVectorElts(Op1, DemandedElts, UndefElts,</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1551' href='#L_DEMANDED_1551'><pre>1551</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Depth + 1);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1552' href='#L_DEMANDED_1552'><pre>1552</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>TmpV</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{ II->setArgOperand(1, TmpV); MadeChange = true; }</span><span class='tooltip-content'>0</span></div><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1553' href='#L_DEMANDED_1553'><pre>1553</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1554' href='#L_DEMANDED_1554'><pre>1554</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1555' href='#L_DEMANDED_1555'><pre>1555</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1556' href='#L_DEMANDED_1556'><pre>1556</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // SSE4A instructions leave the upper 64-bits of the 128-bit result</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1557' href='#L_DEMANDED_1557'><pre>1557</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // in an undefined state.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1558' href='#L_DEMANDED_1558'><pre>1558</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_extrq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1559' href='#L_DEMANDED_1559'><pre>1559</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_extrqi:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1560' href='#L_DEMANDED_1560'><pre>1560</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_insertq:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1561' href='#L_DEMANDED_1561'><pre>1561</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::x86_sse4a_insertqi:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1562' href='#L_DEMANDED_1562'><pre>1562</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefElts |= APInt::getHighBitsSet(VWidth, VWidth / 2);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1563' href='#L_DEMANDED_1563'><pre>1563</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1564' href='#L_DEMANDED_1564'><pre>1564</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_buffer_load:</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1565' href='#L_DEMANDED_1565'><pre>1565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Intrinsic::amdgcn_buffer_load_format: {</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1566' href='#L_DEMANDED_1566'><pre>1566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>VWidth == 1 || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!APIntOps::isMask(DemandedElts)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1567' href='#L_DEMANDED_1567'><pre>1567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1568' href='#L_DEMANDED_1568'><pre>1568</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1569' href='#L_DEMANDED_1569'><pre>1569</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Handle 3 vectors when supported in code gen.</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1570' href='#L_DEMANDED_1570'><pre>1570</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned NewNumElts = PowerOf2Ceil(DemandedElts.countTrailingOnes());</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1571' href='#L_DEMANDED_1571'><pre>1571</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>NewNumElts == VWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1572' href='#L_DEMANDED_1572'><pre>1572</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1573' href='#L_DEMANDED_1573'><pre>1573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1574' href='#L_DEMANDED_1574'><pre>1574</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Module *M = II->getParent()->getParent()->getParent();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1575' href='#L_DEMANDED_1575'><pre>1575</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *EltTy = V->getType()->getVectorElementType();</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1576' href='#L_DEMANDED_1576'><pre>1576</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1577' href='#L_DEMANDED_1577'><pre>1577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *NewTy = (NewNumElts == 1) ? </span><span class='red'>EltTy</span><span class='red'> :</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1578' href='#L_DEMANDED_1578'><pre>1578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>VectorType::get(EltTy, NewNumElts)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1579' href='#L_DEMANDED_1579'><pre>1579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1580' href='#L_DEMANDED_1580'><pre>1580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Function *NewIntrin = Intrinsic::getDeclaration(M, II->getIntrinsicID(),</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1581' href='#L_DEMANDED_1581'><pre>1581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1582' href='#L_DEMANDED_1582'><pre>1582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1583' href='#L_DEMANDED_1583'><pre>1583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Value *, 5> Args;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1584' href='#L_DEMANDED_1584'><pre>1584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = II->getNumArgOperands(); </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1585' href='#L_DEMANDED_1585'><pre>1585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Args.push_back(II->getArgOperand(I))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1586' href='#L_DEMANDED_1586'><pre>1586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1587' href='#L_DEMANDED_1587'><pre>1587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IRBuilderBase::InsertPointGuard Guard(*Builder);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1588' href='#L_DEMANDED_1588'><pre>1588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->SetInsertPoint(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1589' href='#L_DEMANDED_1589'><pre>1589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1590' href='#L_DEMANDED_1590'><pre>1590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> CallInst *NewCall = Builder->CreateCall(NewIntrin, Args);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1591' href='#L_DEMANDED_1591'><pre>1591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->takeName(II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1592' href='#L_DEMANDED_1592'><pre>1592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall->copyMetadata(*II);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1593' href='#L_DEMANDED_1593'><pre>1593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NewNumElts == 1</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1594' href='#L_DEMANDED_1594'><pre>1594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Builder->CreateInsertElement(UndefValue::get(V->getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1595' href='#L_DEMANDED_1595'><pre>1595</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall, static_cast<uint64_t>(0));</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1596' href='#L_DEMANDED_1596'><pre>1596</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1597' href='#L_DEMANDED_1597'><pre>1597</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1598' href='#L_DEMANDED_1598'><pre>1598</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SmallVector<uint32_t, 8> EltMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1599' href='#L_DEMANDED_1599'><pre>1599</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0; </span><div class='tooltip'><span class='red'>I < VWidth</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1600' href='#L_DEMANDED_1600'><pre>1600</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>EltMask.push_back(I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1601' href='#L_DEMANDED_1601'><pre>1601</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1602' href='#L_DEMANDED_1602'><pre>1602</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Shuffle = Builder->CreateShuffleVector(</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1603' href='#L_DEMANDED_1603'><pre>1603</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewCall, UndefValue::get(NewTy), EltMask);</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1604' href='#L_DEMANDED_1604'><pre>1604</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1605' href='#L_DEMANDED_1605'><pre>1605</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1606' href='#L_DEMANDED_1606'><pre>1606</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return Shuffle</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1607' href='#L_DEMANDED_1607'><pre>1607</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1608' href='#L_DEMANDED_1608'><pre>1608</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1609' href='#L_DEMANDED_1609'><pre>1609</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1610' href='#L_DEMANDED_1610'><pre>1610</pre></a></td><td class='covered-line'><pre>2</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1611' href='#L_DEMANDED_1611'><pre>1611</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1612' href='#L_DEMANDED_1612'><pre>1612</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre> <div class='tooltip'>return MadeChange ? <span class='tooltip-content'>136k</span></div><div class='tooltip'>I<span class='tooltip-content'>165</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>136k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_DEMANDED_1613' href='#L_DEMANDED_1613'><pre>1613</pre></a></td><td class='covered-line'><pre>136k</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
<div class='centered'><table><div class='source-name-title'><pre><a name='VECTOR' href='#VECTOR'>lib/Transforms/InstCombine/InstCombineVectorOps.cpp</a></pre></div><tr><td><pre>Line</pre></td><td><pre>Count</pre></td><td><pre>Source (<a href='#L_VECTOR_29'>jump to first uncovered line</a>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1' href='#L_VECTOR_1'><pre>1</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===- InstCombineVectorOps.cpp -------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_2' href='#L_VECTOR_2'><pre>2</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_3' href='#L_VECTOR_3'><pre>3</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// The LLVM Compiler Infrastructure</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_4' href='#L_VECTOR_4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_5' href='#L_VECTOR_5'><pre>5</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file is distributed under the University of Illinois Open Source</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_6' href='#L_VECTOR_6'><pre>6</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// License. See LICENSE.TXT for details.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_7' href='#L_VECTOR_7'><pre>7</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_8' href='#L_VECTOR_8'><pre>8</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_9' href='#L_VECTOR_9'><pre>9</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_10' href='#L_VECTOR_10'><pre>10</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// This file implements instcombine for ExtractElement, InsertElement and</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_11' href='#L_VECTOR_11'><pre>11</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// ShuffleVector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_12' href='#L_VECTOR_12'><pre>12</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_13' href='#L_VECTOR_13'><pre>13</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>//===----------------------------------------------------------------------===//</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_14' href='#L_VECTOR_14'><pre>14</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_15' href='#L_VECTOR_15'><pre>15</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "InstCombineInternal.h"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_16' href='#L_VECTOR_16'><pre>16</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/ADT/DenseMap.h"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_17' href='#L_VECTOR_17'><pre>17</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/InstructionSimplify.h"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_18' href='#L_VECTOR_18'><pre>18</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/Analysis/VectorUtils.h"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_19' href='#L_VECTOR_19'><pre>19</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#include "llvm/IR/PatternMatch.h"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_20' href='#L_VECTOR_20'><pre>20</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace llvm;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_21' href='#L_VECTOR_21'><pre>21</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>using namespace PatternMatch;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_22' href='#L_VECTOR_22'><pre>22</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_23' href='#L_VECTOR_23'><pre>23</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>#define DEBUG_TYPE "instcombine"</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_24' href='#L_VECTOR_24'><pre>24</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_25' href='#L_VECTOR_25'><pre>25</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if the value is cheaper to scalarize than it is to leave as a</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_26' href='#L_VECTOR_26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// vector operation. isConstant indicates whether we're extracting one known</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_27' href='#L_VECTOR_27'><pre>27</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// element. If false we're extracting a variable index.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_28' href='#L_VECTOR_28'><pre>28</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre>static bool cheapToScalarize(Value *V, bool isConstant) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_29' href='#L_VECTOR_29'><pre>29</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> if (Constant *<div class='tooltip'>C<span class='tooltip-content'>168</span></div> = dyn_cast<Constant>(V)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_30' href='#L_VECTOR_30'><pre>30</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isConstant</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>return true</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_31' href='#L_VECTOR_31'><pre>31</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_32' href='#L_VECTOR_32'><pre>32</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If all elts are the same, we can extract it and use any of the values.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_33' href='#L_VECTOR_33'><pre>33</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Constant *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Op0</span><span class='tooltip-content'>0</span></div><span class='red'> = C->getAggregateElement(0U)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_34' href='#L_VECTOR_34'><pre>34</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 1, e = V->getType()->getVectorNumElements(); </span><span class='red'>i != e</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_35' href='#L_VECTOR_35'><pre>35</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>++i</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_36' href='#L_VECTOR_36'><pre>36</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C->getAggregateElement(i) != Op0</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_37' href='#L_VECTOR_37'><pre>37</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_38' href='#L_VECTOR_38'><pre>38</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_39' href='#L_VECTOR_39'><pre>39</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_40' href='#L_VECTOR_40'><pre>40</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_41' href='#L_VECTOR_41'><pre>41</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_42' href='#L_VECTOR_42'><pre>42</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>168</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_43' href='#L_VECTOR_43'><pre>43</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_44' href='#L_VECTOR_44'><pre>44</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> // Insert element gets simplified to the inserted element or is deleted if</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_45' href='#L_VECTOR_45'><pre>45</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> // this is constant idx extract element and its a constant idx insertelt.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_46' href='#L_VECTOR_46'><pre>46</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>168</span></div><div class='tooltip'>I->getOpcode() == Instruction::InsertElement && <span class='tooltip-content'>168</span></div><div class='tooltip'><span class='red'>isConstant</span><span class='tooltip-content'>0</span></div> &&</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_47' href='#L_VECTOR_47'><pre>47</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>isa<ConstantInt>(I->getOperand(2))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_48' href='#L_VECTOR_48'><pre>48</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_49' href='#L_VECTOR_49'><pre>49</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>168</span></div><div class='tooltip'>I->getOpcode() == Instruction::Load && <span class='tooltip-content'>168</span></div><div class='tooltip'><span class='red'>I->hasOneUse()</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_50' href='#L_VECTOR_50'><pre>50</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_51' href='#L_VECTOR_51'><pre>51</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> <div class='tooltip'>if (BinaryOperator *<span class='tooltip-content'>168</span></div><div class='tooltip'>BO<span class='tooltip-content'>168</span></div> = dyn_cast<BinaryOperator>(I))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_52' href='#L_VECTOR_52'><pre>52</pre></a></td><td class='covered-line'><pre>112</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>112</span></div><div class='tooltip'>BO->hasOneUse() &&<span class='tooltip-content'>112</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_53' href='#L_VECTOR_53'><pre>53</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> (cheapToScalarize(BO->getOperand(0), isConstant) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_54' href='#L_VECTOR_54'><pre>54</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> cheapToScalarize(BO->getOperand(1), isConstant)))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_55' href='#L_VECTOR_55'><pre>55</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_56' href='#L_VECTOR_56'><pre>56</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> <div class='tooltip'>if (CmpInst *<span class='tooltip-content'>168</span></div><div class='tooltip'>CI<span class='tooltip-content'>168</span></div> = dyn_cast<CmpInst>(I))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_57' href='#L_VECTOR_57'><pre>57</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>CI->hasOneUse() &&</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_58' href='#L_VECTOR_58'><pre>58</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>(cheapToScalarize(CI->getOperand(0), isConstant) ||</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_59' href='#L_VECTOR_59'><pre>59</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>cheapToScalarize(CI->getOperand(1), isConstant)</span><span class='red'>)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_60' href='#L_VECTOR_60'><pre>60</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_61' href='#L_VECTOR_61'><pre>61</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_62' href='#L_VECTOR_62'><pre>62</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_63' href='#L_VECTOR_63'><pre>63</pre></a></td><td class='covered-line'><pre>168</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_64' href='#L_VECTOR_64'><pre>64</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_65' href='#L_VECTOR_65'><pre>65</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// If we have a PHI node with a vector type that is only used to feed</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_66' href='#L_VECTOR_66'><pre>66</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// itself and be an operand of extractelement at a constant location,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_67' href='#L_VECTOR_67'><pre>67</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// try to replace the PHI of the vector type with a PHI of a scalar type.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_68' href='#L_VECTOR_68'><pre>68</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre>Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_69' href='#L_VECTOR_69'><pre>69</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> SmallVector<Instruction *, 2> Extracts;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_70' href='#L_VECTOR_70'><pre>70</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> // The users we want the PHI to have are:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_71' href='#L_VECTOR_71'><pre>71</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> // 1) The EI ExtractElement (we already know this)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_72' href='#L_VECTOR_72'><pre>72</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> // 2) Possibly more ExtractElements with the same index.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_73' href='#L_VECTOR_73'><pre>73</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> // 3) Another operand, which will feed back into the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_74' href='#L_VECTOR_74'><pre>74</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> Instruction *PHIUser = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_75' href='#L_VECTOR_75'><pre>75</pre></a></td><td class='covered-line'><pre>4.17k</pre></td><td class='code'><pre> for (auto U : PN->users()) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_76' href='#L_VECTOR_76'><pre>76</pre></a></td><td class='covered-line'><pre>4.17k</pre></td><td class='code'><pre> if (ExtractElementInst *<div class='tooltip'>EU<span class='tooltip-content'>4.17k</span></div> = dyn_cast<ExtractElementInst>(U)) <div class='tooltip'>{<span class='tooltip-content'>3.39k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_77' href='#L_VECTOR_77'><pre>77</pre></a></td><td class='covered-line'><pre>3.39k</pre></td><td class='code'><pre> if (EI.getIndexOperand() == EU->getIndexOperand())</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_78' href='#L_VECTOR_78'><pre>78</pre></a></td><td class='covered-line'><pre>1.75k</pre></td><td class='code'><pre> Extracts.push_back(EU);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_79' href='#L_VECTOR_79'><pre>79</pre></a></td><td class='covered-line'><pre>3.39k</pre></td><td class='code'><pre> else</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_80' href='#L_VECTOR_80'><pre>80</pre></a></td><td class='covered-line'><pre>1.64k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_81' href='#L_VECTOR_81'><pre>81</pre></a></td><td class='covered-line'><pre>779</pre></td><td class='code'><pre> } else <div class='tooltip'>if (<span class='tooltip-content'>779</span></div><div class='tooltip'>!PHIUser<span class='tooltip-content'>779</span></div>) <div class='tooltip'>{<span class='tooltip-content'>587</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_82' href='#L_VECTOR_82'><pre>82</pre></a></td><td class='covered-line'><pre>587</pre></td><td class='code'><pre> PHIUser = cast<Instruction>(U);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_83' href='#L_VECTOR_83'><pre>83</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_84' href='#L_VECTOR_84'><pre>84</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_85' href='#L_VECTOR_85'><pre>85</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_86' href='#L_VECTOR_86'><pre>86</pre></a></td><td class='covered-line'><pre>4.17k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_87' href='#L_VECTOR_87'><pre>87</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_88' href='#L_VECTOR_88'><pre>88</pre></a></td><td class='covered-line'><pre>796</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>796</span></div><div class='tooltip'>!PHIUser<span class='tooltip-content'>796</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_89' href='#L_VECTOR_89'><pre>89</pre></a></td><td class='covered-line'><pre>538</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_90' href='#L_VECTOR_90'><pre>90</pre></a></td><td class='covered-line'><pre>796</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_91' href='#L_VECTOR_91'><pre>91</pre></a></td><td class='covered-line'><pre>796</pre></td><td class='code'><pre> // Verify that this PHI user has one use, which is the PHI itself,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_92' href='#L_VECTOR_92'><pre>92</pre></a></td><td class='covered-line'><pre>796</pre></td><td class='code'><pre> // and that it is a binary operation which is cheap to scalarize.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_93' href='#L_VECTOR_93'><pre>93</pre></a></td><td class='covered-line'><pre>796</pre></td><td class='code'><pre> // otherwise return NULL.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_94' href='#L_VECTOR_94'><pre>94</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>258</span></div><div class='tooltip'>!PHIUser->hasOneUse() || <span class='tooltip-content'>258</span></div><div class='tooltip'>!(PHIUser->user_back() == PN)<span class='tooltip-content'>82</span></div> ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_95' href='#L_VECTOR_95'><pre>95</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> <div class='tooltip'>!(isa<BinaryOperator>(PHIUser))<span class='tooltip-content'>27</span></div> || <div class='tooltip'><span class='red'>!cheapToScalarize(PHIUser, true)</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_96' href='#L_VECTOR_96'><pre>96</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_97' href='#L_VECTOR_97'><pre>97</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_98' href='#L_VECTOR_98'><pre>98</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre> // Create a scalar PHI node that will replace the vector PHI node</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_99' href='#L_VECTOR_99'><pre>99</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre> // just before the current PHI node.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_100' href='#L_VECTOR_100'><pre>100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>PHINode *scalarPHI = cast<PHINode>(InsertNewInstWith(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_101' href='#L_VECTOR_101'><pre>101</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> PHINode::Create(EI.getType(), PN->getNumIncomingValues(), ""), *PN));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_102' href='#L_VECTOR_102'><pre>102</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Scalarize each PHI operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_103' href='#L_VECTOR_103'><pre>103</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < PN->getNumIncomingValues()</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>i++</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_104' href='#L_VECTOR_104'><pre>104</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *PHIInVal = PN->getIncomingValue(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_105' href='#L_VECTOR_105'><pre>105</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock *inBB = PN->getIncomingBlock(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_106' href='#L_VECTOR_106'><pre>106</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Elt = EI.getIndexOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_107' href='#L_VECTOR_107'><pre>107</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If the operand is the PHI induction variable:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_108' href='#L_VECTOR_108'><pre>108</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>PHIInVal == PHIUser</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_109' href='#L_VECTOR_109'><pre>109</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Scalarize the binary operation. Its first operand is the</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_110' href='#L_VECTOR_110'><pre>110</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // scalar PHI, and the second operand is extracted from the other</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_111' href='#L_VECTOR_111'><pre>111</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // vector operand.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_112' href='#L_VECTOR_112'><pre>112</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator *B0 = cast<BinaryOperator>(PHIUser);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_113' href='#L_VECTOR_113'><pre>113</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned opId = (B0->getOperand(0) == PN) ? </span><div class='tooltip'><span class='red'>1</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>0</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_114' href='#L_VECTOR_114'><pre>114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Op = InsertNewInstWith(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_115' href='#L_VECTOR_115'><pre>115</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ExtractElementInst::Create(B0->getOperand(opId), Elt,</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_116' href='#L_VECTOR_116'><pre>116</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> B0->getOperand(opId)->getName() + ".Elt"),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_117' href='#L_VECTOR_117'><pre>117</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> *B0);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_118' href='#L_VECTOR_118'><pre>118</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *newPHIUser = InsertNewInstWith(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_119' href='#L_VECTOR_119'><pre>119</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BinaryOperator::CreateWithCopiedFlags(B0->getOpcode(),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_120' href='#L_VECTOR_120'><pre>120</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> scalarPHI, Op, B0), *B0);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_121' href='#L_VECTOR_121'><pre>121</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> scalarPHI->addIncoming(newPHIUser, inBB);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_122' href='#L_VECTOR_122'><pre>122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_123' href='#L_VECTOR_123'><pre>123</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Scalarize PHI input:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_124' href='#L_VECTOR_124'><pre>124</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *newEI = ExtractElementInst::Create(PHIInVal, Elt, "");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_125' href='#L_VECTOR_125'><pre>125</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new instruction into the predecessor basic block.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_126' href='#L_VECTOR_126'><pre>126</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Instruction *pos = dyn_cast<Instruction>(PHIInVal);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_127' href='#L_VECTOR_127'><pre>127</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock::iterator InsertPos;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_128' href='#L_VECTOR_128'><pre>128</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>pos && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<PHINode>(pos)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_129' href='#L_VECTOR_129'><pre>129</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertPos = ++pos->getIterator();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_130' href='#L_VECTOR_130'><pre>130</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_131' href='#L_VECTOR_131'><pre>131</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertPos = inBB->getFirstInsertionPt();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_132' href='#L_VECTOR_132'><pre>132</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_133' href='#L_VECTOR_133'><pre>133</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_134' href='#L_VECTOR_134'><pre>134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> InsertNewInstWith(newEI, *InsertPos);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_135' href='#L_VECTOR_135'><pre>135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_136' href='#L_VECTOR_136'><pre>136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> scalarPHI->addIncoming(newEI, inBB);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_137' href='#L_VECTOR_137'><pre>137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_138' href='#L_VECTOR_138'><pre>138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_139' href='#L_VECTOR_139'><pre>139</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_140' href='#L_VECTOR_140'><pre>140</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (auto E : Extracts)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_141' href='#L_VECTOR_141'><pre>141</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>replaceInstUsesWith(*E, scalarPHI)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_142' href='#L_VECTOR_142'><pre>142</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_143' href='#L_VECTOR_143'><pre>143</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return &EI</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_144' href='#L_VECTOR_144'><pre>144</pre></a></td><td class='covered-line'><pre>258</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_145' href='#L_VECTOR_145'><pre>145</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_146' href='#L_VECTOR_146'><pre>146</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_147' href='#L_VECTOR_147'><pre>147</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> if (Value *V = SimplifyExtractElementInst(</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_148' href='#L_VECTOR_148'><pre>148</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> EI.getVectorOperand(), EI.getIndexOperand(), DL, &TLI, &DT, &AC))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_149' href='#L_VECTOR_149'><pre>149</pre></a></td><td class='covered-line'><pre>21</pre></td><td class='code'><pre> return replaceInstUsesWith(EI, V);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_150' href='#L_VECTOR_150'><pre>150</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_151' href='#L_VECTOR_151'><pre>151</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If vector val is constant with all elements the same, replace EI with</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_152' href='#L_VECTOR_152'><pre>152</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // that element. We handle a known element # below.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_153' href='#L_VECTOR_153'><pre>153</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (Constant *<span class='tooltip-content'>16.9k</span></div><div class='tooltip'>C<span class='tooltip-content'>16.9k</span></div> = dyn_cast<Constant>(EI.getOperand(0)))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_154' href='#L_VECTOR_154'><pre>154</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>cheapToScalarize(C, false)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_155' href='#L_VECTOR_155'><pre>155</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return replaceInstUsesWith(EI, C->getAggregateElement(0U))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_156' href='#L_VECTOR_156'><pre>156</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_157' href='#L_VECTOR_157'><pre>157</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If extracting a specified index from the vector, see if we can recursively</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_158' href='#L_VECTOR_158'><pre>158</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // find a previously computed scalar that was inserted into the vector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_159' href='#L_VECTOR_159'><pre>159</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (ConstantInt *<span class='tooltip-content'>16.9k</span></div><div class='tooltip'>IdxC<span class='tooltip-content'>16.9k</span></div> = dyn_cast<ConstantInt>(EI.getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>16.9k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_160' href='#L_VECTOR_160'><pre>160</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> unsigned IndexVal = IdxC->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_161' href='#L_VECTOR_161'><pre>161</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> unsigned VectorWidth = EI.getVectorOperandType()->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_162' href='#L_VECTOR_162'><pre>162</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_163' href='#L_VECTOR_163'><pre>163</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // InstSimplify handles cases where the index is invalid.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_164' href='#L_VECTOR_164'><pre>164</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> assert(IndexVal < VectorWidth);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_165' href='#L_VECTOR_165'><pre>165</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_166' href='#L_VECTOR_166'><pre>166</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // This instruction only demands the single element from the input vector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_167' href='#L_VECTOR_167'><pre>167</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If the input vector has a single use, simplify it based on this use</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_168' href='#L_VECTOR_168'><pre>168</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // property.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_169' href='#L_VECTOR_169'><pre>169</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>EI.getOperand(0)->hasOneUse() && <span class='tooltip-content'>16.9k</span></div><div class='tooltip'>VectorWidth != 1<span class='tooltip-content'>1.85k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.85k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_170' href='#L_VECTOR_170'><pre>170</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> APInt UndefElts(VectorWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_171' href='#L_VECTOR_171'><pre>171</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> APInt DemandedMask(VectorWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_172' href='#L_VECTOR_172'><pre>172</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> DemandedMask.setBit(IndexVal);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_173' href='#L_VECTOR_173'><pre>173</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> if (Value *V = SimplifyDemandedVectorElts(EI.getOperand(0), DemandedMask,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_174' href='#L_VECTOR_174'><pre>174</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> UndefElts)) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_175' href='#L_VECTOR_175'><pre>175</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> EI.setOperand(0, V);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_176' href='#L_VECTOR_176'><pre>176</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> return &EI;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_177' href='#L_VECTOR_177'><pre>177</pre></a></td><td class='covered-line'><pre>7</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_178' href='#L_VECTOR_178'><pre>178</pre></a></td><td class='covered-line'><pre>1.85k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_179' href='#L_VECTOR_179'><pre>179</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_180' href='#L_VECTOR_180'><pre>180</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If this extractelement is directly using a bitcast from a vector of</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_181' href='#L_VECTOR_181'><pre>181</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // the same number of elements, see if we can find the source element from</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_182' href='#L_VECTOR_182'><pre>182</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // it. In this case, we will end up needing to bitcast the scalars.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_183' href='#L_VECTOR_183'><pre>183</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> <div class='tooltip'>if (BitCastInst *<span class='tooltip-content'>16.9k</span></div><div class='tooltip'>BCI<span class='tooltip-content'>16.9k</span></div> = dyn_cast<BitCastInst>(EI.getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>742</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_184' href='#L_VECTOR_184'><pre>184</pre></a></td><td class='covered-line'><pre>742</pre></td><td class='code'><pre> if (VectorType *VT = dyn_cast<VectorType>(BCI->getOperand(0)->getType()))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_185' href='#L_VECTOR_185'><pre>185</pre></a></td><td class='covered-line'><pre>742</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>742</span></div><div class='tooltip'>VT->getNumElements() == VectorWidth<span class='tooltip-content'>742</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_186' href='#L_VECTOR_186'><pre>186</pre></a></td><td class='covered-line'><pre>742</pre></td><td class='code'><pre> <div class='tooltip'>if (Value *<span class='tooltip-content'>742</span></div><div class='tooltip'>Elt<span class='tooltip-content'>742</span></div> = findScalarElement(BCI->getOperand(0), IndexVal))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_187' href='#L_VECTOR_187'><pre>187</pre></a></td><td class='covered-line'><pre>577</pre></td><td class='code'><pre> return new BitCastInst(Elt, EI.getType());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_188' href='#L_VECTOR_188'><pre>188</pre></a></td><td class='covered-line'><pre>742</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_189' href='#L_VECTOR_189'><pre>189</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_190' href='#L_VECTOR_190'><pre>190</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // If there's a vector PHI feeding a scalar use through this extractelement</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_191' href='#L_VECTOR_191'><pre>191</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre> // instruction, try to scalarize the PHI.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_192' href='#L_VECTOR_192'><pre>192</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (PHINode *<span class='tooltip-content'>16.3k</span></div><div class='tooltip'>PN<span class='tooltip-content'>16.3k</span></div> = dyn_cast<PHINode>(EI.getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>2.63k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_193' href='#L_VECTOR_193'><pre>193</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> Instruction *scalarPHI = scalarizePHI(EI, PN);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_194' href='#L_VECTOR_194'><pre>194</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> if (scalarPHI)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_195' href='#L_VECTOR_195'><pre>195</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return scalarPHI</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_196' href='#L_VECTOR_196'><pre>196</pre></a></td><td class='covered-line'><pre>2.63k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_197' href='#L_VECTOR_197'><pre>197</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_198' href='#L_VECTOR_198'><pre>198</pre></a></td><td class='covered-line'><pre>16.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_199' href='#L_VECTOR_199'><pre>199</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>16.3k</span></div><div class='tooltip'>I<span class='tooltip-content'>16.3k</span></div> = dyn_cast<Instruction>(EI.getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>16.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_200' href='#L_VECTOR_200'><pre>200</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> // Push extractelement into predecessor operation if legal and</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_201' href='#L_VECTOR_201'><pre>201</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> // profitable to do so.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_202' href='#L_VECTOR_202'><pre>202</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> if (BinaryOperator *<div class='tooltip'>BO<span class='tooltip-content'>16.3k</span></div> = dyn_cast<BinaryOperator>(I)) <div class='tooltip'>{<span class='tooltip-content'>7.88k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_203' href='#L_VECTOR_203'><pre>203</pre></a></td><td class='covered-line'><pre>7.88k</pre></td><td class='code'><pre> if (I->hasOneUse() &&</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_204' href='#L_VECTOR_204'><pre>204</pre></a></td><td class='covered-line'><pre>56</pre></td><td class='code'><pre> <div class='tooltip'>cheapToScalarize(BO, isa<ConstantInt>(EI.getOperand(1)))<span class='tooltip-content'>56</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_205' href='#L_VECTOR_205'><pre>205</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *newEI0 =</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_206' href='#L_VECTOR_206'><pre>206</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateExtractElement(BO->getOperand(0), EI.getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_207' href='#L_VECTOR_207'><pre>207</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EI.getName()+".lhs");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_208' href='#L_VECTOR_208'><pre>208</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *newEI1 =</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_209' href='#L_VECTOR_209'><pre>209</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->CreateExtractElement(BO->getOperand(1), EI.getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_210' href='#L_VECTOR_210'><pre>210</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EI.getName()+".rhs");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_211' href='#L_VECTOR_211'><pre>211</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return BinaryOperator::CreateWithCopiedFlags(BO->getOpcode(),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_212' href='#L_VECTOR_212'><pre>212</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> newEI0, newEI1, BO);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_213' href='#L_VECTOR_213'><pre>213</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_214' href='#L_VECTOR_214'><pre>214</pre></a></td><td class='covered-line'><pre>8.48k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (InsertElementInst *<span class='tooltip-content'>8.48k</span></div><div class='tooltip'>IE<span class='tooltip-content'>8.48k</span></div> = dyn_cast<InsertElementInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>17</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_215' href='#L_VECTOR_215'><pre>215</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> // Extracting the inserted element?</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_216' href='#L_VECTOR_216'><pre>216</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> if (IE->getOperand(2) == EI.getOperand(1))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_217' href='#L_VECTOR_217'><pre>217</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(EI, IE->getOperand(1))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_218' href='#L_VECTOR_218'><pre>218</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> // If the inserted and extracted elements are constants, they must not</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_219' href='#L_VECTOR_219'><pre>219</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> // be the same value, extract from the pre-inserted value instead.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_220' href='#L_VECTOR_220'><pre>220</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>17</span></div><div class='tooltip'>isa<Constant>(IE->getOperand(2)) && <span class='tooltip-content'>17</span></div><div class='tooltip'>isa<Constant>(EI.getOperand(1))<span class='tooltip-content'>17</span></div>) <div class='tooltip'>{<span class='tooltip-content'>17</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_221' href='#L_VECTOR_221'><pre>221</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> Worklist.AddValue(EI.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_222' href='#L_VECTOR_222'><pre>222</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> EI.setOperand(0, IE->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_223' href='#L_VECTOR_223'><pre>223</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> return &EI;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_224' href='#L_VECTOR_224'><pre>224</pre></a></td><td class='covered-line'><pre>17</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_225' href='#L_VECTOR_225'><pre>225</pre></a></td><td class='covered-line'><pre>8.47k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (ShuffleVectorInst *<span class='tooltip-content'>8.47k</span></div><div class='tooltip'>SVI<span class='tooltip-content'>8.47k</span></div> = dyn_cast<ShuffleVectorInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_226' href='#L_VECTOR_226'><pre>226</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // If this is extracting an element from a shufflevector, figure out where</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_227' href='#L_VECTOR_227'><pre>227</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> // it came from and extract from the appropriate input element instead.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_228' href='#L_VECTOR_228'><pre>228</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (ConstantInt *<div class='tooltip'>Elt<span class='tooltip-content'>1</span></div> = dyn_cast<ConstantInt>(EI.getOperand(1))) <div class='tooltip'>{<span class='tooltip-content'>1</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_229' href='#L_VECTOR_229'><pre>229</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> int SrcIdx = SVI->getMaskValue(Elt->getZExtValue());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_230' href='#L_VECTOR_230'><pre>230</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Value *Src;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_231' href='#L_VECTOR_231'><pre>231</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> unsigned LHSWidth =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_232' href='#L_VECTOR_232'><pre>232</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> SVI->getOperand(0)->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_233' href='#L_VECTOR_233'><pre>233</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_234' href='#L_VECTOR_234'><pre>234</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> if (SrcIdx < 0)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_235' href='#L_VECTOR_235'><pre>235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(EI, UndefValue::get(EI.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_236' href='#L_VECTOR_236'><pre>236</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>1</span></div><div class='tooltip'>SrcIdx < (int)LHSWidth<span class='tooltip-content'>1</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_237' href='#L_VECTOR_237'><pre>237</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Src = SVI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_238' href='#L_VECTOR_238'><pre>238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> else <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_239' href='#L_VECTOR_239'><pre>239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SrcIdx -= LHSWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_240' href='#L_VECTOR_240'><pre>240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Src = SVI->getOperand(1);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_241' href='#L_VECTOR_241'><pre>241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_242' href='#L_VECTOR_242'><pre>242</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> Type *Int32Ty = Type::getInt32Ty(EI.getContext());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_243' href='#L_VECTOR_243'><pre>243</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> return ExtractElementInst::Create(Src,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_244' href='#L_VECTOR_244'><pre>244</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> ConstantInt::get(Int32Ty,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_245' href='#L_VECTOR_245'><pre>245</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> SrcIdx, false));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_246' href='#L_VECTOR_246'><pre>246</pre></a></td><td class='covered-line'><pre>1</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_247' href='#L_VECTOR_247'><pre>247</pre></a></td><td class='covered-line'><pre>8.46k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (CastInst *<span class='tooltip-content'>8.46k</span></div><div class='tooltip'>CI<span class='tooltip-content'>8.46k</span></div> = dyn_cast<CastInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>192</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_248' href='#L_VECTOR_248'><pre>248</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> // Canonicalize extractelement(cast) -> cast(extractelement).</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_249' href='#L_VECTOR_249'><pre>249</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> // Bitcasts can change the number of vector elements, and they cost</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_250' href='#L_VECTOR_250'><pre>250</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> // nothing.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_251' href='#L_VECTOR_251'><pre>251</pre></a></td><td class='covered-line'><pre>192</pre></td><td class='code'><pre> if (<div class='tooltip'>CI->hasOneUse() && <span class='tooltip-content'>192</span></div><div class='tooltip'>(CI->getOpcode() != Instruction::BitCast)<span class='tooltip-content'>137</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_252' href='#L_VECTOR_252'><pre>252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *EE = Builder->CreateExtractElement(CI->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_253' href='#L_VECTOR_253'><pre>253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EI.getIndexOperand());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_254' href='#L_VECTOR_254'><pre>254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Worklist.AddValue(EE);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_255' href='#L_VECTOR_255'><pre>255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return CastInst::Create(CI->getOpcode(), EE, EI.getType());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_256' href='#L_VECTOR_256'><pre>256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_257' href='#L_VECTOR_257'><pre>257</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> } else <div class='tooltip'>if (SelectInst *<span class='tooltip-content'>8.27k</span></div><div class='tooltip'>SI<span class='tooltip-content'>8.27k</span></div> = dyn_cast<SelectInst>(I)) <div class='tooltip'>{<span class='tooltip-content'>144</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_258' href='#L_VECTOR_258'><pre>258</pre></a></td><td class='covered-line'><pre>144</pre></td><td class='code'><pre> if (<div class='tooltip'>SI->hasOneUse()<span class='tooltip-content'>144</span></div>) <div class='tooltip'>{<span class='tooltip-content'>6</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_259' href='#L_VECTOR_259'><pre>259</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // TODO: For a select on vectors, it might be useful to do this if it</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_260' href='#L_VECTOR_260'><pre>260</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // has multiple extractelement uses. For vector select, that seems to</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_261' href='#L_VECTOR_261'><pre>261</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // fight the vectorizer.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_262' href='#L_VECTOR_262'><pre>262</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_263' href='#L_VECTOR_263'><pre>263</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // If we are extracting an element from a vector select or a select on</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_264' href='#L_VECTOR_264'><pre>264</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // vectors, create a select on the scalars extracted from the vector</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_265' href='#L_VECTOR_265'><pre>265</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> // arguments.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_266' href='#L_VECTOR_266'><pre>266</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *TrueVal = SI->getTrueValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_267' href='#L_VECTOR_267'><pre>267</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *FalseVal = SI->getFalseValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_268' href='#L_VECTOR_268'><pre>268</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_269' href='#L_VECTOR_269'><pre>269</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *Cond = SI->getCondition();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_270' href='#L_VECTOR_270'><pre>270</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> if (<div class='tooltip'>Cond->getType()->isVectorTy()<span class='tooltip-content'>6</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_271' href='#L_VECTOR_271'><pre>271</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cond = Builder->CreateExtractElement(Cond,</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_272' href='#L_VECTOR_272'><pre>272</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EI.getIndexOperand(),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_273' href='#L_VECTOR_273'><pre>273</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Cond->getName() + ".elt");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_274' href='#L_VECTOR_274'><pre>274</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_275' href='#L_VECTOR_275'><pre>275</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_276' href='#L_VECTOR_276'><pre>276</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *V1Elem</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_277' href='#L_VECTOR_277'><pre>277</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> = Builder->CreateExtractElement(TrueVal,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_278' href='#L_VECTOR_278'><pre>278</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> EI.getIndexOperand(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_279' href='#L_VECTOR_279'><pre>279</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> TrueVal->getName() + ".elt");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_280' href='#L_VECTOR_280'><pre>280</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_281' href='#L_VECTOR_281'><pre>281</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Value *V2Elem</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_282' href='#L_VECTOR_282'><pre>282</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> = Builder->CreateExtractElement(FalseVal,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_283' href='#L_VECTOR_283'><pre>283</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> EI.getIndexOperand(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_284' href='#L_VECTOR_284'><pre>284</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> FalseVal->getName() + ".elt");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_285' href='#L_VECTOR_285'><pre>285</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> return SelectInst::Create(Cond,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_286' href='#L_VECTOR_286'><pre>286</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> V1Elem,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_287' href='#L_VECTOR_287'><pre>287</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> V2Elem,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_288' href='#L_VECTOR_288'><pre>288</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> SI->getName() + ".elt");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_289' href='#L_VECTOR_289'><pre>289</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_290' href='#L_VECTOR_290'><pre>290</pre></a></td><td class='covered-line'><pre>144</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_291' href='#L_VECTOR_291'><pre>291</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_292' href='#L_VECTOR_292'><pre>292</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_293' href='#L_VECTOR_293'><pre>293</pre></a></td><td class='covered-line'><pre>16.3k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_294' href='#L_VECTOR_294'><pre>294</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_295' href='#L_VECTOR_295'><pre>295</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If V is a shuffle of values that ONLY returns elements from either LHS or</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_296' href='#L_VECTOR_296'><pre>296</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// RHS, return the shuffle mask and true. Otherwise, return false.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_297' href='#L_VECTOR_297'><pre>297</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool collectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_298' href='#L_VECTOR_298'><pre>298</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> SmallVectorImpl<Constant*> &Mask) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_299' href='#L_VECTOR_299'><pre>299</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> assert(LHS->getType() == RHS->getType() &&</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_300' href='#L_VECTOR_300'><pre>300</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> "Invalid CollectSingleShuffleElements");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_301' href='#L_VECTOR_301'><pre>301</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> unsigned NumElts = V->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_302' href='#L_VECTOR_302'><pre>302</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_303' href='#L_VECTOR_303'><pre>303</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(V)<span class='tooltip-content'>188</span></div>) <div class='tooltip'>{<span class='tooltip-content'>88</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_304' href='#L_VECTOR_304'><pre>304</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> Mask.assign(NumElts, UndefValue::get(Type::getInt32Ty(V->getContext())));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_305' href='#L_VECTOR_305'><pre>305</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_306' href='#L_VECTOR_306'><pre>306</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_307' href='#L_VECTOR_307'><pre>307</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_308' href='#L_VECTOR_308'><pre>308</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100</span></div><div class='tooltip'>V == LHS<span class='tooltip-content'>100</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_309' href='#L_VECTOR_309'><pre>309</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_310' href='#L_VECTOR_310'><pre>310</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Mask.push_back(ConstantInt::get(Type::getInt32Ty(V->getContext()), i))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_311' href='#L_VECTOR_311'><pre>311</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_312' href='#L_VECTOR_312'><pre>312</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_313' href='#L_VECTOR_313'><pre>313</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_314' href='#L_VECTOR_314'><pre>314</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>100</span></div><div class='tooltip'>V == RHS<span class='tooltip-content'>100</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_315' href='#L_VECTOR_315'><pre>315</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_316' href='#L_VECTOR_316'><pre>316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Mask.push_back(ConstantInt::get(Type::getInt32Ty(V->getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_317' href='#L_VECTOR_317'><pre>317</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> i+NumElts))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_318' href='#L_VECTOR_318'><pre>318</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_319' href='#L_VECTOR_319'><pre>319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_320' href='#L_VECTOR_320'><pre>320</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_321' href='#L_VECTOR_321'><pre>321</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> <div class='tooltip'>if (InsertElementInst *<span class='tooltip-content'>100</span></div><div class='tooltip'>IEI<span class='tooltip-content'>100</span></div> = dyn_cast<InsertElementInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_322' href='#L_VECTOR_322'><pre>322</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> // If this is an insert of an extract from some other vector, include it.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_323' href='#L_VECTOR_323'><pre>323</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> Value *VecOp = IEI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_324' href='#L_VECTOR_324'><pre>324</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> Value *ScalarOp = IEI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_325' href='#L_VECTOR_325'><pre>325</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> Value *IdxOp = IEI->getOperand(2);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_326' href='#L_VECTOR_326'><pre>326</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_327' href='#L_VECTOR_327'><pre>327</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (!isa<ConstantInt>(IdxOp))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_328' href='#L_VECTOR_328'><pre>328</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_329' href='#L_VECTOR_329'><pre>329</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_330' href='#L_VECTOR_330'><pre>330</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_331' href='#L_VECTOR_331'><pre>331</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(ScalarOp)<span class='tooltip-content'>100</span></div>) <div class='tooltip'><span class='red'>{ // inserting undef into vector.</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_332' href='#L_VECTOR_332'><pre>332</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We can handle this if the vector we are inserting into is</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_333' href='#L_VECTOR_333'><pre>333</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // transitively ok.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_334' href='#L_VECTOR_334'><pre>334</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>collectSingleShuffleElements(VecOp, LHS, RHS, Mask)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_335' href='#L_VECTOR_335'><pre>335</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If so, update the mask to reflect the inserted undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_336' href='#L_VECTOR_336'><pre>336</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask[InsertedIdx] = UndefValue::get(Type::getInt32Ty(V->getContext()));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_337' href='#L_VECTOR_337'><pre>337</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_338' href='#L_VECTOR_338'><pre>338</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_339' href='#L_VECTOR_339'><pre>339</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (ExtractElementInst *<span class='tooltip-content'>100</span></div><div class='tooltip'>EI<span class='tooltip-content'>100</span></div> = dyn_cast<ExtractElementInst>(ScalarOp))<div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_340' href='#L_VECTOR_340'><pre>340</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<ConstantInt>(EI->getOperand(1))<span class='tooltip-content'>100</span></div>) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_341' href='#L_VECTOR_341'><pre>341</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> unsigned ExtractedIdx =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_342' href='#L_VECTOR_342'><pre>342</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> cast<ConstantInt>(EI->getOperand(1))->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_343' href='#L_VECTOR_343'><pre>343</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> unsigned NumLHSElts = LHS->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_344' href='#L_VECTOR_344'><pre>344</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_345' href='#L_VECTOR_345'><pre>345</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> // This must be extracting from either LHS or RHS.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_346' href='#L_VECTOR_346'><pre>346</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>EI->getOperand(0) == LHS || <span class='tooltip-content'>100</span></div><div class='tooltip'>EI->getOperand(0) == RHS<span class='tooltip-content'>6</span></div>) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_347' href='#L_VECTOR_347'><pre>347</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> // We can handle this if the vector we are inserting into is</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_348' href='#L_VECTOR_348'><pre>348</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> // transitively ok.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_349' href='#L_VECTOR_349'><pre>349</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>collectSingleShuffleElements(VecOp, LHS, RHS, Mask)<span class='tooltip-content'>100</span></div>) <div class='tooltip'>{<span class='tooltip-content'>100</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_350' href='#L_VECTOR_350'><pre>350</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> // If so, update the mask to reflect the inserted value.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_351' href='#L_VECTOR_351'><pre>351</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> if (<div class='tooltip'>EI->getOperand(0) == LHS<span class='tooltip-content'>100</span></div>) <div class='tooltip'>{<span class='tooltip-content'>94</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_352' href='#L_VECTOR_352'><pre>352</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> Mask[InsertedIdx % NumElts] =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_353' href='#L_VECTOR_353'><pre>353</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> ConstantInt::get(Type::getInt32Ty(V->getContext()),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_354' href='#L_VECTOR_354'><pre>354</pre></a></td><td class='covered-line'><pre>94</pre></td><td class='code'><pre> ExtractedIdx);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_355' href='#L_VECTOR_355'><pre>355</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_356' href='#L_VECTOR_356'><pre>356</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> assert(EI->getOperand(0) == RHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_357' href='#L_VECTOR_357'><pre>357</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> Mask[InsertedIdx % NumElts] =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_358' href='#L_VECTOR_358'><pre>358</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> ConstantInt::get(Type::getInt32Ty(V->getContext()),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_359' href='#L_VECTOR_359'><pre>359</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> ExtractedIdx + NumLHSElts);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_360' href='#L_VECTOR_360'><pre>360</pre></a></td><td class='covered-line'><pre>6</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_361' href='#L_VECTOR_361'><pre>361</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_362' href='#L_VECTOR_362'><pre>362</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_363' href='#L_VECTOR_363'><pre>363</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_364' href='#L_VECTOR_364'><pre>364</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_365' href='#L_VECTOR_365'><pre>365</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_366' href='#L_VECTOR_366'><pre>366</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_367' href='#L_VECTOR_367'><pre>367</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_368' href='#L_VECTOR_368'><pre>368</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_369' href='#L_VECTOR_369'><pre>369</pre></a></td><td class='covered-line'><pre>100</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_370' href='#L_VECTOR_370'><pre>370</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_371' href='#L_VECTOR_371'><pre>371</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// If we have insertion into a vector that is wider than the vector that we</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_372' href='#L_VECTOR_372'><pre>372</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// are extracting from, try to widen the source vector to allow a single</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_373' href='#L_VECTOR_373'><pre>373</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// shufflevector to replace one or more insert/extract pairs.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_374' href='#L_VECTOR_374'><pre>374</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static void replaceExtractElements(InsertElementInst *InsElt,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_375' href='#L_VECTOR_375'><pre>375</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ExtractElementInst *ExtElt,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_376' href='#L_VECTOR_376'><pre>376</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> InstCombiner &IC) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_377' href='#L_VECTOR_377'><pre>377</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *InsVecType = InsElt->getType();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_378' href='#L_VECTOR_378'><pre>378</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType *ExtVecType = ExtElt->getVectorOperandType();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_379' href='#L_VECTOR_379'><pre>379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumInsElts = InsVecType->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_380' href='#L_VECTOR_380'><pre>380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumExtElts = ExtVecType->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_381' href='#L_VECTOR_381'><pre>381</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_382' href='#L_VECTOR_382'><pre>382</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The inserted-to vector must be wider than the extracted-from vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_383' href='#L_VECTOR_383'><pre>383</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>InsVecType->getElementType() != ExtVecType->getElementType() ||</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_384' href='#L_VECTOR_384'><pre>384</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NumExtElts >= NumInsElts</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_385' href='#L_VECTOR_385'><pre>385</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_386' href='#L_VECTOR_386'><pre>386</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_387' href='#L_VECTOR_387'><pre>387</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Create a shuffle mask to widen the extended-from vector using undefined</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_388' href='#L_VECTOR_388'><pre>388</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // values. The mask selects all of the values of the original vector followed</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_389' href='#L_VECTOR_389'><pre>389</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // by as many undefined values as needed to create a vector of the same length</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_390' href='#L_VECTOR_390'><pre>390</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // as the inserted-to vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_391' href='#L_VECTOR_391'><pre>391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>SmallVector<Constant *, 16> ExtendMask;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_392' href='#L_VECTOR_392'><pre>392</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IntegerType *IntType = Type::getInt32Ty(InsElt->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_393' href='#L_VECTOR_393'><pre>393</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < NumExtElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_394' href='#L_VECTOR_394'><pre>394</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ExtendMask.push_back(ConstantInt::get(IntType, i))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_395' href='#L_VECTOR_395'><pre>395</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = NumExtElts; </span><div class='tooltip'><span class='red'>i < NumInsElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_396' href='#L_VECTOR_396'><pre>396</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ExtendMask.push_back(UndefValue::get(IntType))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_397' href='#L_VECTOR_397'><pre>397</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_398' href='#L_VECTOR_398'><pre>398</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *ExtVecOp = ExtElt->getVectorOperand();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_399' href='#L_VECTOR_399'><pre>399</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *ExtVecOpInst = dyn_cast<Instruction>(ExtVecOp);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_400' href='#L_VECTOR_400'><pre>400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BasicBlock *InsertionBlock = (ExtVecOpInst && </span><span class='red'>!isa<PHINode>(ExtVecOpInst)</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_401' href='#L_VECTOR_401'><pre>401</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>ExtVecOpInst->getParent()</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_402' href='#L_VECTOR_402'><pre>402</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>ExtElt->getParent()</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_403' href='#L_VECTOR_403'><pre>403</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_404' href='#L_VECTOR_404'><pre>404</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: This restriction matches the basic block check below when creating</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_405' href='#L_VECTOR_405'><pre>405</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // new extractelement instructions. If that limitation is removed, this one</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_406' href='#L_VECTOR_406'><pre>406</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // could also be removed. But for now, we just bail out to ensure that we</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_407' href='#L_VECTOR_407'><pre>407</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // will replace the extractelement instruction that is feeding our</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_408' href='#L_VECTOR_408'><pre>408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // insertelement instruction. This allows the insertelement to then be</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_409' href='#L_VECTOR_409'><pre>409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // replaced by a shufflevector. If the insertelement is not replaced, we can</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_410' href='#L_VECTOR_410'><pre>410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // induce infinite looping because there's an optimization for extractelement</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_411' href='#L_VECTOR_411'><pre>411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that will delete our widening shuffle. This would trigger another attempt</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_412' href='#L_VECTOR_412'><pre>412</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // here to create that shuffle, and we spin forever.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_413' href='#L_VECTOR_413'><pre>413</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>InsertionBlock != InsElt->getParent()</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_414' href='#L_VECTOR_414'><pre>414</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_415' href='#L_VECTOR_415'><pre>415</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_416' href='#L_VECTOR_416'><pre>416</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: This restriction matches the check in visitInsertElementInst() and</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_417' href='#L_VECTOR_417'><pre>417</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // prevents an infinite loop caused by not turning the extract/insert pair</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_418' href='#L_VECTOR_418'><pre>418</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // into a shuffle. We really should not need either check, but we're lacking</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_419' href='#L_VECTOR_419'><pre>419</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // folds for shufflevectors because we're afraid to generate shuffle masks</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_420' href='#L_VECTOR_420'><pre>420</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that the backend can't handle.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_421' href='#L_VECTOR_421'><pre>421</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>InsElt->hasOneUse() && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<InsertElementInst>(InsElt->user_back())</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_422' href='#L_VECTOR_422'><pre>422</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_423' href='#L_VECTOR_423'><pre>423</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_424' href='#L_VECTOR_424'><pre>424</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *WideVec = new ShuffleVectorInst(ExtVecOp, UndefValue::get(ExtVecType),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_425' href='#L_VECTOR_425'><pre>425</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(ExtendMask));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_426' href='#L_VECTOR_426'><pre>426</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_427' href='#L_VECTOR_427'><pre>427</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Insert the new shuffle after the vector operand of the extract is defined</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_428' href='#L_VECTOR_428'><pre>428</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (as long as it's not a PHI) or at the start of the basic block of the</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_429' href='#L_VECTOR_429'><pre>429</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // extract, so any subsequent extracts in the same basic block can use it.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_430' href='#L_VECTOR_430'><pre>430</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // TODO: Insert before the earliest ExtractElementInst that is replaced.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_431' href='#L_VECTOR_431'><pre>431</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>ExtVecOpInst && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isa<PHINode>(ExtVecOpInst)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_432' href='#L_VECTOR_432'><pre>432</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>WideVec->insertAfter(ExtVecOpInst)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_433' href='#L_VECTOR_433'><pre>433</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_434' href='#L_VECTOR_434'><pre>434</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>IC.InsertNewInstWith(WideVec, *ExtElt->getParent()->getFirstInsertionPt())</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_435' href='#L_VECTOR_435'><pre>435</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_436' href='#L_VECTOR_436'><pre>436</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Replace extracts from the original narrow vector with extracts from the new</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_437' href='#L_VECTOR_437'><pre>437</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // wide vector.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_438' href='#L_VECTOR_438'><pre>438</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (User *U : ExtVecOp->users()) </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_439' href='#L_VECTOR_439'><pre>439</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ExtractElementInst *OldExt = dyn_cast<ExtractElementInst>(U);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_440' href='#L_VECTOR_440'><pre>440</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!OldExt || </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>OldExt->getParent() != WideVec->getParent()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_441' href='#L_VECTOR_441'><pre>441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_442' href='#L_VECTOR_442'><pre>442</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>auto *NewExt = ExtractElementInst::Create(WideVec, OldExt->getOperand(1));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_443' href='#L_VECTOR_443'><pre>443</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewExt->insertAfter(WideVec);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_444' href='#L_VECTOR_444'><pre>444</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IC.replaceInstUsesWith(*OldExt, NewExt);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_445' href='#L_VECTOR_445'><pre>445</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_446' href='#L_VECTOR_446'><pre>446</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_447' href='#L_VECTOR_447'><pre>447</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_448' href='#L_VECTOR_448'><pre>448</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// We are building a shuffle to create V, which is a sequence of insertelement,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_449' href='#L_VECTOR_449'><pre>449</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// extractelement pairs. If PermittedRHS is set, then we must either use it or</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_450' href='#L_VECTOR_450'><pre>450</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// not rely on the second vector source. Return a std::pair containing the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_451' href='#L_VECTOR_451'><pre>451</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// left and right vectors of the proposed shuffle (or 0), and set the Mask</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_452' href='#L_VECTOR_452'><pre>452</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// parameter as required.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_453' href='#L_VECTOR_453'><pre>453</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>///</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_454' href='#L_VECTOR_454'><pre>454</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Note: we intentionally don't try to fold earlier shuffles since they have</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_455' href='#L_VECTOR_455'><pre>455</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// often been chosen carefully to be efficiently implementable on the target.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_456' href='#L_VECTOR_456'><pre>456</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>typedef std::pair<Value *, Value *> ShuffleOps;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_457' href='#L_VECTOR_457'><pre>457</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_458' href='#L_VECTOR_458'><pre>458</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static ShuffleOps collectShuffleElements(Value *V,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_459' href='#L_VECTOR_459'><pre>459</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> SmallVectorImpl<Constant *> &Mask,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_460' href='#L_VECTOR_460'><pre>460</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *PermittedRHS,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_461' href='#L_VECTOR_461'><pre>461</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre> InstCombiner &IC) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_462' href='#L_VECTOR_462'><pre>462</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre> assert(V->getType()->isVectorTy() && "Invalid shuffle!");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_463' href='#L_VECTOR_463'><pre>463</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre> unsigned NumElts = V->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_464' href='#L_VECTOR_464'><pre>464</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_465' href='#L_VECTOR_465'><pre>465</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(V)<span class='tooltip-content'>3.87k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.08k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_466' href='#L_VECTOR_466'><pre>466</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> Mask.assign(NumElts, UndefValue::get(Type::getInt32Ty(V->getContext())));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_467' href='#L_VECTOR_467'><pre>467</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> return std::make_pair(</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_468' href='#L_VECTOR_468'><pre>468</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> PermittedRHS ? <div class='tooltip'>UndefValue::get(PermittedRHS->getType())<span class='tooltip-content'>1.08k</span></div> : <div class='tooltip'><span class='red'>V</span><span class='tooltip-content'>0</span></div>, nullptr);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_469' href='#L_VECTOR_469'><pre>469</pre></a></td><td class='covered-line'><pre>1.08k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_470' href='#L_VECTOR_470'><pre>470</pre></a></td><td class='covered-line'><pre>3.87k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_471' href='#L_VECTOR_471'><pre>471</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.79k</span></div><div class='tooltip'>isa<ConstantAggregateZero>(V)<span class='tooltip-content'>2.79k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_472' href='#L_VECTOR_472'><pre>472</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.assign(NumElts, ConstantInt::get(Type::getInt32Ty(V->getContext()),0));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_473' href='#L_VECTOR_473'><pre>473</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return std::make_pair(V, nullptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_474' href='#L_VECTOR_474'><pre>474</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_475' href='#L_VECTOR_475'><pre>475</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_476' href='#L_VECTOR_476'><pre>476</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre> <div class='tooltip'>if (InsertElementInst *<span class='tooltip-content'>2.79k</span></div><div class='tooltip'>IEI<span class='tooltip-content'>2.79k</span></div> = dyn_cast<InsertElementInst>(V)) <div class='tooltip'>{<span class='tooltip-content'>2.72k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_477' href='#L_VECTOR_477'><pre>477</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> // If this is an insert of an extract from some other vector, include it.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_478' href='#L_VECTOR_478'><pre>478</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> Value *VecOp = IEI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_479' href='#L_VECTOR_479'><pre>479</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> Value *ScalarOp = IEI->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_480' href='#L_VECTOR_480'><pre>480</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> Value *IdxOp = IEI->getOperand(2);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_481' href='#L_VECTOR_481'><pre>481</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_482' href='#L_VECTOR_482'><pre>482</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> if (ExtractElementInst *<div class='tooltip'>EI<span class='tooltip-content'>2.72k</span></div> = dyn_cast<ExtractElementInst>(ScalarOp)) <div class='tooltip'>{<span class='tooltip-content'>2.54k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_483' href='#L_VECTOR_483'><pre>483</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<ConstantInt>(EI->getOperand(1)) && <span class='tooltip-content'>2.54k</span></div><div class='tooltip'>isa<ConstantInt>(IdxOp)<span class='tooltip-content'>2.54k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.54k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_484' href='#L_VECTOR_484'><pre>484</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> unsigned ExtractedIdx =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_485' href='#L_VECTOR_485'><pre>485</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> cast<ConstantInt>(EI->getOperand(1))->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_486' href='#L_VECTOR_486'><pre>486</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_487' href='#L_VECTOR_487'><pre>487</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_488' href='#L_VECTOR_488'><pre>488</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> // Either the extracted from or inserted into vector must be RHSVec,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_489' href='#L_VECTOR_489'><pre>489</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> // otherwise we'd end up with a shuffle of three inputs.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_490' href='#L_VECTOR_490'><pre>490</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> if (<div class='tooltip'>EI->getOperand(0) == PermittedRHS || <span class='tooltip-content'>2.54k</span></div><div class='tooltip'>PermittedRHS == nullptr<span class='tooltip-content'>1.51k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.45k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_491' href='#L_VECTOR_491'><pre>491</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> Value *RHS = EI->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_492' href='#L_VECTOR_492'><pre>492</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> ShuffleOps LR = collectShuffleElements(VecOp, Mask, RHS, IC);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_493' href='#L_VECTOR_493'><pre>493</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> assert(LR.second == nullptr || LR.second == RHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_494' href='#L_VECTOR_494'><pre>494</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_495' href='#L_VECTOR_495'><pre>495</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> if (<div class='tooltip'>LR.first->getType() != RHS->getType()<span class='tooltip-content'>2.45k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_496' href='#L_VECTOR_496'><pre>496</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Although we are giving up for now, see if we can create extracts</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_497' href='#L_VECTOR_497'><pre>497</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that match the inserts for another round of combining.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_498' href='#L_VECTOR_498'><pre>498</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replaceExtractElements(IEI, EI, IC);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_499' href='#L_VECTOR_499'><pre>499</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_500' href='#L_VECTOR_500'><pre>500</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We tried our best, but we can't find anything compatible with RHS</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_501' href='#L_VECTOR_501'><pre>501</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // further up the chain. Return a trivial shuffle.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_502' href='#L_VECTOR_502'><pre>502</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i < NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_503' href='#L_VECTOR_503'><pre>503</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Mask[i] = ConstantInt::get(Type::getInt32Ty(V->getContext()), i)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_504' href='#L_VECTOR_504'><pre>504</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return std::make_pair(V, nullptr);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_505' href='#L_VECTOR_505'><pre>505</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_506' href='#L_VECTOR_506'><pre>506</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_507' href='#L_VECTOR_507'><pre>507</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> unsigned NumLHSElts = RHS->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_508' href='#L_VECTOR_508'><pre>508</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> Mask[InsertedIdx % NumElts] =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_509' href='#L_VECTOR_509'><pre>509</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> ConstantInt::get(Type::getInt32Ty(V->getContext()),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_510' href='#L_VECTOR_510'><pre>510</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> NumLHSElts+ExtractedIdx);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_511' href='#L_VECTOR_511'><pre>511</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> return std::make_pair(LR.first, RHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_512' href='#L_VECTOR_512'><pre>512</pre></a></td><td class='covered-line'><pre>2.45k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_513' href='#L_VECTOR_513'><pre>513</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_514' href='#L_VECTOR_514'><pre>514</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>88</span></div><div class='tooltip'>VecOp == PermittedRHS<span class='tooltip-content'>88</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_515' href='#L_VECTOR_515'><pre>515</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // We've gone as far as we can: anything on the other side of the</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_516' href='#L_VECTOR_516'><pre>516</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // extractelement will already have been converted into a shuffle.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_517' href='#L_VECTOR_517'><pre>517</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumLHSElts =</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_518' href='#L_VECTOR_518'><pre>518</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> EI->getOperand(0)->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_519' href='#L_VECTOR_519'><pre>519</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned i = 0; </span><div class='tooltip'><span class='red'>i != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_520' href='#L_VECTOR_520'><pre>520</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Mask.push_back(ConstantInt::get(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_521' href='#L_VECTOR_521'><pre>521</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type::getInt32Ty(V->getContext()),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_522' href='#L_VECTOR_522'><pre>522</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> i == InsertedIdx ? </span><div class='tooltip'><span class='red'>ExtractedIdx</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>NumLHSElts + i</span><span class='tooltip-content'>0</span></div><span class='red'>))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_523' href='#L_VECTOR_523'><pre>523</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return std::make_pair(EI->getOperand(0), PermittedRHS);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_524' href='#L_VECTOR_524'><pre>524</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_525' href='#L_VECTOR_525'><pre>525</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_526' href='#L_VECTOR_526'><pre>526</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> // If this insertelement is a chain that comes from exactly these two</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_527' href='#L_VECTOR_527'><pre>527</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> // vectors, return the vector and the effective shuffle.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_528' href='#L_VECTOR_528'><pre>528</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>88</span></div><div class='tooltip'>EI->getOperand(0)->getType() == PermittedRHS->getType() &&<span class='tooltip-content'>88</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_529' href='#L_VECTOR_529'><pre>529</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> collectSingleShuffleElements(IEI, EI->getOperand(0), PermittedRHS,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_530' href='#L_VECTOR_530'><pre>530</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> Mask))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_531' href='#L_VECTOR_531'><pre>531</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> return std::make_pair(EI->getOperand(0), PermittedRHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_532' href='#L_VECTOR_532'><pre>532</pre></a></td><td class='covered-line'><pre>88</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_533' href='#L_VECTOR_533'><pre>533</pre></a></td><td class='covered-line'><pre>2.54k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_534' href='#L_VECTOR_534'><pre>534</pre></a></td><td class='covered-line'><pre>2.72k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_535' href='#L_VECTOR_535'><pre>535</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_536' href='#L_VECTOR_536'><pre>536</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre> // Otherwise, we can't do anything fancy. Return an identity vector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_537' href='#L_VECTOR_537'><pre>537</pre></a></td><td class='covered-line'><pre>753</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned i = 0; <span class='tooltip-content'>251</span></div><div class='tooltip'>i != NumElts<span class='tooltip-content'>753</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>502</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_538' href='#L_VECTOR_538'><pre>538</pre></a></td><td class='covered-line'><pre>502</pre></td><td class='code'><pre> Mask.push_back(ConstantInt::get(Type::getInt32Ty(V->getContext()), i));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_539' href='#L_VECTOR_539'><pre>539</pre></a></td><td class='covered-line'><pre>251</pre></td><td class='code'><pre> return std::make_pair(V, nullptr);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_540' href='#L_VECTOR_540'><pre>540</pre></a></td><td class='covered-line'><pre>2.79k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_541' href='#L_VECTOR_541'><pre>541</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_542' href='#L_VECTOR_542'><pre>542</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Try to find redundant insertvalue instructions, like the following ones:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_543' href='#L_VECTOR_543'><pre>543</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %0 = insertvalue { i8, i32 } undef, i8 %x, 0</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_544' href='#L_VECTOR_544'><pre>544</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %1 = insertvalue { i8, i32 } %0, i8 %y, 0</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_545' href='#L_VECTOR_545'><pre>545</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Here the second instruction inserts values at the same indices, as the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_546' href='#L_VECTOR_546'><pre>546</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// first one, making the first one redundant.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_547' href='#L_VECTOR_547'><pre>547</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// It should be transformed to:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_548' href='#L_VECTOR_548'><pre>548</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// %0 = insertvalue { i8, i32 } undef, i8 %y, 0</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_549' href='#L_VECTOR_549'><pre>549</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitInsertValueInst(InsertValueInst &I) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_550' href='#L_VECTOR_550'><pre>550</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> bool IsRedundant = false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_551' href='#L_VECTOR_551'><pre>551</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> ArrayRef<unsigned int> FirstIndices = I.getIndices();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_552' href='#L_VECTOR_552'><pre>552</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_553' href='#L_VECTOR_553'><pre>553</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> // If there is a chain of insertvalue instructions (each of them except the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_554' href='#L_VECTOR_554'><pre>554</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> // last one has only one use and it's another insertvalue insn from this</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_555' href='#L_VECTOR_555'><pre>555</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> // chain), check if any of the 'children' uses the same indices as the first</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_556' href='#L_VECTOR_556'><pre>556</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> // instruction. In this case, the first one is redundant.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_557' href='#L_VECTOR_557'><pre>557</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> Value *V = &I;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_558' href='#L_VECTOR_558'><pre>558</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> unsigned Depth = 0;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_559' href='#L_VECTOR_559'><pre>559</pre></a></td><td class='covered-line'><pre>36.6k</pre></td><td class='code'><pre> while (<div class='tooltip'>V->hasOneUse() && <span class='tooltip-content'>36.6k</span></div><div class='tooltip'>Depth < 10<span class='tooltip-content'>36.6k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36.6k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_560' href='#L_VECTOR_560'><pre>560</pre></a></td><td class='covered-line'><pre>36.6k</pre></td><td class='code'><pre> User *U = V->user_back();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_561' href='#L_VECTOR_561'><pre>561</pre></a></td><td class='covered-line'><pre>36.6k</pre></td><td class='code'><pre> auto UserInsInst = dyn_cast<InsertValueInst>(U);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_562' href='#L_VECTOR_562'><pre>562</pre></a></td><td class='covered-line'><pre>36.6k</pre></td><td class='code'><pre> if (<div class='tooltip'>!UserInsInst || <span class='tooltip-content'>36.6k</span></div><div class='tooltip'>U->getOperand(0) != V<span class='tooltip-content'>12.2k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_563' href='#L_VECTOR_563'><pre>563</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> break;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_564' href='#L_VECTOR_564'><pre>564</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>12.2k</span></div><div class='tooltip'>UserInsInst->getIndices() == FirstIndices<span class='tooltip-content'>12.2k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_565' href='#L_VECTOR_565'><pre>565</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> IsRedundant = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_566' href='#L_VECTOR_566'><pre>566</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_567' href='#L_VECTOR_567'><pre>567</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_568' href='#L_VECTOR_568'><pre>568</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> V = UserInsInst;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_569' href='#L_VECTOR_569'><pre>569</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> Depth++;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_570' href='#L_VECTOR_570'><pre>570</pre></a></td><td class='covered-line'><pre>12.2k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_571' href='#L_VECTOR_571'><pre>571</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_572' href='#L_VECTOR_572'><pre>572</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> if (IsRedundant)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_573' href='#L_VECTOR_573'><pre>573</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(I, I.getOperand(0))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_574' href='#L_VECTOR_574'><pre>574</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_575' href='#L_VECTOR_575'><pre>575</pre></a></td><td class='covered-line'><pre>24.4k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_576' href='#L_VECTOR_576'><pre>576</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_577' href='#L_VECTOR_577'><pre>577</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>static bool isShuffleEquivalentToSelect(ShuffleVectorInst &Shuf) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_578' href='#L_VECTOR_578'><pre>578</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int MaskSize = Shuf.getMask()->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_579' href='#L_VECTOR_579'><pre>579</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int VecSize = Shuf.getOperand(0)->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_580' href='#L_VECTOR_580'><pre>580</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_581' href='#L_VECTOR_581'><pre>581</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // A vector select does not change the size of the operands.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_582' href='#L_VECTOR_582'><pre>582</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>MaskSize != VecSize</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_583' href='#L_VECTOR_583'><pre>583</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_584' href='#L_VECTOR_584'><pre>584</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_585' href='#L_VECTOR_585'><pre>585</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Each mask element must be undefined or choose a vector element from one of</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_586' href='#L_VECTOR_586'><pre>586</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the source operands without crossing vector lanes.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_587' href='#L_VECTOR_587'><pre>587</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>for (int i = 0; </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>i != MaskSize</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_588' href='#L_VECTOR_588'><pre>588</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Elt = Shuf.getMaskValue(i);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_589' href='#L_VECTOR_589'><pre>589</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Elt != -1 && </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>Elt != i</span><span class='tooltip-content'>0</span></div><span class='red'> && </span><div class='tooltip'><span class='red'>Elt != i + VecSize</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_590' href='#L_VECTOR_590'><pre>590</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return false</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_591' href='#L_VECTOR_591'><pre>591</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_592' href='#L_VECTOR_592'><pre>592</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_593' href='#L_VECTOR_593'><pre>593</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return true</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_594' href='#L_VECTOR_594'><pre>594</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_595' href='#L_VECTOR_595'><pre>595</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_596' href='#L_VECTOR_596'><pre>596</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Turn a chain of inserts that splats a value into a canonical insert + shuffle</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_597' href='#L_VECTOR_597'><pre>597</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// splat. That is:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_598' href='#L_VECTOR_598'><pre>598</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// insertelt(insertelt(insertelt(insertelt X, %k, 0), %k, 1), %k, 2) ... -></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_599' href='#L_VECTOR_599'><pre>599</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// shufflevector(insertelt(X, %k, 0), undef, zero)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_600' href='#L_VECTOR_600'><pre>600</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre>static Instruction *foldInsSequenceIntoBroadcast(InsertElementInst &InsElt) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_601' href='#L_VECTOR_601'><pre>601</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // We are interested in the last insert in a chain. So, if this insert</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_602' href='#L_VECTOR_602'><pre>602</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // has a single user, and that user is an insert, bail.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_603' href='#L_VECTOR_603'><pre>603</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>InsElt.hasOneUse() && <span class='tooltip-content'>79.4k</span></div><div class='tooltip'>isa<InsertElementInst>(InsElt.user_back())<span class='tooltip-content'>75.5k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_604' href='#L_VECTOR_604'><pre>604</pre></a></td><td class='covered-line'><pre>37.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_605' href='#L_VECTOR_605'><pre>605</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_606' href='#L_VECTOR_606'><pre>606</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> VectorType *VT = cast<VectorType>(InsElt.getType());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_607' href='#L_VECTOR_607'><pre>607</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> int NumElements = VT->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_608' href='#L_VECTOR_608'><pre>608</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_609' href='#L_VECTOR_609'><pre>609</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // Do not try to do this for a one-element vector, since that's a nop,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_610' href='#L_VECTOR_610'><pre>610</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // and will cause an inf-loop.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_611' href='#L_VECTOR_611'><pre>611</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> if (NumElements == 1)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_612' href='#L_VECTOR_612'><pre>612</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_613' href='#L_VECTOR_613'><pre>613</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_614' href='#L_VECTOR_614'><pre>614</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> Value *SplatVal = InsElt.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_615' href='#L_VECTOR_615'><pre>615</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> InsertElementInst *CurrIE = &InsElt; </pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_616' href='#L_VECTOR_616'><pre>616</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> SmallVector<bool, 16> ElementPresent(NumElements, false);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_617' href='#L_VECTOR_617'><pre>617</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_618' href='#L_VECTOR_618'><pre>618</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // Walk the chain backwards, keeping track of which indices we inserted into,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_619' href='#L_VECTOR_619'><pre>619</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // until we hit something that isn't an insert of the splatted value.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_620' href='#L_VECTOR_620'><pre>620</pre></a></td><td class='covered-line'><pre>85.2k</pre></td><td class='code'><pre> while (<div class='tooltip'>CurrIE<span class='tooltip-content'>85.2k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>78.4k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_621' href='#L_VECTOR_621'><pre>621</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> ConstantInt *Idx = dyn_cast<ConstantInt>(CurrIE->getOperand(2));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_622' href='#L_VECTOR_622'><pre>622</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Idx || <span class='tooltip-content'>78.4k</span></div><div class='tooltip'>CurrIE->getOperand(1) != SplatVal<span class='tooltip-content'>78.4k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_623' href='#L_VECTOR_623'><pre>623</pre></a></td><td class='covered-line'><pre>34.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_624' href='#L_VECTOR_624'><pre>624</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_625' href='#L_VECTOR_625'><pre>625</pre></a></td><td class='covered-line'><pre>78.4k</pre></td><td class='code'><pre> // Check none of the intermediate steps have any additional uses.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_626' href='#L_VECTOR_626'><pre>626</pre></a></td><td class='covered-line'><pre>43.7k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>43.7k</span></div><div class='tooltip'>(CurrIE != &InsElt) && <span class='tooltip-content'>43.7k</span></div><div class='tooltip'>!CurrIE->hasOneUse()<span class='tooltip-content'>1.96k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_627' href='#L_VECTOR_627'><pre>627</pre></a></td><td class='covered-line'><pre>188</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_628' href='#L_VECTOR_628'><pre>628</pre></a></td><td class='covered-line'><pre>43.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_629' href='#L_VECTOR_629'><pre>629</pre></a></td><td class='covered-line'><pre>43.5k</pre></td><td class='code'><pre> ElementPresent[Idx->getZExtValue()] = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_630' href='#L_VECTOR_630'><pre>630</pre></a></td><td class='covered-line'><pre>43.5k</pre></td><td class='code'><pre> CurrIE = dyn_cast<InsertElementInst>(CurrIE->getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_631' href='#L_VECTOR_631'><pre>631</pre></a></td><td class='covered-line'><pre>43.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_632' href='#L_VECTOR_632'><pre>632</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_633' href='#L_VECTOR_633'><pre>633</pre></a></td><td class='covered-line'><pre>41.7k</pre></td><td class='code'><pre> // Make sure we've seen an insert into every element.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_634' href='#L_VECTOR_634'><pre>634</pre></a></td><td class='covered-line'><pre>13.6k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.79k</span></div><div class='tooltip'>llvm::any_of(ElementPresent, [](bool Present) <span class='tooltip-content'>6.79k</span></div><div class='tooltip'>{ return !Present; }<span class='tooltip-content'>13.6k</span></div>))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_635' href='#L_VECTOR_635'><pre>635</pre></a></td><td class='covered-line'><pre>5.23k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_636' href='#L_VECTOR_636'><pre>636</pre></a></td><td class='covered-line'><pre>6.79k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_637' href='#L_VECTOR_637'><pre>637</pre></a></td><td class='covered-line'><pre>6.79k</pre></td><td class='code'><pre> // All right, create the insert + shuffle.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_638' href='#L_VECTOR_638'><pre>638</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> Instruction *InsertFirst = InsertElementInst::Create(</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_639' href='#L_VECTOR_639'><pre>639</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> UndefValue::get(VT), SplatVal,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_640' href='#L_VECTOR_640'><pre>640</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> ConstantInt::get(Type::getInt32Ty(InsElt.getContext()), 0), "", &InsElt);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_641' href='#L_VECTOR_641'><pre>641</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_642' href='#L_VECTOR_642'><pre>642</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> Constant *ZeroMask = ConstantAggregateZero::get(</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_643' href='#L_VECTOR_643'><pre>643</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> VectorType::get(Type::getInt32Ty(InsElt.getContext()), NumElements));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_644' href='#L_VECTOR_644'><pre>644</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_645' href='#L_VECTOR_645'><pre>645</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> return new ShuffleVectorInst(InsertFirst, UndefValue::get(VT), ZeroMask);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_646' href='#L_VECTOR_646'><pre>646</pre></a></td><td class='covered-line'><pre>6.79k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_647' href='#L_VECTOR_647'><pre>647</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_648' href='#L_VECTOR_648'><pre>648</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// insertelt (shufflevector X, CVec, Mask|insertelt X, C1, CIndex1), C, CIndex</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_649' href='#L_VECTOR_649'><pre>649</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// --> shufflevector X, CVec', Mask'</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_650' href='#L_VECTOR_650'><pre>650</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre>static Instruction *foldConstantInsEltIntoShuffle(InsertElementInst &InsElt) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_651' href='#L_VECTOR_651'><pre>651</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> auto *Inst = dyn_cast<Instruction>(InsElt.getOperand(0));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_652' href='#L_VECTOR_652'><pre>652</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // Bail out if the parent has more than one use. In that case, we'd be</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_653' href='#L_VECTOR_653'><pre>653</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // replacing the insertelt with a shuffle, and that's not a clear win.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_654' href='#L_VECTOR_654'><pre>654</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> if (<div class='tooltip'>!Inst || <span class='tooltip-content'>79.4k</span></div><div class='tooltip'>!Inst->hasOneUse()<span class='tooltip-content'>37.8k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_655' href='#L_VECTOR_655'><pre>655</pre></a></td><td class='covered-line'><pre>42.6k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_656' href='#L_VECTOR_656'><pre>656</pre></a></td><td class='covered-line'><pre>36.8k</pre></td><td class='code'><pre> <div class='tooltip'>if (auto *<span class='tooltip-content'>36.8k</span></div><div class='tooltip'>Shuf<span class='tooltip-content'>36.8k</span></div> = dyn_cast<ShuffleVectorInst>(InsElt.getOperand(0))) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_657' href='#L_VECTOR_657'><pre>657</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // The shuffle must have a constant vector operand. The insertelt must have</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_658' href='#L_VECTOR_658'><pre>658</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // a constant scalar being inserted at a constant position in the vector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_659' href='#L_VECTOR_659'><pre>659</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> Constant *ShufConstVec, *InsEltScalar;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_660' href='#L_VECTOR_660'><pre>660</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> uint64_t InsEltIndex;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_661' href='#L_VECTOR_661'><pre>661</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (!match(Shuf->getOperand(1), m_Constant(ShufConstVec)) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_662' href='#L_VECTOR_662'><pre>662</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> !match(InsElt.getOperand(1), m_Constant(InsEltScalar)) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_663' href='#L_VECTOR_663'><pre>663</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>!match(InsElt.getOperand(2), m_ConstantInt(InsEltIndex))</span>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_664' href='#L_VECTOR_664'><pre>664</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_665' href='#L_VECTOR_665'><pre>665</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_666' href='#L_VECTOR_666'><pre>666</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // Adding an element to an arbitrary shuffle could be expensive, but a</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_667' href='#L_VECTOR_667'><pre>667</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // shuffle that selects elements from vectors without crossing lanes is</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_668' href='#L_VECTOR_668'><pre>668</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // assumed cheap.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_669' href='#L_VECTOR_669'><pre>669</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // If we're just adding a constant into that shuffle, it will still be</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_670' href='#L_VECTOR_670'><pre>670</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> // cheap.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_671' href='#L_VECTOR_671'><pre>671</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!isShuffleEquivalentToSelect(*Shuf)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_672' href='#L_VECTOR_672'><pre>672</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return nullptr</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_673' href='#L_VECTOR_673'><pre>673</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_674' href='#L_VECTOR_674'><pre>674</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // From the above 'select' check, we know that the mask has the same number</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_675' href='#L_VECTOR_675'><pre>675</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // of elements as the vector input operands. We also know that each constant</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_676' href='#L_VECTOR_676'><pre>676</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // input element is used in its lane and can not be used more than once by</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_677' href='#L_VECTOR_677'><pre>677</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // the shuffle. Therefore, replace the constant in the shuffle's constant</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_678' href='#L_VECTOR_678'><pre>678</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // vector with the insertelt constant. Replace the constant in the shuffle's</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_679' href='#L_VECTOR_679'><pre>679</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // mask vector with the insertelt index plus the length of the vector</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_680' href='#L_VECTOR_680'><pre>680</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // (because the constant vector operand of a shuffle is always the 2nd</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_681' href='#L_VECTOR_681'><pre>681</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // operand).</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_682' href='#L_VECTOR_682'><pre>682</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Constant *Mask = Shuf->getMask();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_683' href='#L_VECTOR_683'><pre>683</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned NumElts = Mask->getType()->getVectorNumElements();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_684' href='#L_VECTOR_684'><pre>684</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> NewShufElts(NumElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_685' href='#L_VECTOR_685'><pre>685</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> NewMaskElts(NumElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_686' href='#L_VECTOR_686'><pre>686</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0; </span><div class='tooltip'><span class='red'>I != NumElts</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++I</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_687' href='#L_VECTOR_687'><pre>687</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>I == InsEltIndex</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_688' href='#L_VECTOR_688'><pre>688</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewShufElts[I] = InsEltScalar;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_689' href='#L_VECTOR_689'><pre>689</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *Int32Ty = Type::getInt32Ty(Shuf->getContext());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_690' href='#L_VECTOR_690'><pre>690</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewMaskElts[I] = ConstantInt::get(Int32Ty, InsEltIndex + NumElts);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_691' href='#L_VECTOR_691'><pre>691</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'> else </span><span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_692' href='#L_VECTOR_692'><pre>692</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Copy over the existing values.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_693' href='#L_VECTOR_693'><pre>693</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewShufElts[I] = ShufConstVec->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_694' href='#L_VECTOR_694'><pre>694</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewMaskElts[I] = Mask->getAggregateElement(I);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_695' href='#L_VECTOR_695'><pre>695</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_696' href='#L_VECTOR_696'><pre>696</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_697' href='#L_VECTOR_697'><pre>697</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_698' href='#L_VECTOR_698'><pre>698</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Create new operands for a shuffle that includes the constant of the</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_699' href='#L_VECTOR_699'><pre>699</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // original insertelt. The old shuffle will be dead now.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_700' href='#L_VECTOR_700'><pre>700</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return new ShuffleVectorInst(Shuf->getOperand(0),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_701' href='#L_VECTOR_701'><pre>701</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(NewShufElts),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_702' href='#L_VECTOR_702'><pre>702</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(NewMaskElts))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_703' href='#L_VECTOR_703'><pre>703</pre></a></td><td class='covered-line'><pre>36.8k</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (auto *<span class='tooltip-content'>36.8k</span></div><div class='tooltip'>IEI<span class='tooltip-content'>36.8k</span></div> = dyn_cast<InsertElementInst>(Inst)) <div class='tooltip'>{<span class='tooltip-content'>36.7k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_704' href='#L_VECTOR_704'><pre>704</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> // Transform sequences of insertelements ops with constant data/indexes into</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_705' href='#L_VECTOR_705'><pre>705</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> // a single shuffle op.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_706' href='#L_VECTOR_706'><pre>706</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> unsigned NumElts = InsElt.getType()->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_707' href='#L_VECTOR_707'><pre>707</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_708' href='#L_VECTOR_708'><pre>708</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> uint64_t InsertIdx[2];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_709' href='#L_VECTOR_709'><pre>709</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> Constant *Val[2];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_710' href='#L_VECTOR_710'><pre>710</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> if (!match(InsElt.getOperand(2), m_ConstantInt(InsertIdx[0])) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_711' href='#L_VECTOR_711'><pre>711</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> !match(InsElt.getOperand(1), m_Constant(Val[0])) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_712' href='#L_VECTOR_712'><pre>712</pre></a></td><td class='covered-line'><pre>14.1k</pre></td><td class='code'><pre> !match(IEI->getOperand(2), m_ConstantInt(InsertIdx[1])) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_713' href='#L_VECTOR_713'><pre>713</pre></a></td><td class='covered-line'><pre>14.1k</pre></td><td class='code'><pre> !match(IEI->getOperand(1), m_Constant(Val[1])))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_714' href='#L_VECTOR_714'><pre>714</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_715' href='#L_VECTOR_715'><pre>715</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> SmallVector<Constant *, 16> Values(NumElts);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_716' href='#L_VECTOR_716'><pre>716</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> SmallVector<Constant *, 16> Mask(NumElts);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_717' href='#L_VECTOR_717'><pre>717</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> auto ValI = std::begin(Val);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_718' href='#L_VECTOR_718'><pre>718</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // Generate new constant vector and mask.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_719' href='#L_VECTOR_719'><pre>719</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // We have 2 values/masks from the insertelements instructions. Insert them</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_720' href='#L_VECTOR_720'><pre>720</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // into new value/mask vectors.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_721' href='#L_VECTOR_721'><pre>721</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> for (uint64_t I : InsertIdx) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_722' href='#L_VECTOR_722'><pre>722</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> if (<div class='tooltip'>!Values[I]<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_723' href='#L_VECTOR_723'><pre>723</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> assert(!Mask[I]);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_724' href='#L_VECTOR_724'><pre>724</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> Values[I] = *ValI;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_725' href='#L_VECTOR_725'><pre>725</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> Mask[I] = ConstantInt::get(Type::getInt32Ty(InsElt.getContext()),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_726' href='#L_VECTOR_726'><pre>726</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> NumElts + I);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_727' href='#L_VECTOR_727'><pre>727</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_728' href='#L_VECTOR_728'><pre>728</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> ++ValI;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_729' href='#L_VECTOR_729'><pre>729</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_730' href='#L_VECTOR_730'><pre>730</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // Remaining values are filled with 'undef' values.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_731' href='#L_VECTOR_731'><pre>731</pre></a></td><td class='covered-line'><pre>54</pre></td><td class='code'><pre> for (unsigned I = 0; <div class='tooltip'>I < NumElts<span class='tooltip-content'>54</span></div>; <div class='tooltip'>++I<span class='tooltip-content'>36</span></div>) <div class='tooltip'>{<span class='tooltip-content'>36</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_732' href='#L_VECTOR_732'><pre>732</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> if (<div class='tooltip'>!Values[I]<span class='tooltip-content'>36</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_733' href='#L_VECTOR_733'><pre>733</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(!Mask[I]);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_734' href='#L_VECTOR_734'><pre>734</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Values[I] = UndefValue::get(InsElt.getType()->getElementType());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_735' href='#L_VECTOR_735'><pre>735</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask[I] = ConstantInt::get(Type::getInt32Ty(InsElt.getContext()), I);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_736' href='#L_VECTOR_736'><pre>736</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_737' href='#L_VECTOR_737'><pre>737</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_738' href='#L_VECTOR_738'><pre>738</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // Create new operands for a shuffle that includes the constant of the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_739' href='#L_VECTOR_739'><pre>739</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> // original insertelt.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_740' href='#L_VECTOR_740'><pre>740</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> return new ShuffleVectorInst(IEI->getOperand(0),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_741' href='#L_VECTOR_741'><pre>741</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> ConstantVector::get(Values),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_742' href='#L_VECTOR_742'><pre>742</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> ConstantVector::get(Mask));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_743' href='#L_VECTOR_743'><pre>743</pre></a></td><td class='covered-line'><pre>36.7k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_744' href='#L_VECTOR_744'><pre>744</pre></a></td><td class='covered-line'><pre>39</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_745' href='#L_VECTOR_745'><pre>745</pre></a></td><td class='covered-line'><pre>36.8k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_746' href='#L_VECTOR_746'><pre>746</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_747' href='#L_VECTOR_747'><pre>747</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_748' href='#L_VECTOR_748'><pre>748</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> Value *VecOp = IE.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_749' href='#L_VECTOR_749'><pre>749</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> Value *ScalarOp = IE.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_750' href='#L_VECTOR_750'><pre>750</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> Value *IdxOp = IE.getOperand(2);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_751' href='#L_VECTOR_751'><pre>751</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_752' href='#L_VECTOR_752'><pre>752</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> // Inserting an undef or into an undefined place, remove this.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_753' href='#L_VECTOR_753'><pre>753</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(ScalarOp) || <span class='tooltip-content'>80.9k</span></div><div class='tooltip'>isa<UndefValue>(IdxOp)<span class='tooltip-content'>80.9k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_754' href='#L_VECTOR_754'><pre>754</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>replaceInstUsesWith(IE, VecOp)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_755' href='#L_VECTOR_755'><pre>755</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_756' href='#L_VECTOR_756'><pre>756</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> // If the inserted element was extracted from some other vector, and if the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_757' href='#L_VECTOR_757'><pre>757</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> // indexes are constant, try to turn this into a shufflevector operation.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_758' href='#L_VECTOR_758'><pre>758</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre> if (ExtractElementInst *<div class='tooltip'>EI<span class='tooltip-content'>80.9k</span></div> = dyn_cast<ExtractElementInst>(ScalarOp)) <div class='tooltip'>{<span class='tooltip-content'>3.17k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_759' href='#L_VECTOR_759'><pre>759</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<ConstantInt>(EI->getOperand(1)) && <span class='tooltip-content'>3.17k</span></div><div class='tooltip'>isa<ConstantInt>(IdxOp)<span class='tooltip-content'>3.17k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>3.17k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_760' href='#L_VECTOR_760'><pre>760</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> unsigned NumInsertVectorElts = IE.getType()->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_761' href='#L_VECTOR_761'><pre>761</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> unsigned NumExtractVectorElts =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_762' href='#L_VECTOR_762'><pre>762</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> EI->getOperand(0)->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_763' href='#L_VECTOR_763'><pre>763</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> unsigned ExtractedIdx =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_764' href='#L_VECTOR_764'><pre>764</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> cast<ConstantInt>(EI->getOperand(1))->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_765' href='#L_VECTOR_765'><pre>765</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> unsigned InsertedIdx = cast<ConstantInt>(IdxOp)->getZExtValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_766' href='#L_VECTOR_766'><pre>766</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_767' href='#L_VECTOR_767'><pre>767</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> if (ExtractedIdx >= NumExtractVectorElts) // Out of range extract.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_768' href='#L_VECTOR_768'><pre>768</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(IE, VecOp)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_769' href='#L_VECTOR_769'><pre>769</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_770' href='#L_VECTOR_770'><pre>770</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.17k</span></div><div class='tooltip'>InsertedIdx >= NumInsertVectorElts<span class='tooltip-content'>3.17k</span></div>) // Out of range insert.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_771' href='#L_VECTOR_771'><pre>771</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(IE, UndefValue::get(IE.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_772' href='#L_VECTOR_772'><pre>772</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_773' href='#L_VECTOR_773'><pre>773</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> // If we are extracting a value from a vector, then inserting it right</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_774' href='#L_VECTOR_774'><pre>774</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> // back into the same place, just use the input vector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_775' href='#L_VECTOR_775'><pre>775</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.17k</span></div><div class='tooltip'>EI->getOperand(0) == VecOp && <span class='tooltip-content'>3.17k</span></div><div class='tooltip'>ExtractedIdx == InsertedIdx<span class='tooltip-content'>20</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_776' href='#L_VECTOR_776'><pre>776</pre></a></td><td class='covered-line'><pre>11</pre></td><td class='code'><pre> return replaceInstUsesWith(IE, VecOp);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_777' href='#L_VECTOR_777'><pre>777</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_778' href='#L_VECTOR_778'><pre>778</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> // If this insertelement isn't used by some other insertelement, turn it</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_779' href='#L_VECTOR_779'><pre>779</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> // (and any insertelements it points to), into one big shuffle.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_780' href='#L_VECTOR_780'><pre>780</pre></a></td><td class='covered-line'><pre>3.16k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>3.16k</span></div><div class='tooltip'>!IE.hasOneUse() || <span class='tooltip-content'>3.16k</span></div><div class='tooltip'>!isa<InsertElementInst>(IE.user_back())<span class='tooltip-content'>3.04k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.42k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_781' href='#L_VECTOR_781'><pre>781</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> SmallVector<Constant*, 16> Mask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_782' href='#L_VECTOR_782'><pre>782</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> ShuffleOps LR = collectShuffleElements(&IE, Mask, nullptr, *this);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_783' href='#L_VECTOR_783'><pre>783</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_784' href='#L_VECTOR_784'><pre>784</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> // The proposed shuffle may be trivial, in which case we shouldn't</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_785' href='#L_VECTOR_785'><pre>785</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> // perform the combine.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_786' href='#L_VECTOR_786'><pre>786</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> if (<div class='tooltip'>LR.first != &IE && <span class='tooltip-content'>1.42k</span></div><div class='tooltip'>LR.second != &IE<span class='tooltip-content'>1.42k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.42k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_787' href='#L_VECTOR_787'><pre>787</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> // We now have a shuffle of LHS, RHS, Mask.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_788' href='#L_VECTOR_788'><pre>788</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> if (LR.second == nullptr)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_789' href='#L_VECTOR_789'><pre>789</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LR.second = UndefValue::get(LR.first->getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_790' href='#L_VECTOR_790'><pre>790</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> return new ShuffleVectorInst(LR.first, LR.second,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_791' href='#L_VECTOR_791'><pre>791</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> ConstantVector::get(Mask));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_792' href='#L_VECTOR_792'><pre>792</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_793' href='#L_VECTOR_793'><pre>793</pre></a></td><td class='covered-line'><pre>1.42k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_794' href='#L_VECTOR_794'><pre>794</pre></a></td><td class='covered-line'><pre>3.16k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_795' href='#L_VECTOR_795'><pre>795</pre></a></td><td class='covered-line'><pre>3.17k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_796' href='#L_VECTOR_796'><pre>796</pre></a></td><td class='covered-line'><pre>80.9k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_797' href='#L_VECTOR_797'><pre>797</pre></a></td><td class='covered-line'><pre>79.5k</pre></td><td class='code'><pre> unsigned VWidth = VecOp->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_798' href='#L_VECTOR_798'><pre>798</pre></a></td><td class='covered-line'><pre>79.5k</pre></td><td class='code'><pre> APInt UndefElts(VWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_799' href='#L_VECTOR_799'><pre>799</pre></a></td><td class='covered-line'><pre>79.5k</pre></td><td class='code'><pre> APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_800' href='#L_VECTOR_800'><pre>800</pre></a></td><td class='covered-line'><pre>79.5k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>79.5k</span></div> = SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts)) <div class='tooltip'>{<span class='tooltip-content'>74</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_801' href='#L_VECTOR_801'><pre>801</pre></a></td><td class='covered-line'><pre>74</pre></td><td class='code'><pre> if (V != &IE)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_802' href='#L_VECTOR_802'><pre>802</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(IE, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_803' href='#L_VECTOR_803'><pre>803</pre></a></td><td class='covered-line'><pre>74</pre></td><td class='code'><pre> return &IE;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_804' href='#L_VECTOR_804'><pre>804</pre></a></td><td class='covered-line'><pre>74</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_805' href='#L_VECTOR_805'><pre>805</pre></a></td><td class='covered-line'><pre>79.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_806' href='#L_VECTOR_806'><pre>806</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>79.4k</span></div><div class='tooltip'>Shuf<span class='tooltip-content'>79.4k</span></div> = foldConstantInsEltIntoShuffle(IE))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_807' href='#L_VECTOR_807'><pre>807</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> return Shuf;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_808' href='#L_VECTOR_808'><pre>808</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_809' href='#L_VECTOR_809'><pre>809</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // Turn a sequence of inserts that broadcasts a scalar into a single</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_810' href='#L_VECTOR_810'><pre>810</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> // insert + shufflevector.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_811' href='#L_VECTOR_811'><pre>811</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre> <div class='tooltip'>if (Instruction *<span class='tooltip-content'>79.4k</span></div><div class='tooltip'>Broadcast<span class='tooltip-content'>79.4k</span></div> = foldInsSequenceIntoBroadcast(IE))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_812' href='#L_VECTOR_812'><pre>812</pre></a></td><td class='covered-line'><pre>1.56k</pre></td><td class='code'><pre> return Broadcast;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_813' href='#L_VECTOR_813'><pre>813</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_814' href='#L_VECTOR_814'><pre>814</pre></a></td><td class='covered-line'><pre>77.8k</pre></td><td class='code'><pre> return nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_815' href='#L_VECTOR_815'><pre>815</pre></a></td><td class='covered-line'><pre>79.4k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_816' href='#L_VECTOR_816'><pre>816</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_817' href='#L_VECTOR_817'><pre>817</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Return true if we can evaluate the specified expression tree if the vector</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_818' href='#L_VECTOR_818'><pre>818</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// elements were shuffled in a different order.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_819' href='#L_VECTOR_819'><pre>819</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool CanEvaluateShuffled(Value *V, ArrayRef<int> Mask,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_820' href='#L_VECTOR_820'><pre>820</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> unsigned Depth = 5) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_821' href='#L_VECTOR_821'><pre>821</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> // We can always reorder the elements of a constant.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_822' href='#L_VECTOR_822'><pre>822</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> if (isa<Constant>(V))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_823' href='#L_VECTOR_823'><pre>823</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_824' href='#L_VECTOR_824'><pre>824</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_825' href='#L_VECTOR_825'><pre>825</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> // We won't reorder vector arguments. No IPO here.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_826' href='#L_VECTOR_826'><pre>826</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> Instruction *I = dyn_cast<Instruction>(V);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_827' href='#L_VECTOR_827'><pre>827</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> if (<div class='tooltip'>!I<span class='tooltip-content'>6.36k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_828' href='#L_VECTOR_828'><pre>828</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_829' href='#L_VECTOR_829'><pre>829</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> // Two users may expect different orders of the elements. Don't try it.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_830' href='#L_VECTOR_830'><pre>830</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>6.36k</span></div><div class='tooltip'>!I->hasOneUse()<span class='tooltip-content'>6.36k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_831' href='#L_VECTOR_831'><pre>831</pre></a></td><td class='covered-line'><pre>1.16k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_832' href='#L_VECTOR_832'><pre>832</pre></a></td><td class='covered-line'><pre>6.36k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_833' href='#L_VECTOR_833'><pre>833</pre></a></td><td class='covered-line'><pre>5.19k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5.19k</span></div><div class='tooltip'>Depth == 0<span class='tooltip-content'>5.19k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_834' href='#L_VECTOR_834'><pre>834</pre></a></td><td class='covered-line'><pre>5.19k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_835' href='#L_VECTOR_835'><pre>835</pre></a></td><td class='covered-line'><pre>5.19k</pre></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_836' href='#L_VECTOR_836'><pre>836</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_837' href='#L_VECTOR_837'><pre>837</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FAdd:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_838' href='#L_VECTOR_838'><pre>838</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_839' href='#L_VECTOR_839'><pre>839</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FSub:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_840' href='#L_VECTOR_840'><pre>840</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_841' href='#L_VECTOR_841'><pre>841</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FMul:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_842' href='#L_VECTOR_842'><pre>842</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_843' href='#L_VECTOR_843'><pre>843</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::SDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_844' href='#L_VECTOR_844'><pre>844</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_845' href='#L_VECTOR_845'><pre>845</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::URem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_846' href='#L_VECTOR_846'><pre>846</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::SRem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_847' href='#L_VECTOR_847'><pre>847</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FRem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_848' href='#L_VECTOR_848'><pre>848</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_849' href='#L_VECTOR_849'><pre>849</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_850' href='#L_VECTOR_850'><pre>850</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_851' href='#L_VECTOR_851'><pre>851</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_852' href='#L_VECTOR_852'><pre>852</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_853' href='#L_VECTOR_853'><pre>853</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Xor:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_854' href='#L_VECTOR_854'><pre>854</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::ICmp:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_855' href='#L_VECTOR_855'><pre>855</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FCmp:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_856' href='#L_VECTOR_856'><pre>856</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::Trunc:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_857' href='#L_VECTOR_857'><pre>857</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::ZExt:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_858' href='#L_VECTOR_858'><pre>858</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::SExt:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_859' href='#L_VECTOR_859'><pre>859</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FPToUI:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_860' href='#L_VECTOR_860'><pre>860</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FPToSI:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_861' href='#L_VECTOR_861'><pre>861</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::UIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_862' href='#L_VECTOR_862'><pre>862</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::SIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_863' href='#L_VECTOR_863'><pre>863</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FPTrunc:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_864' href='#L_VECTOR_864'><pre>864</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::FPExt:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_865' href='#L_VECTOR_865'><pre>865</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> case Instruction::GetElementPtr: {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_866' href='#L_VECTOR_866'><pre>866</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> for (Value *Operand : I->operands()) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_867' href='#L_VECTOR_867'><pre>867</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> if (!CanEvaluateShuffled(Operand, Mask, Depth-1))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_868' href='#L_VECTOR_868'><pre>868</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_869' href='#L_VECTOR_869'><pre>869</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_870' href='#L_VECTOR_870'><pre>870</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return true</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_871' href='#L_VECTOR_871'><pre>871</pre></a></td><td class='covered-line'><pre>16</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_872' href='#L_VECTOR_872'><pre>872</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> case Instruction::InsertElement: {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_873' href='#L_VECTOR_873'><pre>873</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(2));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_874' href='#L_VECTOR_874'><pre>874</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> if (<div class='tooltip'>!CI<span class='tooltip-content'>5.18k</span></div>) <div class='tooltip'><span class='red'>return false</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_875' href='#L_VECTOR_875'><pre>875</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> int ElementNumber = CI->getLimitedValue();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_876' href='#L_VECTOR_876'><pre>876</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_877' href='#L_VECTOR_877'><pre>877</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> // Verify that 'CI' does not occur twice in Mask. A single 'insertelement'</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_878' href='#L_VECTOR_878'><pre>878</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> // can't put an element into multiple indices.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_879' href='#L_VECTOR_879'><pre>879</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> bool SeenOnce = false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_880' href='#L_VECTOR_880'><pre>880</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> for (int i = 0, e = Mask.size(); <div class='tooltip'>i != e<span class='tooltip-content'>10.3k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>5.18k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_881' href='#L_VECTOR_881'><pre>881</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask[i] == ElementNumber<span class='tooltip-content'>10.3k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>10.3k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_882' href='#L_VECTOR_882'><pre>882</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> if (SeenOnce)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_883' href='#L_VECTOR_883'><pre>883</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_884' href='#L_VECTOR_884'><pre>884</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> SeenOnce = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_885' href='#L_VECTOR_885'><pre>885</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_886' href='#L_VECTOR_886'><pre>886</pre></a></td><td class='covered-line'><pre>10.3k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_887' href='#L_VECTOR_887'><pre>887</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return CanEvaluateShuffled(I->getOperand(0), Mask, Depth-1)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_888' href='#L_VECTOR_888'><pre>888</pre></a></td><td class='covered-line'><pre>5.18k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_889' href='#L_VECTOR_889'><pre>889</pre></a></td><td class='covered-line'><pre>5.19k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_890' href='#L_VECTOR_890'><pre>890</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_891' href='#L_VECTOR_891'><pre>891</pre></a></td><td class='covered-line'><pre>5.19k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_892' href='#L_VECTOR_892'><pre>892</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_893' href='#L_VECTOR_893'><pre>893</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// Rebuild a new instruction just like 'I' but with the new operands given.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_894' href='#L_VECTOR_894'><pre>894</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>/// In the event of type mismatch, the type of the operands is correct.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_895' href='#L_VECTOR_895'><pre>895</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static Value *buildNew(Instruction *I, ArrayRef<Value*> NewOps) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_896' href='#L_VECTOR_896'><pre>896</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // We don't want to use the IRBuilder here because we want the replacement</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_897' href='#L_VECTOR_897'><pre>897</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // instructions to appear next to 'I', not the builder's insertion point.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_898' href='#L_VECTOR_898'><pre>898</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> switch (I->getOpcode()) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_899' href='#L_VECTOR_899'><pre>899</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Add:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_900' href='#L_VECTOR_900'><pre>900</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FAdd:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_901' href='#L_VECTOR_901'><pre>901</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Sub:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_902' href='#L_VECTOR_902'><pre>902</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FSub:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_903' href='#L_VECTOR_903'><pre>903</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Mul:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_904' href='#L_VECTOR_904'><pre>904</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FMul:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_905' href='#L_VECTOR_905'><pre>905</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::UDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_906' href='#L_VECTOR_906'><pre>906</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::SDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_907' href='#L_VECTOR_907'><pre>907</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FDiv:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_908' href='#L_VECTOR_908'><pre>908</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::URem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_909' href='#L_VECTOR_909'><pre>909</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::SRem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_910' href='#L_VECTOR_910'><pre>910</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FRem:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_911' href='#L_VECTOR_911'><pre>911</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Shl:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_912' href='#L_VECTOR_912'><pre>912</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::LShr:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_913' href='#L_VECTOR_913'><pre>913</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::AShr:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_914' href='#L_VECTOR_914'><pre>914</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::And:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_915' href='#L_VECTOR_915'><pre>915</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Or:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_916' href='#L_VECTOR_916'><pre>916</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Xor: {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_917' href='#L_VECTOR_917'><pre>917</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *BO = cast<BinaryOperator>(I);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_918' href='#L_VECTOR_918'><pre>918</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert(NewOps.size() == 2 && "binary operator with #ops != 2");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_919' href='#L_VECTOR_919'><pre>919</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator *New =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_920' href='#L_VECTOR_920'><pre>920</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> BinaryOperator::Create(cast<BinaryOperator>(I)->getOpcode(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_921' href='#L_VECTOR_921'><pre>921</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NewOps[0], NewOps[1], "", BO);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_922' href='#L_VECTOR_922'><pre>922</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if (isa<OverflowingBinaryOperator>(BO)) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_923' href='#L_VECTOR_923'><pre>923</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> New->setHasNoUnsignedWrap(BO->hasNoUnsignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_924' href='#L_VECTOR_924'><pre>924</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> New->setHasNoSignedWrap(BO->hasNoSignedWrap());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_925' href='#L_VECTOR_925'><pre>925</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_926' href='#L_VECTOR_926'><pre>926</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if (isa<PossiblyExactOperator>(BO)) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_927' href='#L_VECTOR_927'><pre>927</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> New->setIsExact(BO->isExact());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_928' href='#L_VECTOR_928'><pre>928</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_929' href='#L_VECTOR_929'><pre>929</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> if (isa<FPMathOperator>(BO))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_930' href='#L_VECTOR_930'><pre>930</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> New->copyFastMathFlags(I);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_931' href='#L_VECTOR_931'><pre>931</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return New;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_932' href='#L_VECTOR_932'><pre>932</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_933' href='#L_VECTOR_933'><pre>933</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::ICmp:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_934' href='#L_VECTOR_934'><pre>934</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert(NewOps.size() == 2 && "icmp with #ops != 2");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_935' href='#L_VECTOR_935'><pre>935</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return new ICmpInst(I, cast<ICmpInst>(I)->getPredicate(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_936' href='#L_VECTOR_936'><pre>936</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NewOps[0], NewOps[1]);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_937' href='#L_VECTOR_937'><pre>937</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FCmp:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_938' href='#L_VECTOR_938'><pre>938</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert(NewOps.size() == 2 && "fcmp with #ops != 2");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_939' href='#L_VECTOR_939'><pre>939</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return new FCmpInst(I, cast<FCmpInst>(I)->getPredicate(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_940' href='#L_VECTOR_940'><pre>940</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NewOps[0], NewOps[1]);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_941' href='#L_VECTOR_941'><pre>941</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::Trunc:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_942' href='#L_VECTOR_942'><pre>942</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::ZExt:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_943' href='#L_VECTOR_943'><pre>943</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::SExt:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_944' href='#L_VECTOR_944'><pre>944</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FPToUI:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_945' href='#L_VECTOR_945'><pre>945</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FPToSI:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_946' href='#L_VECTOR_946'><pre>946</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::UIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_947' href='#L_VECTOR_947'><pre>947</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::SIToFP:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_948' href='#L_VECTOR_948'><pre>948</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FPTrunc:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_949' href='#L_VECTOR_949'><pre>949</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::FPExt: {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_950' href='#L_VECTOR_950'><pre>950</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // It's possible that the mask has a different number of elements from</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_951' href='#L_VECTOR_951'><pre>951</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> // the original cast. We recompute the destination type to match the mask.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_952' href='#L_VECTOR_952'><pre>952</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Type *DestTy =</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_953' href='#L_VECTOR_953'><pre>953</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> VectorType::get(I->getType()->getScalarType(),</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_954' href='#L_VECTOR_954'><pre>954</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> NewOps[0]->getType()->getVectorNumElements());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_955' href='#L_VECTOR_955'><pre>955</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> assert(NewOps.size() == 1 && "cast with #ops != 1");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_956' href='#L_VECTOR_956'><pre>956</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return CastInst::Create(cast<CastInst>(I)->getOpcode(), NewOps[0], DestTy,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_957' href='#L_VECTOR_957'><pre>957</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> "", I);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_958' href='#L_VECTOR_958'><pre>958</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_959' href='#L_VECTOR_959'><pre>959</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> case Instruction::GetElementPtr: {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_960' href='#L_VECTOR_960'><pre>960</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> Value *Ptr = NewOps[0];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_961' href='#L_VECTOR_961'><pre>961</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> ArrayRef<Value*> Idx = NewOps.slice(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_962' href='#L_VECTOR_962'><pre>962</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> GetElementPtrInst *GEP = GetElementPtrInst::Create(</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_963' href='#L_VECTOR_963'><pre>963</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> cast<GetElementPtrInst>(I)->getSourceElementType(), Ptr, Idx, "", I);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_964' href='#L_VECTOR_964'><pre>964</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> GEP->setIsInBounds(cast<GetElementPtrInst>(I)->isInBounds());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_965' href='#L_VECTOR_965'><pre>965</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> return GEP;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_966' href='#L_VECTOR_966'><pre>966</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_967' href='#L_VECTOR_967'><pre>967</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_968' href='#L_VECTOR_968'><pre>968</pre></a></td><td class='uncovered-line'></td><td class='code'><pre> llvm_unreachable("failed to rebuild vector instructions");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_969' href='#L_VECTOR_969'><pre>969</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_970' href='#L_VECTOR_970'><pre>970</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_971' href='#L_VECTOR_971'><pre>971</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>Value *</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_972' href='#L_VECTOR_972'><pre>972</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre>InstCombiner::EvaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_973' href='#L_VECTOR_973'><pre>973</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Mask.size() does not need to be equal to the number of vector elements.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_974' href='#L_VECTOR_974'><pre>974</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_975' href='#L_VECTOR_975'><pre>975</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(V->getType()->isVectorTy() && "can't reorder non-vector elements");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_976' href='#L_VECTOR_976'><pre>976</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>isa<UndefValue>(V)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_977' href='#L_VECTOR_977'><pre>977</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return UndefValue::get(VectorType::get(V->getType()->getScalarType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_978' href='#L_VECTOR_978'><pre>978</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.size()));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_979' href='#L_VECTOR_979'><pre>979</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_980' href='#L_VECTOR_980'><pre>980</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>isa<ConstantAggregateZero>(V)</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_981' href='#L_VECTOR_981'><pre>981</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantAggregateZero::get(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_982' href='#L_VECTOR_982'><pre>982</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> VectorType::get(V->getType()->getScalarType(),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_983' href='#L_VECTOR_983'><pre>983</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask.size()));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_984' href='#L_VECTOR_984'><pre>984</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_985' href='#L_VECTOR_985'><pre>985</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (Constant *</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>C</span><span class='tooltip-content'>0</span></div><span class='red'> = dyn_cast<Constant>(V)) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_986' href='#L_VECTOR_986'><pre>986</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> MaskValues;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_987' href='#L_VECTOR_987'><pre>987</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 0, e = Mask.size(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_988' href='#L_VECTOR_988'><pre>988</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>Mask[i] == -1</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_989' href='#L_VECTOR_989'><pre>989</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>MaskValues.push_back(UndefValue::get(Builder->getInt32Ty()))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_990' href='#L_VECTOR_990'><pre>990</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> else</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_991' href='#L_VECTOR_991'><pre>991</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>MaskValues.push_back(Builder->getInt32(Mask[i]))</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_992' href='#L_VECTOR_992'><pre>992</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_993' href='#L_VECTOR_993'><pre>993</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return ConstantExpr::getShuffleVector(C, UndefValue::get(C->getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_994' href='#L_VECTOR_994'><pre>994</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(MaskValues));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_995' href='#L_VECTOR_995'><pre>995</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_996' href='#L_VECTOR_996'><pre>996</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_997' href='#L_VECTOR_997'><pre>997</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Instruction *I = cast<Instruction>(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_998' href='#L_VECTOR_998'><pre>998</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> switch (I->getOpcode()) {</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_999' href='#L_VECTOR_999'><pre>999</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Add:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1000' href='#L_VECTOR_1000'><pre>1000</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FAdd:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1001' href='#L_VECTOR_1001'><pre>1001</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Sub:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1002' href='#L_VECTOR_1002'><pre>1002</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FSub:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1003' href='#L_VECTOR_1003'><pre>1003</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Mul:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1004' href='#L_VECTOR_1004'><pre>1004</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FMul:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1005' href='#L_VECTOR_1005'><pre>1005</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::UDiv:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1006' href='#L_VECTOR_1006'><pre>1006</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::SDiv:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1007' href='#L_VECTOR_1007'><pre>1007</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FDiv:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1008' href='#L_VECTOR_1008'><pre>1008</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::URem:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1009' href='#L_VECTOR_1009'><pre>1009</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::SRem:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1010' href='#L_VECTOR_1010'><pre>1010</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FRem:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1011' href='#L_VECTOR_1011'><pre>1011</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Shl:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1012' href='#L_VECTOR_1012'><pre>1012</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::LShr:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1013' href='#L_VECTOR_1013'><pre>1013</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::AShr:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1014' href='#L_VECTOR_1014'><pre>1014</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::And:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1015' href='#L_VECTOR_1015'><pre>1015</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Or:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1016' href='#L_VECTOR_1016'><pre>1016</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Xor:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1017' href='#L_VECTOR_1017'><pre>1017</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::ICmp:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1018' href='#L_VECTOR_1018'><pre>1018</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FCmp:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1019' href='#L_VECTOR_1019'><pre>1019</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Trunc:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1020' href='#L_VECTOR_1020'><pre>1020</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::ZExt:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1021' href='#L_VECTOR_1021'><pre>1021</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::SExt:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1022' href='#L_VECTOR_1022'><pre>1022</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FPToUI:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1023' href='#L_VECTOR_1023'><pre>1023</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FPToSI:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1024' href='#L_VECTOR_1024'><pre>1024</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::UIToFP:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1025' href='#L_VECTOR_1025'><pre>1025</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::SIToFP:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1026' href='#L_VECTOR_1026'><pre>1026</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FPTrunc:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1027' href='#L_VECTOR_1027'><pre>1027</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::FPExt:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1028' href='#L_VECTOR_1028'><pre>1028</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::Select:</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1029' href='#L_VECTOR_1029'><pre>1029</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::GetElementPtr: {</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1030' href='#L_VECTOR_1030'><pre>1030</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Value*, 8> NewOps;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1031' href='#L_VECTOR_1031'><pre>1031</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool NeedsRebuild = (Mask.size() != I->getType()->getVectorNumElements());</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1032' href='#L_VECTOR_1032'><pre>1032</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int i = 0, e = I->getNumOperands(); </span><div class='tooltip'><span class='red'>i != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++i</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1033' href='#L_VECTOR_1033'><pre>1033</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = EvaluateInDifferentElementOrder(I->getOperand(i), Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1034' href='#L_VECTOR_1034'><pre>1034</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewOps.push_back(V);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1035' href='#L_VECTOR_1035'><pre>1035</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NeedsRebuild |= (V != I->getOperand(i));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1036' href='#L_VECTOR_1036'><pre>1036</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1037' href='#L_VECTOR_1037'><pre>1037</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>NeedsRebuild</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1038' href='#L_VECTOR_1038'><pre>1038</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return buildNew(I, NewOps);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1039' href='#L_VECTOR_1039'><pre>1039</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1040' href='#L_VECTOR_1040'><pre>1040</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return I</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1041' href='#L_VECTOR_1041'><pre>1041</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1042' href='#L_VECTOR_1042'><pre>1042</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>case Instruction::InsertElement: {</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1043' href='#L_VECTOR_1043'><pre>1043</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Element = cast<ConstantInt>(I->getOperand(2))->getLimitedValue();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1044' href='#L_VECTOR_1044'><pre>1044</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1045' href='#L_VECTOR_1045'><pre>1045</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The insertelement was inserting at Element. Figure out which element</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1046' href='#L_VECTOR_1046'><pre>1046</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // that becomes after shuffling. The answer is guaranteed to be unique</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1047' href='#L_VECTOR_1047'><pre>1047</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // by CanEvaluateShuffled.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1048' href='#L_VECTOR_1048'><pre>1048</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool Found = false;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1049' href='#L_VECTOR_1049'><pre>1049</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> int Index = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1050' href='#L_VECTOR_1050'><pre>1050</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (int e = Mask.size(); </span><div class='tooltip'><span class='red'>Index != e</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Index</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1051' href='#L_VECTOR_1051'><pre>1051</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>Mask[Index] == Element</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1052' href='#L_VECTOR_1052'><pre>1052</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Found = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1053' href='#L_VECTOR_1053'><pre>1053</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> break;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1054' href='#L_VECTOR_1054'><pre>1054</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1055' href='#L_VECTOR_1055'><pre>1055</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1056' href='#L_VECTOR_1056'><pre>1056</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1057' href='#L_VECTOR_1057'><pre>1057</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // If element is not in Mask, no need to handle the operand 1 (element to</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1058' href='#L_VECTOR_1058'><pre>1058</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // be inserted). Just evaluate values in operand 0 according to Mask.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1059' href='#L_VECTOR_1059'><pre>1059</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!Found</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1060' href='#L_VECTOR_1060'><pre>1060</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>return EvaluateInDifferentElementOrder(I->getOperand(0), Mask)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1061' href='#L_VECTOR_1061'><pre>1061</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1062' href='#L_VECTOR_1062'><pre>1062</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>Value *V = EvaluateInDifferentElementOrder(I->getOperand(0), Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1063' href='#L_VECTOR_1063'><pre>1063</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return InsertElementInst::Create(V, I->getOperand(1),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1064' href='#L_VECTOR_1064'><pre>1064</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Builder->getInt32(Index), "", I)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1065' href='#L_VECTOR_1065'><pre>1065</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1066' href='#L_VECTOR_1066'><pre>1066</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1067' href='#L_VECTOR_1067'><pre>1067</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>llvm_unreachable</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>("failed to reorder elements of vector instruction!");</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1068' href='#L_VECTOR_1068'><pre>1068</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'>}</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1069' href='#L_VECTOR_1069'><pre>1069</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1070' href='#L_VECTOR_1070'><pre>1070</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static void recognizeIdentityMask(const SmallVectorImpl<int> &Mask,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1071' href='#L_VECTOR_1071'><pre>1071</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> bool &isLHSID, bool &isRHSID) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1072' href='#L_VECTOR_1072'><pre>1072</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre> isLHSID = isRHSID = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1073' href='#L_VECTOR_1073'><pre>1073</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1074' href='#L_VECTOR_1074'><pre>1074</pre></a></td><td class='covered-line'><pre>26.4k</pre></td><td class='code'><pre> for (unsigned i = 0, e = Mask.size(); <div class='tooltip'>i != e<span class='tooltip-content'>26.4k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>18.0k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18.0k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1075' href='#L_VECTOR_1075'><pre>1075</pre></a></td><td class='covered-line'><pre>18.0k</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask[i] < 0<span class='tooltip-content'>18.0k</span></div>) <div class='tooltip'>continue<span class='tooltip-content'>483</span></div>; // Ignore undef values.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1076' href='#L_VECTOR_1076'><pre>1076</pre></a></td><td class='covered-line'><pre>18.0k</pre></td><td class='code'><pre> // Is this an identity shuffle of the LHS value?</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1077' href='#L_VECTOR_1077'><pre>1077</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> isLHSID &= (Mask[i] == (int)i);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1078' href='#L_VECTOR_1078'><pre>1078</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1079' href='#L_VECTOR_1079'><pre>1079</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> // Is this an identity shuffle of the RHS value?</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1080' href='#L_VECTOR_1080'><pre>1080</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> isRHSID &= (Mask[i]-e == i);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1081' href='#L_VECTOR_1081'><pre>1081</pre></a></td><td class='covered-line'><pre>17.5k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1082' href='#L_VECTOR_1082'><pre>1082</pre></a></td><td class='covered-line'><pre>8.38k</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1083' href='#L_VECTOR_1083'><pre>1083</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1084' href='#L_VECTOR_1084'><pre>1084</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Returns true if the shuffle is extracting a contiguous range of values from</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1085' href='#L_VECTOR_1085'><pre>1085</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// LHS, for example:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1086' href='#L_VECTOR_1086'><pre>1086</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1087' href='#L_VECTOR_1087'><pre>1087</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Input: |AA|BB|CC|DD|EE|FF|GG|HH|II|JJ|KK|LL|MM|NN|OO|PP|</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1088' href='#L_VECTOR_1088'><pre>1088</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// Shuffles to: |EE|FF|GG|HH|</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1089' href='#L_VECTOR_1089'><pre>1089</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// +--+--+--+--+</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1090' href='#L_VECTOR_1090'><pre>1090</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>static bool isShuffleExtractingFromLHS(ShuffleVectorInst &SVI,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1091' href='#L_VECTOR_1091'><pre>1091</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> SmallVector<int, 16> &Mask) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1092' href='#L_VECTOR_1092'><pre>1092</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> unsigned LHSElems = SVI.getOperand(0)->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1093' href='#L_VECTOR_1093'><pre>1093</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> unsigned MaskElems = Mask.size();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1094' href='#L_VECTOR_1094'><pre>1094</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> unsigned BegIdx = Mask.front();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1095' href='#L_VECTOR_1095'><pre>1095</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> unsigned EndIdx = Mask.back();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1096' href='#L_VECTOR_1096'><pre>1096</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> if (<div class='tooltip'>BegIdx > EndIdx || <span class='tooltip-content'>7.44k</span></div><div class='tooltip'>EndIdx >= LHSElems<span class='tooltip-content'>7.31k</span></div> || <div class='tooltip'>EndIdx - BegIdx != MaskElems - 1<span class='tooltip-content'>5.91k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1097' href='#L_VECTOR_1097'><pre>1097</pre></a></td><td class='covered-line'><pre>7.43k</pre></td><td class='code'><pre> return false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1098' href='#L_VECTOR_1098'><pre>1098</pre></a></td><td class='covered-line'><pre>36</pre></td><td class='code'><pre> <div class='tooltip'>for (unsigned I = 0; <span class='tooltip-content'>12</span></div><div class='tooltip'>I != MaskElems<span class='tooltip-content'>36</span></div>; <div class='tooltip'>++I<span class='tooltip-content'>24</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1099' href='#L_VECTOR_1099'><pre>1099</pre></a></td><td class='covered-line'><pre>24</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>24</span></div><div class='tooltip'>static_cast<unsigned>(Mask[I]) != BegIdx + I<span class='tooltip-content'>24</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1100' href='#L_VECTOR_1100'><pre>1100</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return false</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1101' href='#L_VECTOR_1101'><pre>1101</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> return true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1102' href='#L_VECTOR_1102'><pre>1102</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre>}</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1103' href='#L_VECTOR_1103'><pre>1103</pre></a></td><td class='uncovered-line'></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1104' href='#L_VECTOR_1104'><pre>1104</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre>Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1105' href='#L_VECTOR_1105'><pre>1105</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> Value *LHS = SVI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1106' href='#L_VECTOR_1106'><pre>1106</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> Value *RHS = SVI.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1107' href='#L_VECTOR_1107'><pre>1107</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> SmallVector<int, 16> Mask = SVI.getShuffleMask();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1108' href='#L_VECTOR_1108'><pre>1108</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> Type *Int32Ty = Type::getInt32Ty(SVI.getContext());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1109' href='#L_VECTOR_1109'><pre>1109</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1110' href='#L_VECTOR_1110'><pre>1110</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> bool MadeChange = false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1111' href='#L_VECTOR_1111'><pre>1111</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1112' href='#L_VECTOR_1112'><pre>1112</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> // Undefined shuffle mask -> undefined value.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1113' href='#L_VECTOR_1113'><pre>1113</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> if (isa<UndefValue>(SVI.getOperand(2)))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1114' href='#L_VECTOR_1114'><pre>1114</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SVI, UndefValue::get(SVI.getType()))</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1115' href='#L_VECTOR_1115'><pre>1115</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1116' href='#L_VECTOR_1116'><pre>1116</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> unsigned VWidth = SVI.getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1117' href='#L_VECTOR_1117'><pre>1117</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1118' href='#L_VECTOR_1118'><pre>1118</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> APInt UndefElts(VWidth, 0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1119' href='#L_VECTOR_1119'><pre>1119</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1120' href='#L_VECTOR_1120'><pre>1120</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> if (Value *<div class='tooltip'>V<span class='tooltip-content'>8.32k</span></div> = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) <div class='tooltip'>{<span class='tooltip-content'>10</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1121' href='#L_VECTOR_1121'><pre>1121</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> if (V != &SVI)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1122' href='#L_VECTOR_1122'><pre>1122</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>return replaceInstUsesWith(SVI, V)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1123' href='#L_VECTOR_1123'><pre>1123</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> LHS = SVI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1124' href='#L_VECTOR_1124'><pre>1124</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> RHS = SVI.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1125' href='#L_VECTOR_1125'><pre>1125</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> MadeChange = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1126' href='#L_VECTOR_1126'><pre>1126</pre></a></td><td class='covered-line'><pre>10</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1127' href='#L_VECTOR_1127'><pre>1127</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1128' href='#L_VECTOR_1128'><pre>1128</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> unsigned LHSWidth = LHS->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1129' href='#L_VECTOR_1129'><pre>1129</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1130' href='#L_VECTOR_1130'><pre>1130</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> // Canonicalize shuffle(x ,x,mask) -> shuffle(x, undef,mask')</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1131' href='#L_VECTOR_1131'><pre>1131</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> // Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask').</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1132' href='#L_VECTOR_1132'><pre>1132</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> if (<div class='tooltip'>LHS == RHS || <span class='tooltip-content'>8.32k</span></div><div class='tooltip'>isa<UndefValue>(LHS)<span class='tooltip-content'>8.31k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>1.09k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1133' href='#L_VECTOR_1133'><pre>1133</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(LHS) && <span class='tooltip-content'>1.09k</span></div><div class='tooltip'>LHS == RHS<span class='tooltip-content'>1.08k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1134' href='#L_VECTOR_1134'><pre>1134</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // shuffle(undef,undef,mask) -> undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1135' href='#L_VECTOR_1135'><pre>1135</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *Result = (VWidth == LHSWidth)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1136' href='#L_VECTOR_1136'><pre>1136</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><div class='tooltip'><span class='red'>LHS</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>UndefValue::get(SVI.getType())</span><span class='tooltip-content'>0</span></div><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1137' href='#L_VECTOR_1137'><pre>1137</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(SVI, Result);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1138' href='#L_VECTOR_1138'><pre>1138</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1139' href='#L_VECTOR_1139'><pre>1139</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1140' href='#L_VECTOR_1140'><pre>1140</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> // Remap any references to RHS to use LHS.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1141' href='#L_VECTOR_1141'><pre>1141</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> SmallVector<Constant*, 16> Elts;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1142' href='#L_VECTOR_1142'><pre>1142</pre></a></td><td class='covered-line'><pre>3.28k</pre></td><td class='code'><pre> for (unsigned i = 0, e = LHSWidth; <div class='tooltip'>i != VWidth<span class='tooltip-content'>3.28k</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>2.18k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>2.18k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1143' href='#L_VECTOR_1143'><pre>1143</pre></a></td><td class='covered-line'><pre>2.18k</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask[i] < 0<span class='tooltip-content'>2.18k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>55</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1144' href='#L_VECTOR_1144'><pre>1144</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> Elts.push_back(UndefValue::get(Int32Ty));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1145' href='#L_VECTOR_1145'><pre>1145</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> continue;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1146' href='#L_VECTOR_1146'><pre>1146</pre></a></td><td class='covered-line'><pre>55</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1147' href='#L_VECTOR_1147'><pre>1147</pre></a></td><td class='covered-line'><pre>2.18k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1148' href='#L_VECTOR_1148'><pre>1148</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>2.13k</span></div><div class='tooltip'>(Mask[i] >= (int)e && <span class='tooltip-content'>2.13k</span></div><div class='tooltip'>isa<UndefValue>(RHS)<span class='tooltip-content'>2.12k</span></div>) ||</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1149' href='#L_VECTOR_1149'><pre>1149</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> <div class='tooltip'>(Mask[i] < (int)e && <span class='tooltip-content'>2.13k</span></div><div class='tooltip'>isa<UndefValue>(LHS)<span class='tooltip-content'>9</span></div>)) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1150' href='#L_VECTOR_1150'><pre>1150</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Mask[i] = -1; // Turn into undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1151' href='#L_VECTOR_1151'><pre>1151</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Elts.push_back(UndefValue::get(Int32Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1152' href='#L_VECTOR_1152'><pre>1152</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1153' href='#L_VECTOR_1153'><pre>1153</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> Mask[i] = Mask[i] % e; // Force to LHS.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1154' href='#L_VECTOR_1154'><pre>1154</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> Elts.push_back(ConstantInt::get(Int32Ty, Mask[i]));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1155' href='#L_VECTOR_1155'><pre>1155</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1156' href='#L_VECTOR_1156'><pre>1156</pre></a></td><td class='covered-line'><pre>2.13k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1157' href='#L_VECTOR_1157'><pre>1157</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> SVI.setOperand(0, SVI.getOperand(1));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1158' href='#L_VECTOR_1158'><pre>1158</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> SVI.setOperand(1, UndefValue::get(RHS->getType()));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1159' href='#L_VECTOR_1159'><pre>1159</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> SVI.setOperand(2, ConstantVector::get(Elts));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1160' href='#L_VECTOR_1160'><pre>1160</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> LHS = SVI.getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1161' href='#L_VECTOR_1161'><pre>1161</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> RHS = SVI.getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1162' href='#L_VECTOR_1162'><pre>1162</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> MadeChange = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1163' href='#L_VECTOR_1163'><pre>1163</pre></a></td><td class='covered-line'><pre>1.09k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1164' href='#L_VECTOR_1164'><pre>1164</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1165' href='#L_VECTOR_1165'><pre>1165</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>8.32k</span></div><div class='tooltip'>VWidth == LHSWidth<span class='tooltip-content'>8.32k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>8.27k</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1166' href='#L_VECTOR_1166'><pre>1166</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> // Analyze the shuffle, are the LHS or RHS and identity shuffles?</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1167' href='#L_VECTOR_1167'><pre>1167</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> bool isLHSID, isRHSID;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1168' href='#L_VECTOR_1168'><pre>1168</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> recognizeIdentityMask(Mask, isLHSID, isRHSID);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1169' href='#L_VECTOR_1169'><pre>1169</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1170' href='#L_VECTOR_1170'><pre>1170</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> // Eliminate identity shuffles.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1171' href='#L_VECTOR_1171'><pre>1171</pre></a></td><td class='covered-line'><pre>8.27k</pre></td><td class='code'><pre> if (<div class='tooltip'>isLHSID<span class='tooltip-content'>8.27k</span></div>) <div class='tooltip'>return replaceInstUsesWith(SVI, LHS)<span class='tooltip-content'>876</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1172' href='#L_VECTOR_1172'><pre>1172</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.39k</span></div><div class='tooltip'>isRHSID<span class='tooltip-content'>7.39k</span></div>) <div class='tooltip'><span class='red'>return replaceInstUsesWith(SVI, RHS)</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1173' href='#L_VECTOR_1173'><pre>1173</pre></a></td><td class='covered-line'><pre>7.39k</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1174' href='#L_VECTOR_1174'><pre>1174</pre></a></td><td class='covered-line'><pre>8.32k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1175' href='#L_VECTOR_1175'><pre>1175</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.44k</span></div><div class='tooltip'>isa<UndefValue>(RHS) && <span class='tooltip-content'>7.44k</span></div><div class='tooltip'>CanEvaluateShuffled(LHS, Mask)<span class='tooltip-content'>6.35k</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1176' href='#L_VECTOR_1176'><pre>1176</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Value *V = EvaluateInDifferentElementOrder(LHS, Mask);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1177' href='#L_VECTOR_1177'><pre>1177</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> return replaceInstUsesWith(SVI, V);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1178' href='#L_VECTOR_1178'><pre>1178</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1179' href='#L_VECTOR_1179'><pre>1179</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1180' href='#L_VECTOR_1180'><pre>1180</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // SROA generates shuffle+bitcast when the extracted sub-vector is bitcast to</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1181' href='#L_VECTOR_1181'><pre>1181</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // a non-vector type. We can instead bitcast the original vector followed by</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1182' href='#L_VECTOR_1182'><pre>1182</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // an extract of the desired element:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1183' href='#L_VECTOR_1183'><pre>1183</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1184' href='#L_VECTOR_1184'><pre>1184</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // %sroa = shufflevector <16 x i8> %in, <16 x i8> undef,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1185' href='#L_VECTOR_1185'><pre>1185</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // <4 x i32> <i32 0, i32 1, i32 2, i32 3></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1186' href='#L_VECTOR_1186'><pre>1186</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // %1 = bitcast <4 x i8> %sroa to i32</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1187' href='#L_VECTOR_1187'><pre>1187</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Becomes:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1188' href='#L_VECTOR_1188'><pre>1188</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // %bc = bitcast <16 x i8> %in to <4 x i32></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1189' href='#L_VECTOR_1189'><pre>1189</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // %ext = extractelement <4 x i32> %bc, i32 0</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1190' href='#L_VECTOR_1190'><pre>1190</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1191' href='#L_VECTOR_1191'><pre>1191</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // If the shuffle is extracting a contiguous range of values from the input</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1192' href='#L_VECTOR_1192'><pre>1192</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // vector then each use which is a bitcast of the extracted size can be</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1193' href='#L_VECTOR_1193'><pre>1193</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // replaced. This will work if the vector types are compatible, and the begin</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1194' href='#L_VECTOR_1194'><pre>1194</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // index is aligned to a value in the casted vector type. If the begin index</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1195' href='#L_VECTOR_1195'><pre>1195</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // isn't aligned then we can shuffle the original vector (keeping the same</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1196' href='#L_VECTOR_1196'><pre>1196</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // vector type) before extracting.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1197' href='#L_VECTOR_1197'><pre>1197</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1198' href='#L_VECTOR_1198'><pre>1198</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // This code will bail out if the target type is fundamentally incompatible</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1199' href='#L_VECTOR_1199'><pre>1199</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // with vectors of the source type.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1200' href='#L_VECTOR_1200'><pre>1200</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1201' href='#L_VECTOR_1201'><pre>1201</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Example of <16 x i8>, target type i32:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1202' href='#L_VECTOR_1202'><pre>1202</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Index range [4,8): v-----------v Will work.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1203' href='#L_VECTOR_1203'><pre>1203</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1204' href='#L_VECTOR_1204'><pre>1204</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // <16 x i8>: | | | | | | | | | | | | | | | | |</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1205' href='#L_VECTOR_1205'><pre>1205</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // <4 x i32>: | | | | |</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1206' href='#L_VECTOR_1206'><pre>1206</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // +-----------+-----------+-----------+-----------+</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1207' href='#L_VECTOR_1207'><pre>1207</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Index range [6,10): ^-----------^ Needs an extra shuffle.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1208' href='#L_VECTOR_1208'><pre>1208</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Target type i40: ^--------------^ Won't work, bail.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1209' href='#L_VECTOR_1209'><pre>1209</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>7.44k</span></div><div class='tooltip'>isShuffleExtractingFromLHS(SVI, Mask)<span class='tooltip-content'>7.44k</span></div>) <div class='tooltip'>{<span class='tooltip-content'>12</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1210' href='#L_VECTOR_1210'><pre>1210</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> Value *V = LHS;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1211' href='#L_VECTOR_1211'><pre>1211</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> unsigned MaskElems = Mask.size();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1212' href='#L_VECTOR_1212'><pre>1212</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> VectorType *SrcTy = cast<VectorType>(V->getType());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1213' href='#L_VECTOR_1213'><pre>1213</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> unsigned VecBitWidth = SrcTy->getBitWidth();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1214' href='#L_VECTOR_1214'><pre>1214</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> unsigned SrcElemBitWidth = DL.getTypeSizeInBits(SrcTy->getElementType());</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1215' href='#L_VECTOR_1215'><pre>1215</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> assert(SrcElemBitWidth && "vector elements must have a bitwidth");</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1216' href='#L_VECTOR_1216'><pre>1216</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> unsigned SrcNumElems = SrcTy->getNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1217' href='#L_VECTOR_1217'><pre>1217</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> SmallVector<BitCastInst *, 8> BCs;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1218' href='#L_VECTOR_1218'><pre>1218</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> DenseMap<Type *, Value *> NewBCs;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1219' href='#L_VECTOR_1219'><pre>1219</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> for (User *U : SVI.users())</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1220' href='#L_VECTOR_1220'><pre>1220</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> <div class='tooltip'>if (BitCastInst *<span class='tooltip-content'>12</span></div><div class='tooltip'>BC<span class='tooltip-content'>12</span></div> = dyn_cast<BitCastInst>(U))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1221' href='#L_VECTOR_1221'><pre>1221</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!BC->use_empty()</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1222' href='#L_VECTOR_1222'><pre>1222</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Only visit bitcasts that weren't previously handled.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1223' href='#L_VECTOR_1223'><pre>1223</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>BCs.push_back(BC)</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1224' href='#L_VECTOR_1224'><pre>1224</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> for (BitCastInst *BC : BCs) <span class='red'>{</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1225' href='#L_VECTOR_1225'><pre>1225</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned BegIdx = Mask.front();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1226' href='#L_VECTOR_1226'><pre>1226</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Type *TgtTy = BC->getDestTy();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1227' href='#L_VECTOR_1227'><pre>1227</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned TgtElemBitWidth = DL.getTypeSizeInBits(TgtTy);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1228' href='#L_VECTOR_1228'><pre>1228</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!TgtElemBitWidth</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1229' href='#L_VECTOR_1229'><pre>1229</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1230' href='#L_VECTOR_1230'><pre>1230</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>unsigned TgtNumElems = VecBitWidth / TgtElemBitWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1231' href='#L_VECTOR_1231'><pre>1231</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool VecBitWidthsEqual = VecBitWidth == TgtNumElems * TgtElemBitWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1232' href='#L_VECTOR_1232'><pre>1232</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool BegIsAligned = 0 == ((SrcElemBitWidth * BegIdx) % TgtElemBitWidth);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1233' href='#L_VECTOR_1233'><pre>1233</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!VecBitWidthsEqual</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1234' href='#L_VECTOR_1234'><pre>1234</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1235' href='#L_VECTOR_1235'><pre>1235</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><div class='tooltip'><span class='red'>if (</span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>!VectorType::isValidElementType(TgtTy)</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1236' href='#L_VECTOR_1236'><pre>1236</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>continue</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1237' href='#L_VECTOR_1237'><pre>1237</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>VectorType *CastSrcTy = VectorType::get(TgtTy, TgtNumElems);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1238' href='#L_VECTOR_1238'><pre>1238</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><div class='tooltip'><span class='red'>!BegIsAligned</span><span class='tooltip-content'>0</span></div><span class='red'>) </span><div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1239' href='#L_VECTOR_1239'><pre>1239</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // Shuffle the input so [0,NumElements) contains the output, and</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1240' href='#L_VECTOR_1240'><pre>1240</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // [NumElems,SrcNumElems) is undef.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1241' href='#L_VECTOR_1241'><pre>1241</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SmallVector<Constant *, 16> ShuffleMask(SrcNumElems,</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1242' href='#L_VECTOR_1242'><pre>1242</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> UndefValue::get(Int32Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1243' href='#L_VECTOR_1243'><pre>1243</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> for (unsigned I = 0, E = MaskElems, Idx = BegIdx; </span><div class='tooltip'><span class='red'>I != E</span><span class='tooltip-content'>0</span></div><span class='red'>; </span><div class='tooltip'><span class='red'>++Idx, ++I</span><span class='tooltip-content'>0</span></div><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1244' href='#L_VECTOR_1244'><pre>1244</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>ShuffleMask[I] = ConstantInt::get(Int32Ty, Idx)</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1245' href='#L_VECTOR_1245'><pre>1245</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> V = Builder->CreateShuffleVector(V, UndefValue::get(V->getType()),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1246' href='#L_VECTOR_1246'><pre>1246</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ConstantVector::get(ShuffleMask),</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1247' href='#L_VECTOR_1247'><pre>1247</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> SVI.getName() + ".extract");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1248' href='#L_VECTOR_1248'><pre>1248</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BegIdx = 0;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1249' href='#L_VECTOR_1249'><pre>1249</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1250' href='#L_VECTOR_1250'><pre>1250</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> unsigned SrcElemsPerTgtElem = TgtElemBitWidth / SrcElemBitWidth;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1251' href='#L_VECTOR_1251'><pre>1251</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(SrcElemsPerTgtElem);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1252' href='#L_VECTOR_1252'><pre>1252</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BegIdx /= SrcElemsPerTgtElem;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1253' href='#L_VECTOR_1253'><pre>1253</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> bool BCAlreadyExists = NewBCs.find(CastSrcTy) != NewBCs.end();</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1254' href='#L_VECTOR_1254'><pre>1254</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *NewBC =</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1255' href='#L_VECTOR_1255'><pre>1255</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> BCAlreadyExists</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1256' href='#L_VECTOR_1256'><pre>1256</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> ? </span><span class='red'>NewBCs[CastSrcTy]</span><span class='red'></span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1257' href='#L_VECTOR_1257'><pre>1257</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> : </span><span class='red'>Builder->CreateBitCast(V, CastSrcTy, SVI.getName() + ".bc")</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1258' href='#L_VECTOR_1258'><pre>1258</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> if (</span><span class='red'>!BCAlreadyExists</span><span class='red'>)</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1259' href='#L_VECTOR_1259'><pre>1259</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> </span><span class='red'>NewBCs[CastSrcTy] = NewBC</span><span class='red'>;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1260' href='#L_VECTOR_1260'><pre>1260</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> auto *Ext = Builder->CreateExtractElement(</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1261' href='#L_VECTOR_1261'><pre>1261</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> NewBC, ConstantInt::get(Int32Ty, BegIdx), SVI.getName() + ".extract");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1262' href='#L_VECTOR_1262'><pre>1262</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // The shufflevector isn't being replaced: the bitcast that used it</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1263' href='#L_VECTOR_1263'><pre>1263</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // is. InstCombine will visit the newly-created instructions.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1264' href='#L_VECTOR_1264'><pre>1264</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> replaceInstUsesWith(*BC, Ext);</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1265' href='#L_VECTOR_1265'><pre>1265</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> MadeChange = true;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1266' href='#L_VECTOR_1266'><pre>1266</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1267' href='#L_VECTOR_1267'><pre>1267</pre></a></td><td class='covered-line'><pre>12</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1268' href='#L_VECTOR_1268'><pre>1268</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1269' href='#L_VECTOR_1269'><pre>1269</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // If the LHS is a shufflevector itself, see if we can combine it with this</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1270' href='#L_VECTOR_1270'><pre>1270</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // one without producing an unusual shuffle.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1271' href='#L_VECTOR_1271'><pre>1271</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Cases that might be simplified:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1272' href='#L_VECTOR_1272'><pre>1272</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // 1.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1273' href='#L_VECTOR_1273'><pre>1273</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x1=shuffle(v1,v2,mask1)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1274' href='#L_VECTOR_1274'><pre>1274</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(x1,undef,mask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1275' href='#L_VECTOR_1275'><pre>1275</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ==></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1276' href='#L_VECTOR_1276'><pre>1276</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(v1,undef,newMask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1277' href='#L_VECTOR_1277'><pre>1277</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // newMask[i] = (mask[i] < x1.size()) ? mask1[mask[i]] : -1</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1278' href='#L_VECTOR_1278'><pre>1278</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // 2.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1279' href='#L_VECTOR_1279'><pre>1279</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x1=shuffle(v1,undef,mask1)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1280' href='#L_VECTOR_1280'><pre>1280</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(x1,x2,mask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1281' href='#L_VECTOR_1281'><pre>1281</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // where v1.size() == mask1.size()</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1282' href='#L_VECTOR_1282'><pre>1282</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ==></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1283' href='#L_VECTOR_1283'><pre>1283</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(v1,x2,newMask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1284' href='#L_VECTOR_1284'><pre>1284</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // newMask[i] = (mask[i] < x1.size()) ? mask1[mask[i]] : mask[i]</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1285' href='#L_VECTOR_1285'><pre>1285</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // 3.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1286' href='#L_VECTOR_1286'><pre>1286</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x2=shuffle(v2,undef,mask2)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1287' href='#L_VECTOR_1287'><pre>1287</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(x1,x2,mask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1288' href='#L_VECTOR_1288'><pre>1288</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // where v2.size() == mask2.size()</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1289' href='#L_VECTOR_1289'><pre>1289</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ==></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1290' href='#L_VECTOR_1290'><pre>1290</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(x1,v2,newMask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1291' href='#L_VECTOR_1291'><pre>1291</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // newMask[i] = (mask[i] < x1.size())</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1292' href='#L_VECTOR_1292'><pre>1292</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ? mask[i] : mask2[mask[i]-x1.size()]+x1.size()</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1293' href='#L_VECTOR_1293'><pre>1293</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // 4.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1294' href='#L_VECTOR_1294'><pre>1294</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x1=shuffle(v1,undef,mask1)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1295' href='#L_VECTOR_1295'><pre>1295</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x2=shuffle(v2,undef,mask2)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1296' href='#L_VECTOR_1296'><pre>1296</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(x1,x2,mask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1297' href='#L_VECTOR_1297'><pre>1297</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // where v1.size() == v2.size()</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1298' href='#L_VECTOR_1298'><pre>1298</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ==></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1299' href='#L_VECTOR_1299'><pre>1299</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // x=shuffle(v1,v2,newMask)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1300' href='#L_VECTOR_1300'><pre>1300</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // newMask[i] = (mask[i] < x1.size())</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1301' href='#L_VECTOR_1301'><pre>1301</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // ? mask1[mask[i]] : mask2[mask[i]-x1.size()]+v1.size()</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1302' href='#L_VECTOR_1302'><pre>1302</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1303' href='#L_VECTOR_1303'><pre>1303</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // Here we are really conservative:</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1304' href='#L_VECTOR_1304'><pre>1304</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // we are absolutely afraid of producing a shuffle mask not in the input</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1305' href='#L_VECTOR_1305'><pre>1305</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // program, because the code gen may not be smart enough to turn a merged</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1306' href='#L_VECTOR_1306'><pre>1306</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // shuffle into two specific shuffles: it may produce worse code. As such,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1307' href='#L_VECTOR_1307'><pre>1307</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // we only merge two shuffles if the result is either a splat or one of the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1308' href='#L_VECTOR_1308'><pre>1308</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // input shuffle masks. In this case, merging the shuffles just removes</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1309' href='#L_VECTOR_1309'><pre>1309</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // one instruction, which we know is safe. This is good for things like</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1310' href='#L_VECTOR_1310'><pre>1310</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // turning: (splat(splat)) -> splat, or</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1311' href='#L_VECTOR_1311'><pre>1311</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> // merge(V[0..n], V[n+1..2n]) -> V[0..2n]</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1312' href='#L_VECTOR_1312'><pre>1312</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> ShuffleVectorInst* LHSShuffle = dyn_cast<ShuffleVectorInst>(LHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1313' href='#L_VECTOR_1313'><pre>1313</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> ShuffleVectorInst* RHSShuffle = dyn_cast<ShuffleVectorInst>(RHS);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1314' href='#L_VECTOR_1314'><pre>1314</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> if (LHSShuffle)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1315' href='#L_VECTOR_1315'><pre>1315</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>117</span></div><div class='tooltip'>!isa<UndefValue>(LHSShuffle->getOperand(1)) && <span class='tooltip-content'>117</span></div><div class='tooltip'><span class='red'>!isa<UndefValue>(RHS)</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1316' href='#L_VECTOR_1316'><pre>1316</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>LHSShuffle = nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1317' href='#L_VECTOR_1317'><pre>1317</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> if (RHSShuffle)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1318' href='#L_VECTOR_1318'><pre>1318</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>5</span></div><div class='tooltip'>!isa<UndefValue>(RHSShuffle->getOperand(1))<span class='tooltip-content'>5</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1319' href='#L_VECTOR_1319'><pre>1319</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>RHSShuffle = nullptr</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1320' href='#L_VECTOR_1320'><pre>1320</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre> if (<div class='tooltip'>!LHSShuffle && <span class='tooltip-content'>7.44k</span></div><div class='tooltip'>!RHSShuffle<span class='tooltip-content'>7.33k</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1321' href='#L_VECTOR_1321'><pre>1321</pre></a></td><td class='covered-line'><pre>7.32k</pre></td><td class='code'><pre> <div class='tooltip'>return MadeChange ? <span class='tooltip-content'>7.32k</span></div><div class='tooltip'>&SVI<span class='tooltip-content'>227</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>7.10k</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1322' href='#L_VECTOR_1322'><pre>1322</pre></a></td><td class='covered-line'><pre>7.44k</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1323' href='#L_VECTOR_1323'><pre>1323</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> Value* LHSOp0 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1324' href='#L_VECTOR_1324'><pre>1324</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> Value* LHSOp1 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1325' href='#L_VECTOR_1325'><pre>1325</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> Value* RHSOp0 = nullptr;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1326' href='#L_VECTOR_1326'><pre>1326</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> unsigned LHSOp0Width = 0;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1327' href='#L_VECTOR_1327'><pre>1327</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> unsigned RHSOp0Width = 0;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1328' href='#L_VECTOR_1328'><pre>1328</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSShuffle<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>117</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1329' href='#L_VECTOR_1329'><pre>1329</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> LHSOp0 = LHSShuffle->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1330' href='#L_VECTOR_1330'><pre>1330</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> LHSOp1 = LHSShuffle->getOperand(1);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1331' href='#L_VECTOR_1331'><pre>1331</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> LHSOp0Width = LHSOp0->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1332' href='#L_VECTOR_1332'><pre>1332</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1333' href='#L_VECTOR_1333'><pre>1333</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSShuffle<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1334' href='#L_VECTOR_1334'><pre>1334</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> RHSOp0 = RHSShuffle->getOperand(0);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1335' href='#L_VECTOR_1335'><pre>1335</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> RHSOp0Width = RHSOp0->getType()->getVectorNumElements();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1336' href='#L_VECTOR_1336'><pre>1336</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1337' href='#L_VECTOR_1337'><pre>1337</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> Value* newLHS = LHS;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1338' href='#L_VECTOR_1338'><pre>1338</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> Value* newRHS = RHS;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1339' href='#L_VECTOR_1339'><pre>1339</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSShuffle<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>117</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1340' href='#L_VECTOR_1340'><pre>1340</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> // case 1</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1341' href='#L_VECTOR_1341'><pre>1341</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> if (<div class='tooltip'>isa<UndefValue>(RHS)<span class='tooltip-content'>117</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1342' href='#L_VECTOR_1342'><pre>1342</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> newLHS = LHSOp0;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1343' href='#L_VECTOR_1343'><pre>1343</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> newRHS = LHSOp1;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1344' href='#L_VECTOR_1344'><pre>1344</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1345' href='#L_VECTOR_1345'><pre>1345</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> // case 2 or 4</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1346' href='#L_VECTOR_1346'><pre>1346</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>117</span></div><div class='tooltip'>LHSOp0Width == LHSWidth<span class='tooltip-content'>117</span></div>) <div class='tooltip'>{<span class='tooltip-content'>117</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1347' href='#L_VECTOR_1347'><pre>1347</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> newLHS = LHSOp0;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1348' href='#L_VECTOR_1348'><pre>1348</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1349' href='#L_VECTOR_1349'><pre>1349</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1350' href='#L_VECTOR_1350'><pre>1350</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // case 3 or 4</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1351' href='#L_VECTOR_1351'><pre>1351</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSShuffle && <span class='tooltip-content'>120</span></div><div class='tooltip'>RHSOp0Width == LHSWidth<span class='tooltip-content'>5</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1352' href='#L_VECTOR_1352'><pre>1352</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> newRHS = RHSOp0;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1353' href='#L_VECTOR_1353'><pre>1353</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1354' href='#L_VECTOR_1354'><pre>1354</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // case 4</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1355' href='#L_VECTOR_1355'><pre>1355</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>LHSOp0 == RHSOp0<span class='tooltip-content'>120</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1356' href='#L_VECTOR_1356'><pre>1356</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> newLHS = LHSOp0;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1357' href='#L_VECTOR_1357'><pre>1357</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> newRHS = nullptr;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1358' href='#L_VECTOR_1358'><pre>1358</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1359' href='#L_VECTOR_1359'><pre>1359</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1360' href='#L_VECTOR_1360'><pre>1360</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>newLHS == LHS && <span class='tooltip-content'>120</span></div><div class='tooltip'>newRHS == RHS<span class='tooltip-content'>3</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1361' href='#L_VECTOR_1361'><pre>1361</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <div class='tooltip'><span class='red'>return MadeChange ? </span><span class='tooltip-content'>0</span></div><div class='tooltip'><span class='red'>&SVI</span><span class='tooltip-content'>0</span></div><span class='red'> : </span><div class='tooltip'><span class='red'>nullptr</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1362' href='#L_VECTOR_1362'><pre>1362</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1363' href='#L_VECTOR_1363'><pre>1363</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> SmallVector<int, 16> LHSMask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1364' href='#L_VECTOR_1364'><pre>1364</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> SmallVector<int, 16> RHSMask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1365' href='#L_VECTOR_1365'><pre>1365</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (newLHS != LHS)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1366' href='#L_VECTOR_1366'><pre>1366</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> LHSMask = LHSShuffle->getShuffleMask();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1367' href='#L_VECTOR_1367'><pre>1367</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>RHSShuffle && <span class='tooltip-content'>120</span></div><div class='tooltip'>newRHS != RHS<span class='tooltip-content'>5</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1368' href='#L_VECTOR_1368'><pre>1368</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> RHSMask = RHSShuffle->getShuffleMask();</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1369' href='#L_VECTOR_1369'><pre>1369</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1370' href='#L_VECTOR_1370'><pre>1370</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> unsigned newLHSWidth = (newLHS != LHS) ? <div class='tooltip'>LHSOp0Width<span class='tooltip-content'>117</span></div> : <div class='tooltip'>LHSWidth<span class='tooltip-content'>3</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1371' href='#L_VECTOR_1371'><pre>1371</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> SmallVector<int, 16> newMask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1372' href='#L_VECTOR_1372'><pre>1372</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> bool isSplat = true;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1373' href='#L_VECTOR_1373'><pre>1373</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> int SplatElt = -1;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1374' href='#L_VECTOR_1374'><pre>1374</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // Create a new mask for the new ShuffleVectorInst so that the new</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1375' href='#L_VECTOR_1375'><pre>1375</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // ShuffleVectorInst is equivalent to the original one.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1376' href='#L_VECTOR_1376'><pre>1376</pre></a></td><td class='covered-line'><pre>360</pre></td><td class='code'><pre> for (unsigned i = 0; <div class='tooltip'>i < VWidth<span class='tooltip-content'>360</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>240</span></div>) <div class='tooltip'>{<span class='tooltip-content'>240</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1377' href='#L_VECTOR_1377'><pre>1377</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> int eltMask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1378' href='#L_VECTOR_1378'><pre>1378</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> if (<div class='tooltip'>Mask[i] < 0<span class='tooltip-content'>240</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1379' href='#L_VECTOR_1379'><pre>1379</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> // This element is an undef value.</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1380' href='#L_VECTOR_1380'><pre>1380</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> eltMask = -1;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1381' href='#L_VECTOR_1381'><pre>1381</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre><span class='red'> }</span> else <div class='tooltip'>if (<span class='tooltip-content'>240</span></div><div class='tooltip'>Mask[i] < (int)LHSWidth<span class='tooltip-content'>240</span></div>) <div class='tooltip'>{<span class='tooltip-content'>120</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1382' href='#L_VECTOR_1382'><pre>1382</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // This element is from left hand side vector operand.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1383' href='#L_VECTOR_1383'><pre>1383</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1384' href='#L_VECTOR_1384'><pre>1384</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If LHS is going to be replaced (case 1, 2, or 4), calculate the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1385' href='#L_VECTOR_1385'><pre>1385</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // new mask value for the element.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1386' href='#L_VECTOR_1386'><pre>1386</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>newLHS != LHS<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>117</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1387' href='#L_VECTOR_1387'><pre>1387</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> eltMask = LHSMask[Mask[i]];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1388' href='#L_VECTOR_1388'><pre>1388</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> // If the value selected is an undef value, explicitly specify it</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1389' href='#L_VECTOR_1389'><pre>1389</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> // with a -1 mask value.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1390' href='#L_VECTOR_1390'><pre>1390</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> if (<div class='tooltip'>eltMask >= (int)LHSOp0Width && <span class='tooltip-content'>117</span></div><div class='tooltip'><span class='red'>isa<UndefValue>(LHSOp1)</span><span class='tooltip-content'>0</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1391' href='#L_VECTOR_1391'><pre>1391</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>eltMask = -1</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1392' href='#L_VECTOR_1392'><pre>1392</pre></a></td><td class='covered-line'><pre>117</pre></td><td class='code'><pre> } else</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1393' href='#L_VECTOR_1393'><pre>1393</pre></a></td><td class='covered-line'><pre>3</pre></td><td class='code'><pre> eltMask = Mask[i];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1394' href='#L_VECTOR_1394'><pre>1394</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> } else {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1395' href='#L_VECTOR_1395'><pre>1395</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // This element is from right hand side vector operand</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1396' href='#L_VECTOR_1396'><pre>1396</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> //</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1397' href='#L_VECTOR_1397'><pre>1397</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If the value selected is an undef value, explicitly specify it</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1398' href='#L_VECTOR_1398'><pre>1398</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // with a -1 mask value. (case 1)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1399' href='#L_VECTOR_1399'><pre>1399</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (isa<UndefValue>(RHS))</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1400' href='#L_VECTOR_1400'><pre>1400</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>eltMask = -1</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1401' href='#L_VECTOR_1401'><pre>1401</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If RHS is going to be replaced (case 3 or 4), calculate the</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1402' href='#L_VECTOR_1402'><pre>1402</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // new mask value for the element.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1403' href='#L_VECTOR_1403'><pre>1403</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> else <div class='tooltip'>if (<span class='tooltip-content'>120</span></div><div class='tooltip'>newRHS != RHS<span class='tooltip-content'>120</span></div>) <div class='tooltip'>{<span class='tooltip-content'>5</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1404' href='#L_VECTOR_1404'><pre>1404</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> eltMask = RHSMask[Mask[i]-LHSWidth];</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1405' href='#L_VECTOR_1405'><pre>1405</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // If the value selected is an undef value, explicitly specify it</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1406' href='#L_VECTOR_1406'><pre>1406</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> // with a -1 mask value.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1407' href='#L_VECTOR_1407'><pre>1407</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> if (<div class='tooltip'>eltMask >= (int)RHSOp0Width<span class='tooltip-content'>5</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1408' href='#L_VECTOR_1408'><pre>1408</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> assert(isa<UndefValue>(RHSShuffle->getOperand(1))</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1409' href='#L_VECTOR_1409'><pre>1409</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> && "should have been check above");</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1410' href='#L_VECTOR_1410'><pre>1410</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> eltMask = -1;</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1411' href='#L_VECTOR_1411'><pre>1411</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> }</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1412' href='#L_VECTOR_1412'><pre>1412</pre></a></td><td class='covered-line'><pre>5</pre></td><td class='code'><pre> } else</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1413' href='#L_VECTOR_1413'><pre>1413</pre></a></td><td class='covered-line'><pre>115</pre></td><td class='code'><pre> eltMask = Mask[i]-LHSWidth;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1414' href='#L_VECTOR_1414'><pre>1414</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1415' href='#L_VECTOR_1415'><pre>1415</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If LHS's width is changed, shift the mask value accordingly.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1416' href='#L_VECTOR_1416'><pre>1416</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If newRHS == NULL, i.e. LHSOp0 == RHSOp0, we want to remap any</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1417' href='#L_VECTOR_1417'><pre>1417</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // references from RHSOp0 to LHSOp0, so we don't need to shift the mask.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1418' href='#L_VECTOR_1418'><pre>1418</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If newRHS == newLHS, we want to remap any references from newRHS to</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1419' href='#L_VECTOR_1419'><pre>1419</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // newLHS so that we can properly identify splats that may occur due to</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1420' href='#L_VECTOR_1420'><pre>1420</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // obfuscation across the two vectors.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1421' href='#L_VECTOR_1421'><pre>1421</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>eltMask >= 0 && <span class='tooltip-content'>120</span></div><div class='tooltip'>newRHS != nullptr<span class='tooltip-content'>120</span></div> && <div class='tooltip'>newLHS != newRHS<span class='tooltip-content'>120</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1422' href='#L_VECTOR_1422'><pre>1422</pre></a></td><td class='covered-line'><pre>89</pre></td><td class='code'><pre> eltMask += newLHSWidth;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1423' href='#L_VECTOR_1423'><pre>1423</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1424' href='#L_VECTOR_1424'><pre>1424</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1425' href='#L_VECTOR_1425'><pre>1425</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> // Check if this could still be a splat.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1426' href='#L_VECTOR_1426'><pre>1426</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> if (<div class='tooltip'>eltMask >= 0<span class='tooltip-content'>240</span></div>) <div class='tooltip'>{<span class='tooltip-content'>240</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1427' href='#L_VECTOR_1427'><pre>1427</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> if (<div class='tooltip'>SplatElt >= 0 && <span class='tooltip-content'>240</span></div><div class='tooltip'>SplatElt != eltMask<span class='tooltip-content'>120</span></div>)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1428' href='#L_VECTOR_1428'><pre>1428</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> isSplat = false;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1429' href='#L_VECTOR_1429'><pre>1429</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> SplatElt = eltMask;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1430' href='#L_VECTOR_1430'><pre>1430</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1431' href='#L_VECTOR_1431'><pre>1431</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1432' href='#L_VECTOR_1432'><pre>1432</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> newMask.push_back(eltMask);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1433' href='#L_VECTOR_1433'><pre>1433</pre></a></td><td class='covered-line'><pre>240</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1434' href='#L_VECTOR_1434'><pre>1434</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1435' href='#L_VECTOR_1435'><pre>1435</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If the result mask is equal to one of the original shuffle masks,</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1436' href='#L_VECTOR_1436'><pre>1436</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // or is a splat, do the replacement.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1437' href='#L_VECTOR_1437'><pre>1437</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> if (<div class='tooltip'>isSplat || <span class='tooltip-content'>120</span></div><div class='tooltip'>newMask == LHSMask<span class='tooltip-content'>111</span></div> || <div class='tooltip'>newMask == RHSMask<span class='tooltip-content'>111</span></div> || <div class='tooltip'>newMask == Mask<span class='tooltip-content'>111</span></div>) <div class='tooltip'>{<span class='tooltip-content'>9</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1438' href='#L_VECTOR_1438'><pre>1438</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> SmallVector<Constant*, 16> Elts;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1439' href='#L_VECTOR_1439'><pre>1439</pre></a></td><td class='covered-line'><pre>27</pre></td><td class='code'><pre> for (unsigned i = 0, e = newMask.size(); <div class='tooltip'>i != e<span class='tooltip-content'>27</span></div>; <div class='tooltip'>++i<span class='tooltip-content'>18</span></div>) <div class='tooltip'>{<span class='tooltip-content'>18</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1440' href='#L_VECTOR_1440'><pre>1440</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> if (<div class='tooltip'>newMask[i] < 0<span class='tooltip-content'>18</span></div>) <div class='tooltip'><span class='red'>{</span><span class='tooltip-content'>0</span></div></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1441' href='#L_VECTOR_1441'><pre>1441</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre><span class='red'> Elts.push_back(UndefValue::get(Int32Ty));</span></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1442' href='#L_VECTOR_1442'><pre>1442</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre><span class='red'> }</span> else {</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1443' href='#L_VECTOR_1443'><pre>1443</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> Elts.push_back(ConstantInt::get(Int32Ty, newMask[i]));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1444' href='#L_VECTOR_1444'><pre>1444</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1445' href='#L_VECTOR_1445'><pre>1445</pre></a></td><td class='covered-line'><pre>18</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1446' href='#L_VECTOR_1446'><pre>1446</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> if (!newRHS)</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1447' href='#L_VECTOR_1447'><pre>1447</pre></a></td><td class='uncovered-line'><pre>0</pre></td><td class='code'><pre> <span class='red'>newRHS = UndefValue::get(newLHS->getType())</span>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1448' href='#L_VECTOR_1448'><pre>1448</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> return new ShuffleVectorInst(newLHS, newRHS, ConstantVector::get(Elts));</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1449' href='#L_VECTOR_1449'><pre>1449</pre></a></td><td class='covered-line'><pre>9</pre></td><td class='code'><pre> }</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1450' href='#L_VECTOR_1450'><pre>1450</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1451' href='#L_VECTOR_1451'><pre>1451</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // If the result mask is an identity, replace uses of this instruction with</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1452' href='#L_VECTOR_1452'><pre>1452</pre></a></td><td class='covered-line'><pre>120</pre></td><td class='code'><pre> // corresponding argument.</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1453' href='#L_VECTOR_1453'><pre>1453</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> bool isLHSID, isRHSID;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1454' href='#L_VECTOR_1454'><pre>1454</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> recognizeIdentityMask(newMask, isLHSID, isRHSID);</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1455' href='#L_VECTOR_1455'><pre>1455</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> if (<div class='tooltip'>isLHSID && <span class='tooltip-content'>111</span></div><div class='tooltip'><span class='red'>VWidth == LHSOp0Width</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>return replaceInstUsesWith(SVI, newLHS)</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1456' href='#L_VECTOR_1456'><pre>1456</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> <div class='tooltip'>if (<span class='tooltip-content'>111</span></div><div class='tooltip'>isRHSID && <span class='tooltip-content'>111</span></div><div class='tooltip'><span class='red'>VWidth == RHSOp0Width</span><span class='tooltip-content'>0</span></div>) <div class='tooltip'><span class='red'>return replaceInstUsesWith(SVI, newRHS)</span><span class='tooltip-content'>0</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1457' href='#L_VECTOR_1457'><pre>1457</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre></pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1458' href='#L_VECTOR_1458'><pre>1458</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre> <div class='tooltip'>return MadeChange ? <span class='tooltip-content'>111</span></div><div class='tooltip'>&SVI<span class='tooltip-content'>1</span></div> : <div class='tooltip'>nullptr<span class='tooltip-content'>110</span></div>;</pre></td></tr><tr><td class='line-number'><a name='L_VECTOR_1459' href='#L_VECTOR_1459'><pre>1459</pre></a></td><td class='covered-line'><pre>111</pre></td><td class='code'><pre>}</pre></td></tr></table></div>
</body></html>