Since we already assert that the outgoing IR is in LCSSA, it is easy to
get misled into thinking that -indvars broke LCSSA if the incoming IR is
non-LCSSA. Checking this pre-condition will make such cases break in
more obvious ways.
Inspired by (but does _not_ fix) PR26682.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271196 91177308-0d34-0410-b5e6-96231b3b80d8
This will be used in a follow up commit to simplify code in clang that creates a ConstantDataVector and calls the other form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271164 91177308-0d34-0410-b5e6-96231b3b80d8
Consolidate documentation by removing comments from the .cpp file where
the comments in the .cpp file were copy-pasted from the header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271157 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
If we can prove that an op.with.overflow intrinsic does not overflow, we
can get rid of the intrinsic, and replace it with non-wrapping
arithmetic.
This was first checked in at r265913 but reverted in r265950 because it
exposed some issues around how SCEV handled post-inc add recurrences.
Those issues have now been fixed.
Reviewers: atrick, regehr
Subscribers: sanjoy, mcrosier, llvm-commits
Differential Revision: http://reviews.llvm.org/D18685
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271153 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
This change teaches SCEV to see reduce `(extractvalue
0 (op.with.overflow X Y))` into `op X Y` (with a no-wrap tag if
possible).
This was first checked in at r265912 but reverted in r265950 because it
exposed some issues around how SCEV handled post-inc add recurrences.
Those issues have now been fixed.
Reviewers: atrick, regehr
Subscribers: mcrosier, mzolotukhin, llvm-commits
Differential Revision: http://reviews.llvm.org/D18684
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271152 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes PR27315.
The post-inc version of an add recurrence needs to "follow the same
rules" as a normal add or subtract expression. Otherwise we miscompile
programs like
```
int main() {
int a = 0;
unsigned a_u = 0;
volatile long last_value;
do {
a_u += 3;
last_value = (long) ((int) a_u);
if (will_add_overflow(a, 3)) {
// Leave, and don't actually do the increment, so no UB.
printf("last_value = %ld\n", last_value);
exit(0);
}
a += 3;
} while (a != 46);
return 0;
}
```
This patch changes SCEV to put no-wrap flags on post-inc add recurrences
only when the poison from a potential overflow will go ahead to cause
undefined behavior.
To avoid regressing performance too much, I've assumed infinite loops
without side effects is undefined behavior to prove poison<->UB
equivalence in more cases. This isn't ideal, but is not new to LLVM as
a whole, and far better than the situation I'm trying to fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271151 91177308-0d34-0410-b5e6-96231b3b80d8
This is a stripped down version of D19211, leaving out the questionable
"branching in poison is UB" bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271150 91177308-0d34-0410-b5e6-96231b3b80d8
This patch removes the llvm intrinsics VPMOVSX and (V)PMOVZX sign/zero extension intrinsics and auto-upgrades to SEXT/ZEXT calls instead. We already did this for SSE41 PMOVSX sometime ago so much of that implementation can be reused.
Reapplied now that the the companion patch (D20684) removes/auto-upgrade the clang intrinsics has been committed.
Differential Revision: http://reviews.llvm.org/D20686
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271131 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
When RF_NullMapMissingGlobalValues is set, mapValue can return null
for GlobalValue. When mapping the operands of a constant that is
referenced from metadata, we need to handle this case and actually
return null instead of mapping this constant.
Reviewers: dexonsmith, rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D20713
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271129 91177308-0d34-0410-b5e6-96231b3b80d8
We were producing R_X86_64_GOTPCRELX for invalid instructions and
sometimes producing R_X86_64_GOTPCRELX instead of
R_X86_64_REX_GOTPCRELX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271118 91177308-0d34-0410-b5e6-96231b3b80d8
This converts remaining uses of ByteStream, which was still
left in the symbol stream and type stream, to using the new
StreamInterface zero-copy classes.
RecordIterator is finally deleted, so this is the only way left
now. Additionally, more error checking is added when iterating
the various streams.
With this, the transition to zero copy pdb access is complete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271101 91177308-0d34-0410-b5e6-96231b3b80d8
This reverts commit r271096, as reverting it broke even more buildbots!
But that also means I'll break on ARM again... :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271099 91177308-0d34-0410-b5e6-96231b3b80d8
It was triggering an msan bot.
Revert "[IRPGO] Set the function entry count metadata."
This reverts commit r271090.
Revert "[IRPGO] Centralize the function attribute inliner hint logic. NFC."
This reverts commit r271089.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271091 91177308-0d34-0410-b5e6-96231b3b80d8
Composing subreg_loreg with subreg_oveflow leads to strange results with
lane masks for register classes with subreg_loreg. In particular, dead
lane detection generates incorrect code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271087 91177308-0d34-0410-b5e6-96231b3b80d8