llvm-6502/lib
Pete Cooper 71a4b301fd Loop idiom recognizer was replacing too many uses of popcount.
When spotting that a loop can use ctpop, we were incorrectly replacing all uses of a value with a value derived from ctpop.

The bug here was exposed because we were replacing a use prior to the ctpop with the ctpop value and so we have a use before def, i.e., we changed

 %tobool.5 = icmp ne i32 %num, 0
 store i1 %tobool.5, i1* %ptr
 br i1 %tobool.5, label %for.body.lr.ph, label %for.end

to

 store i1 %1, i1* %ptr
 %0 = call i32 @llvm.ctpop.i32(i32 %num)
 %1 = icmp ne i32 %0, 0
 br i1 %1, label %for.body.lr.ph, label %for.end

Even if we inserted the ctpop so that it dominates the store here, that would still be incorrect.  The store doesn’t want the result of ctpop.

The fix is very simple, and involves replacing only the branch condition with the ctpop instead of all uses.

Reviewed by Hal Finkel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242068 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 21:25:33 +00:00
..
Analysis Cleanup after r241809 - remove uncessary call to std::sort 2015-07-13 14:48:24 +00:00
AsmParser Add argmemonly attribute. 2015-07-11 10:30:36 +00:00
Bitcode Add argmemonly attribute. 2015-07-11 10:30:36 +00:00
CodeGen [WinEH] Emit the LSDA even if no lpads remain but outlining occurred 2015-07-13 20:41:46 +00:00
DebugInfo Return ErrorOr from getSymbolAddress. 2015-07-03 18:19:00 +00:00
ExecutionEngine Fix the -DBUILD_SHARED_LIBS=ON build. 2015-07-07 17:48:00 +00:00
Fuzzer [lib/Fuzzer] make assertions more informative and update comments for the user-supplied mutator 2015-05-30 17:33:13 +00:00
IR Remove macro guards for extern template instantiations. 2015-07-13 17:21:31 +00:00
IRReader Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LibDriver Add support deterministic output in llvm-ar and make it the default. 2015-07-13 20:38:09 +00:00
LineEditor
Linker Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
LTO LTO: expose LTO_SYMBOL_ALIAS, which indicates that the symbol is an alias. 2015-07-04 03:42:35 +00:00
MC [MC] Correctly escape .safeseh's symbol 2015-07-13 18:51:15 +00:00
Object Add support deterministic output in llvm-ar and make it the default. 2015-07-13 20:38:09 +00:00
Option [Option] Plug a leak when move-assigning an InputArgList. 2015-06-23 15:28:10 +00:00
Passes [PM] Fixup for r231556 where I missed a dependency on intrinsics 2015-03-07 09:08:20 +00:00
ProfileData Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Support Remove macro guards for extern template instantiations. 2015-07-13 17:21:31 +00:00
TableGen [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC 2015-07-06 06:23:01 +00:00
Target [Hexagon] Move BitTracker into the llvm namespace and remove redundant qualifications 2015-07-13 20:38:16 +00:00
Transforms Loop idiom recognizer was replacing too many uses of popcount. 2015-07-13 21:25:33 +00:00
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00