1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib
Max Kazantsev e9d1a19025 [InstCombine] Fix replace select with Phis when branch has the same labels
```
define i32 @test(i1 %cond) {
entry:
  br i1 %cond, label %exit, label %exit
exit:
  %result = select i1 %cond, i32 123, i32 456
  ret i32 %result
}
```
In this test, after applying transformation of replacing select with Phis,
the result will be:

```
define i32 @test(i1 %cond) {
entry:
  br i1 %cond, label %exit, label %exit
exit:
  %result = i32 phi [123, %exit], [123, %exit]
  ret i32 %result
}
```
That is, select is transformed into an invalid Phi, which will then be
reduced to 123 and the second value will be lost. But it is worth
noting that this problem will arise only if select is in the InstCombine
worklist will be before the branch. Otherwise, InstCombine will replace
the branch condition with false and transformation will not be applied.

The fix is to check the target labels in the branch condition for equality.

Patch By: Kirill Polushin
Differential Revision: https://reviews.llvm.org/D84003
Reviewed By: mkazantsev
2020-07-17 14:04:58 +07:00
..
Analysis [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison consider noundef 2020-07-17 12:53:08 +09:00
AsmParser Restore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP" 2020-07-14 12:16:57 -07:00
BinaryFormat AMDGPU: Remove .value_type from kernel metadata 2020-07-10 18:16:31 -04:00
Bitcode Temporarily revert "[NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)" 2020-07-10 15:21:00 -07:00
Bitstream [Bitcode] reserve in front of push_back loops. NFCI. 2020-05-01 15:52:53 +02:00
CodeGen [DebugInfo] Fix a misleading usage of DWARF forms with DIEExpr. NFCI. 2020-07-17 13:49:27 +07:00
DebugInfo [DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section. 2020-07-14 16:35:17 +07:00
Demangle Give microsoftDemangle() an outparam for how many input bytes were consumed. 2020-05-20 16:17:31 -04:00
DWARFLinker [Clang] Restore replace_path_prefix instead of startswith 2020-05-13 13:49:14 -04:00
ExecutionEngine [ORC] Switch from initializer lists to named arguments to work around MSVC. 2020-07-16 15:58:31 -07:00
Extensions
Frontend [OpenMP][IRBuilder] Support nested parallel regions 2020-07-14 22:39:06 -05:00
Fuzzer
FuzzMutate [NewPM][LSR] Rename strength-reduce -> loop-reduce 2020-07-02 11:15:29 -07:00
IR Temporarily Revert "[AssumeBundles] Use operand bundles to encode alignment assumptions" 2020-07-16 11:54:04 -07:00
IRReader Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
LineEditor
Linker [SVE] Eliminate calls to default-false VectorType::get() from Linker 2020-05-29 17:43:15 -07:00
LTO Remove GlobalValue::getAlignment(). 2020-06-23 19:13:42 -07:00
MC [WebAssembly] 64-bit (function) pointer fixes. 2020-07-16 14:10:22 -07:00
MCA [MCA][InstrBuilder] Correctly mark reserved resources in initializeUsedResources. 2020-05-10 19:25:54 +01:00
Object [WebAssembly] 64-bit (function) pointer fixes. 2020-07-16 14:10:22 -07:00
ObjectYAML [DWARFYAML] Merge forms that use same encodings. NFC. 2020-07-17 11:31:49 +08:00
Option
Passes [llvm] Moved InlineSizeEstimatorAnalysis test to .ll 2020-07-16 12:25:16 -07:00
ProfileData [PGO] Extend the value profile buckets for mem op sizes. 2020-07-15 10:26:15 -07:00
Remarks YAMLRemarkParser.cpp - remove duplicate RemarkParser.h include. NFC. 2020-06-08 13:59:05 +01:00
Support [RISCV] Add support for -mcpu option. 2020-07-16 11:46:22 -07:00
TableGen Fix ubsan error in tblgen with signed left shift 2020-06-16 11:15:09 -07:00
Target Revert "[AMDGPU/MemOpsCluster] Implement new heuristic for computing max mem ops cluster size" 2020-07-17 12:20:37 +05:30
Testing
TextAPI [TextAPI/MachO] Fix style issues. NFC 2020-06-24 14:43:45 -07:00
ToolDrivers [COFF] Use Expected in COFFObjectFile creation 2020-05-08 14:22:28 -07:00
Transforms [InstCombine] Fix replace select with Phis when branch has the same labels 2020-07-17 14:04:58 +07:00
WindowsManifest
XRay [xray] Add llvm-xray extract support for 32 bit ARM 2020-05-28 18:41:11 -04:00
CMakeLists.txt
LLVMBuild.txt