summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean whitespaces.Nadav Rotem2012-07-241-5/+5
| | | | llvm-svn: 160668
* Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.hChandler Carruth2012-06-291-6/+6
| | | | | | | | | | | | | | | | | This was always part of the VMCore library out of necessity -- it deals entirely in the IR. The .cpp file in fact was already part of the VMCore library. This is just a mechanical move. I've tried to go through and re-apply the coding standard's preferred header sort, but at 40-ish files, I may have gotten some wrong. Please let me know if so. I'll be committing the corresponding updates to Clang and Polly, and Duncan has DragonEgg. Thanks to Bill and Eric for giving the green light for this bit of cleanup. llvm-svn: 159421
* revert my previous commit (r159173), since as Eli pointed out, it's ↵Nuno Lopes2012-06-251-0/+1
| | | | | | perfectly ok to mark realloc as noalias llvm-svn: 159175
* do not set realloc() as NotAlias, since it can return the same pointer. This ↵Nuno Lopes2012-06-251-1/+0
| | | | | | whole thing should be upgraded to use the MemoryBuiltin interface anyway.. llvm-svn: 159173
* Teach SimplifyLibCalls about stpcpy.David Majnemer2012-05-151-7/+54
| | | | llvm-svn: 156815
* fix pr12559: mark unavailable win32 math libcallsJoe Groff2012-04-171-15/+10
| | | | | | also fix SimplifyLibCalls to use TLI rather than compile-time conditionals to enable optimizations on floor, ceil, round, rint, and nearbyint llvm-svn: 154960
* reapply the patches reverted in r149470 that reenable ConstantDataArray,Chris Lattner2012-02-051-56/+60
| | | | | | | | | but with a critical fix to the SelectionDAG code that optimizes copies from strings into immediate stores: the previous code was stopping reading string data at the first nul. Address this by adding a new argument to llvm::getConstantStringInfo, preserving the behavior before the patch. llvm-svn: 149800
* Revert Chris' commits up to r149348 that started causing VMCoreTests unit ↵Argyrios Kyrtzidis2012-02-011-60/+56
| | | | | | | | | | | | | | | | | | | test to fail. These are: r149348 r149351 r149352 r149354 r149356 r149357 r149361 r149362 r149364 r149365 llvm-svn: 149470
* eliminate the last uses of GetConstantStringInfo from this file, I didn't ↵Chris Lattner2012-01-311-7/+7
| | | | | | realize I was that close... llvm-svn: 149354
* start moving SimplifyLibcalls over to getConstantStringInfo, which isChris Lattner2012-01-311-49/+53
| | | | | | dramatically more efficient than GetConstantStringInfo. llvm-svn: 149352
* Turn cos(-x) into cos(x). Patch by Alexander Malyshev!Nick Lewycky2011-12-271-5/+27
| | | | llvm-svn: 147291
* Only replace fwrite with fputc, if the return value is unused.Joerg Sonnenberger2011-12-121-1/+2
| | | | llvm-svn: 146411
* Switch llvm.cttz and llvm.ctlz to accept a second i1 parameter whichChandler Carruth2011-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | indicates whether the intrinsic has a defined result for a first argument equal to zero. This will eventually allow these intrinsics to accurately model the semantics of GCC's __builtin_ctz and __builtin_clz and the X86 instructions (prior to AVX) which implement them. This patch merely sets the stage by extending the signature of these intrinsics and establishing auto-upgrade logic so that the old spelling still works both in IR and in bitcode. The upgrade logic preserves the existing (inefficient) semantics. This patch should not change any behavior. CodeGen isn't updated because it can use the existing semantics regardless of the flag's value. Note that this will be followed by API updates to Clang and DragonEgg. Reviewed by Nick Lewycky! llvm-svn: 146357
* Add support for custom names for library functions in TargetLibraryInfo. ↵Eli Friedman2011-11-171-7/+13
| | | | | | | | | | 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
* StringRefize and simplify.Benjamin Kramer2011-11-151-2/+1
| | | | llvm-svn: 144675
* SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string ↵Benjamin Kramer2011-10-291-4/+2
| | | | | | | | for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable. Fixes PR11264. llvm-svn: 143289
* PR11061: Make simplifylibcalls fold strcmp("", x) correctly.Eli Friedman2011-10-051-13/+18
| | | | | | While I'm here, fix the related issue with strncmp, add some actual tests for strcmp and strncmp, and start using StringRef::compare for constant folding instead of using strcmp/strncmp so that the optimized IR isn't dependent on the host's implementation of strcmp. llvm-svn: 141227
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-271-7/+7
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. llvm-svn: 140634
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-33/+33
| | | | llvm-svn: 135375
* Change Intrinsic::getDeclaration and friends to take an ArrayRef.Benjamin Kramer2011-07-141-1/+1
| | | | llvm-svn: 135154
* Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad2011-07-121-1/+1
| | | | | | StructType::get() and TargetData::getIntPtrType(). llvm-svn: 134982
* Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling2011-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp llvm-svn: 134949
* De-constify Types in FunctionType::get().Jay Foad2011-07-111-1/+1
| | | | llvm-svn: 134888
* Preserve line number information while simplifying libcalls.Devang Patel2011-03-091-0/+3
| | | | llvm-svn: 127362
* Fix typo in comment.Richard Osborne2011-03-031-1/+1
| | | | llvm-svn: 126941
* Optimize fprintf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-031-8/+28
| | | | | | and siprintf is available on the target. llvm-svn: 126940
* Optimize sprintf -> siprintf if there are no floating point argumentsRichard Osborne2011-03-031-8/+28
| | | | | | and siprintf is available on the target. llvm-svn: 126937
* Optimize printf -> iprintf if there are no floating point argumentsRichard Osborne2011-03-031-10/+42
| | | | | | | and iprintf is available on the target. Currently iprintf is only marked as being available on the XCore. llvm-svn: 126935
* wire TargetLibraryInfo into simplify libcalls and use it in a couple ofChris Lattner2011-02-241-7/+17
| | | | | | trivial places. This pass needs a lot of work. llvm-svn: 126367
* move a massive amount of code out into its own helper functionChris Lattner2011-02-241-676/+643
| | | | | | to reduce nesting. This needs to be turned into a table. llvm-svn: 126366
* SimplifyLibCalls: Add missing legalize check on various printf to puts andDaniel Dunbar2011-02-121-5/+9
| | | | | | putchar transforms, their return values are not compatible. llvm-svn: 125442
* SimplifyLibCalls: Use IRBuilder to simplify code.Benjamin Kramer2010-12-271-67/+48
| | | | llvm-svn: 122575
* Revert r64460. strtol and friends cannot be marked readonly, even withDan Gohman2010-12-171-1/+2
| | | | | | | | | a null endptr argument, because they may write to errno. This fixes a seflhost miscompile observed on Linux targets when TBAA was enabled. llvm-svn: 122014
* Add a puts optimization that converts puts() to putchar('\n').Anders Carlsson2010-11-301-3/+30
| | | | llvm-svn: 120398
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Tighten up prototype verification of strchr and strrchr to avoid a crash in ↵Benjamin Kramer2010-09-301-2/+4
| | | | | | the very unlikely case that someone passes an integer > i64 to strchr. llvm-svn: 115144
* Add constant folding for strspn and strcspn to SimplifyLibCalls.Benjamin Kramer2010-09-301-9/+64
| | | | llvm-svn: 115116
* Add strpbrk folding to SimplifyLibCalls.Benjamin Kramer2010-09-291-7/+42
| | | | llvm-svn: 115111
* Simplify the loop in StrChrOptimizer. FileCheckize test.Benjamin Kramer2010-09-291-11/+4
| | | | llvm-svn: 115095
* Teach SimplifyLibCalls how to optimize strrchr.Benjamin Kramer2010-09-291-6/+44
| | | | llvm-svn: 115091
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Fix a comment.Dan Gohman2010-08-041-1/+1
| | | | llvm-svn: 110181
* mass elimination of reliance on automatic iterator dereferencingGabor Greif2010-07-221-1/+1
| | | | llvm-svn: 109103
* undo 80 column trespassing I causedGabor Greif2010-07-221-8/+9
| | | | llvm-svn: 109092
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | llvm-svn: 109045
* Detabify this file.Nick Lewycky2010-07-061-7/+7
| | | | llvm-svn: 107637
* use ArgOperand APIGabor Greif2010-06-301-10/+12
| | | | llvm-svn: 107278
OpenPOWER on IntegriCloud