Pete Cooper
fdddc27143
Improved fix for abs(val) != 0 to check other similar case. Also fixed style issues and confusing comment
...
llvm-svn: 145618
2011-12-01 19:13:26 +00:00
Kostya Serebryany
d594bac68b
[asan] two minor fixes: use UnreachableInst after the neverreturn function call; use report_fatal_error when blacklist file can not be found
...
llvm-svn: 145611
2011-12-01 18:54:53 +00:00
Pete Cooper
bc5c524b71
Added instcombine pattern to spot comparing -val or val against 0.
...
(val != 0) == (-val != 0) so "abs(val) != 0" becomes "val != 0"
Fixes <rdar://problem/10482509>
llvm-svn: 145563
2011-12-01 03:58:40 +00:00
Chad Rosier
c24b86ffbe
Propagate TargetLibraryInfo throughout ConstantFolding.cpp and
...
InstructionSimplify.cpp. Other fixups as needed.
Part of rdar://10500969
llvm-svn: 145559
2011-12-01 03:08:23 +00:00
Kostya Serebryany
dc436f95d2
make asan work at -O0, llvm part. Patch by glider@google.com
...
llvm-svn: 145530
2011-11-30 22:19:26 +00:00
Eli Friedman
6cff9df298
Make GlobalMerge honor the preferred alignment on globals without an explicitly specified alignment.
...
<rdar://problem/10497732>.
llvm-svn: 145523
2011-11-30 21:54:15 +00:00
Chad Rosier
385d9f6c24
Whitespace.
...
llvm-svn: 145470
2011-11-30 01:59:59 +00:00
Chad Rosier
82e1bd8e94
Add support for sqrt, sqrtl, and sqrtf in TargetLibraryInfo. Disable
...
(fptrunc (sqrt (fpext x))) -> (sqrtf x) transformation if -fno-builtin is
specified.
rdar://10466410
llvm-svn: 145460
2011-11-29 23:57:10 +00:00
Stepan Dyatkovskiy
31798ef3c0
Potential bug in RewriteLoopBodyWithConditionConstant: use iterator should not be changed inside the uses enumeration loop.
...
llvm-svn: 145432
2011-11-29 20:34:39 +00:00
Daniel Dunbar
539d0a8a09
build/CMake: Finish removal of add_llvm_library_dependencies.
...
llvm-svn: 145420
2011-11-29 19:25:30 +00:00
Duncan Sands
ca6f8ddbf8
Fix a theoretical problem (not seen in the wild): if different instances of a
...
weak variable are compiled by different compilers, such as GCC and LLVM, while
LLVM may increase the alignment to the preferred alignment there is no reason to
think that GCC will use anything more than the ABI alignment. Since it is the
GCC version that might end up in the final program (as the linkage is weak), it
is wrong to increase the alignment of loads from the global up to the preferred
alignment as the alignment might only be the ABI alignment.
Increasing alignment up to the ABI alignment might be OK, but I'm not totally
convinced that it is. It seems better to just leave the alignment of weak
globals alone.
llvm-svn: 145413
2011-11-29 18:26:38 +00:00
Andrew Trick
d25089f8e0
SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.
...
This reverts r139450, fixes r139453, and adds much needed comments and a
unit test.
llvm-svn: 145367
2011-11-29 02:16:38 +00:00
Eli Friedman
7534b46884
Zap some completely ridiculous code. There's probably a miscompile here, but I don't really want to try to write a testcase involving an invoke returning a pointer to a varargs function...
...
llvm-svn: 145347
2011-11-29 01:18:23 +00:00
Eli Friedman
b3f9b0676a
Add a missing safety check to ProcessUGT_ADDCST_ADD. Fixes PR11438.
...
llvm-svn: 145316
2011-11-28 23:32:19 +00:00
Andrew Trick
a8bdb7cbf1
Remove the temporary flag -disable-unroll-scev and dead code.
...
SCEV should now be used for trip count analysis, not LoopInfo.
llvm-svn: 145262
2011-11-28 19:22:09 +00:00
Nick Lewycky
6404d97a99
Place the "cfg checksum" around a test. This was recently added in April 2011 to
...
gcc, though I thought it was older (my gcc 4.4 has it as a local patch. Whoops!)
This fixes PR10589.
Also add some debugging statements.
Remove GcnoFiles, the mapping from CompilationUnit to raw_ostream. Now that we
start by iterating over each CU and descending into them, there's no need to
maintain a mapping.
llvm-svn: 145208
2011-11-27 23:22:20 +00:00
Benjamin Kramer
7ba71be392
Move code into anonymous namespaces.
...
llvm-svn: 145154
2011-11-26 23:01:57 +00:00
Kostya Serebryany
8b5c7a56a3
[asan] do not instrument threadlocal globals, this is buggy
...
llvm-svn: 145092
2011-11-23 02:10:54 +00:00
Nick Lewycky
612d70b19d
Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.
...
Suggested in code review by Eli.
That code in InstCombine looks kinda suspicious.
llvm-svn: 145013
2011-11-20 19:09:04 +00:00
Kostya Serebryany
1cdc6e9567
[asan] workaround for reg alloc bug 11395: don't instrument functions with large chunks of inline assembler
...
llvm-svn: 144962
2011-11-18 01:41:06 +00:00
Kostya Serebryany
a6edf4c21f
quick fix: remove GlobalVariable::GlobalVariable mistakenly commited at r144933. For some reason this compiles on linux
...
llvm-svn: 144936
2011-11-17 23:37:53 +00:00
Andrew Trick
949045864d
Fix an overly general check in SimplifyIndvar to handle useless phi cycles.
...
The right way to check for a binary operation is
cast<BinaryOperator>. The original check: cast<Instruction> &&
numOperands() == 2 would match phi "instructions", leading to an
infinite loop in extreme corner case: a useless phi with operands
[self, constant] that prior optimization passes failed to remove,
being used in the loop by another useless phi, in turn being used by an
lshr or udiv.
Fixes PR11350: runaway iteration assertion.
llvm-svn: 144935
2011-11-17 23:36:35 +00:00
Kostya Serebryany
65e2211b95
fall back to explicit list of allowed linkages when instrumenting globals in asan; add a test check that asan does not touch linkonce_odr
...
llvm-svn: 144933
2011-11-17 23:14:59 +00:00
Eli Friedman
489c0ff4a4
Add support for custom names for library functions in TargetLibraryInfo. Add a custom name for fwrite and fputs on x86-32 OSX. Make SimplifyLibCalls honor the custom
...
names for fwrite and fputs.
Fixes <rdar://problem/9815881>.
llvm-svn: 144876
2011-11-17 01:27:36 +00:00
Nick Lewycky
c7f1e7993c
Merge isObjectPointerWithTrustworthySize with getPointerSize. Use it when
...
looking at the size of the pointee. Fixes PR11390!
llvm-svn: 144773
2011-11-16 03:49:48 +00:00
Kostya Serebryany
6e6b03ec46
AddressSanitizer, first commit (compiler module only)
...
llvm-svn: 144758
2011-11-16 01:35:23 +00:00
Kostya Serebryany
db999c01f2
test commit to verify that commit access works (added blank line)
...
llvm-svn: 144748
2011-11-16 01:14:38 +00:00
Nadav Rotem
51f71054b6
Fix MSVC warnings by adding a cast.
...
llvm-svn: 144721
2011-11-15 22:54:21 +00:00
Benjamin Kramer
b106bcc536
StringRefize and simplify.
...
llvm-svn: 144675
2011-11-15 19:12:09 +00:00
Benjamin Kramer
1f97a5a671
Remove all remaining uses of Value::getNameStr().
...
llvm-svn: 144648
2011-11-15 16:27:03 +00:00
Benjamin Kramer
d00e94e882
Make headers standalone, move a virtual method out of line.
...
llvm-svn: 144536
2011-11-14 17:22:45 +00:00
Daniel Dunbar
52823cc91c
build: Attempt to rectify inconsistencies between CMake and LLVMBuild versions of explicit dependencies.
...
- The hope is that we have a tool/test to verify these are accurate (and tight) soon.
llvm-svn: 144444
2011-11-12 02:10:57 +00:00
Eli Friedman
ecb453805d
Make sure scalarrepl picks the correct alloca when it rewrites a bitcast. Fixes PR11353.
...
llvm-svn: 144442
2011-11-12 02:07:50 +00:00
Daniel Dunbar
2f39f72703
LLVMBuild: Alphabetize required_libraries lists.
...
llvm-svn: 144416
2011-11-11 22:59:23 +00:00
Eli Friedman
0a309292c4
Get rid of an optimization in SCCP which appears to have many issues. Specifically, it doesn't handle many cases involving undef correctly, and it is missing other checks which
...
lead to it trying to re-mark a value marked as a constant with a different value. It also appears to trigger very rarely.
Fixes PR11357.
llvm-svn: 144352
2011-11-11 01:16:15 +00:00
Pete Cooper
a4237c380e
Fixed bug in DeadStoreElimination commit r144239
...
Size of data being pointed to wasn't always being checked so some small writes were killing big writes
Fixes <rdar://problem/10426753>
llvm-svn: 144312
2011-11-10 20:22:08 +00:00
Pete Cooper
856977cb15
DeadStoreElimination can now trim the size of a store if the end of the store is dead.
...
Currently checks alignment and killing stores on a power of 2 boundary as this is likely
to trim the size of the earlier store without breaking large vector stores into scalar ones.
Fixes <rdar://problem/10140300>
llvm-svn: 144239
2011-11-09 23:07:35 +00:00
Pete Cooper
9ee220915b
LICM pass now understands invariant load metadata. Nothing generates this yet so it will currently never get used in real tests
...
llvm-svn: 144107
2011-11-08 19:30:00 +00:00
Pete Cooper
7a4be01ac8
InstCombine now optimizes vector udiv by power of 2 to shifts
...
Fixes r8429
llvm-svn: 144036
2011-11-07 23:04:49 +00:00
Bill Wendling
7496461f44
Make sure we don't insert instructions before a landingpad instruction.
...
<rdar://problem/10405911>
llvm-svn: 144000
2011-11-07 19:38:34 +00:00
Nick Lewycky
f2905afe62
Do simple cross-block DSE when we encounter a free statement. Fixes PR11240.
...
llvm-svn: 143808
2011-11-05 10:48:42 +00:00
Daniel Dunbar
e6d40de414
Speculatively revert "DeadStoreElimination can now trim the size of a store if
...
the end of it is dead.", which appears to break bootstrapping LLVM.
llvm-svn: 143668
2011-11-04 00:48:26 +00:00
Daniel Dunbar
bf9bba47a1
build: Add initial cut at LLVMBuild.txt files.
...
llvm-svn: 143634
2011-11-03 18:53:17 +00:00
Pete Cooper
8a95aedb5d
DeadStoreElimination can now trim the size of a store if the end of it is dead.
...
Only currently done if the later store is writing to a power of 2 address or
has the same alignment as the earlier store as then its likely to not break up
large stores into smaller ones
Fixes <rdar://problem/10140300>
llvm-svn: 143630
2011-11-03 18:01:56 +00:00
Andrew Trick
c2c79c90f2
Rewrite LinearFunctionTestReplace to handle pointer-type IVs.
...
We've been hitting asserts in this code due to the many supported
combintions of modes (iv-rewrite/no-iv-rewrite) and IV types. This
second rewrite of the code attempts to deal with these cases systematically.
llvm-svn: 143546
2011-11-02 17:19:57 +00:00
Chandler Carruth
9dba8af074
Add parentheses to disambiguate the precedence of these operations and
...
silence -Wparentheses.
llvm-svn: 143534
2011-11-02 05:43:44 +00:00
Andrew Trick
0dae890346
Broaden an assert to handle enable-iv-rewrite=true following r143183.
...
Narrowest possible fix for PR11279.
llvm-svn: 143522
2011-11-02 00:02:45 +00:00
Eli Friedman
a49b828f8f
Make sure we use the right insertion point when instcombine replaces a PHI with another instruction. (Specifically, don't insert an arbitrary instruction before a PHI.) Fixes PR11275.
...
llvm-svn: 143437
2011-11-01 04:49:29 +00:00
Devang Patel
f4af8c65aa
Add utility to append a function to the list of global constructors.
...
Patch by Kostya Serebryany.
llvm-svn: 143405
2011-10-31 23:58:51 +00:00
Benjamin Kramer
594ee77964
SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable.
...
Fixes PR11264.
llvm-svn: 143289
2011-10-29 19:43:31 +00:00