llvm-mirror/lib
Guozhi Wei 14476b73f7 [InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996
The original patch of the A->B->A BitCast optimization was reverted by r274094 because it may cause infinite loop inside compiler https://llvm.org/bugs/show_bug.cgi?id=27996.

The problem is with following code

xB = load (type B); 
xA = load (type A); 
+yA = (A)xB; B -> A
+zAn = PHI[yA, xA]; PHI 
+zBn = (B)zAn; // A -> B
store zAn;
store zBn;

optimizeBitCastFromPhi generates

+zBn = (B)zAn; // A -> B

and expects it will be combined with the following store instruction to another

store zAn 

Unfortunately before combineStoreToValueType is called on the store instruction, optimizeBitCastFromPhi is called on the new BitCast again, and this pattern repeats indefinitely.

optimizeBitCastFromPhi only generates BitCast for load/store instructions, only the BitCast before store can cause the reexecution of optimizeBitCastFromPhi, and BitCast before store can easily be handled by InstCombineLoadStoreAlloca.cpp. So the solution to the problem is if all users of a CI are store instructions, we should not do optimizeBitCastFromPhi on it. Then optimizeBitCastFromPhi will not be called on the new BitCast instructions.

Differential Revision: https://reviews.llvm.org/D23896

llvm-svn: 285116
2016-10-25 20:43:42 +00:00
..
Analysis Fix regression from my recent GlobalsAA fix. 2016-10-24 21:47:44 +00:00
AsmParser DebugInfo: preparation to implement DW_AT_alignment 2016-10-20 00:13:12 +00:00
Bitcode Fix spelling mistake in comment. 2016-10-20 10:42:14 +00:00
CodeGen revert: "Remove debug location from common tail when tail-merging" 2016-10-25 20:17:58 +00:00
DebugInfo [pdb] added support for dumping globals stream 2016-10-21 19:43:19 +00:00
Demangle Avoid using alignas and constexpr. 2016-09-06 20:36:24 +00:00
ExecutionEngine Fix cross-endianness RuntimeDyld relocation for ARM 2016-10-20 22:15:56 +00:00
Fuzzer [libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired bytes. Add another test for use_cmp 2016-10-25 20:15:15 +00:00
IR Add -strip-nonlinetable-debuginfo capability 2016-10-25 18:44:13 +00:00
IRReader Remove autoconf support 2016-01-26 21:29:08 +00:00
LibDriver Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI. 2016-06-29 22:27:42 +00:00
LineEditor Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes. 2016-03-28 17:40:08 +00:00
Linker Typo: nomed struct -> named struct 2016-10-19 20:10:03 +00:00
LTO fix warning 2016-10-25 12:28:26 +00:00
MC [MC] Fix Various End Of Line Comment checkings 2016-10-24 14:35:29 +00:00
Object nother additional error check for an invalid Mach-O file 2016-10-24 21:15:11 +00:00
ObjectYAML [macho2yaml] Don't write empty linkedit data 2016-08-17 21:46:04 +00:00
Option Generalize ArgList::AddAllArgs more 2016-09-29 19:47:58 +00:00
Passes Conditionally eliminate library calls where the result value is not used 2016-10-18 21:36:27 +00:00
ProfileData Retire llvm::alignOf in favor of C++11 alignof. 2016-10-20 15:02:18 +00:00
Support [APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC. 2016-10-25 19:55:59 +00:00
TableGen Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-23 17:14:32 +00:00
Target [AArch64] Adjust the cost model for Exynos M1. 2016-10-25 20:05:42 +00:00
Transforms [InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996 2016-10-25 20:43:42 +00:00
CMakeLists.txt Try to fix a circular dependency in the modules build. 2016-09-06 20:16:19 +00:00
LLVMBuild.txt Add an c++ itanium demangler to llvm. 2016-09-06 19:16:48 +00:00