llvm-project/llvm/unittests/CodeGen/GlobalISel
Quentin Colombet 5bf0023b0d [GISel][KnownBits] Update a comment regarding the effect of cache on PHIs
Unlike what I claimed in my previous commit. The caching is
actually not NFC on PHIs.

When we put a big enough max depth, we end up simulating loops.
The cache is effectively cutting the simulation short and we
get less information as a result.
E.g.,
```
v0 = G_CONSTANT i8 0xC0
jump
v1 = G_PHI i8 v0, v2
v2 = G_LSHR i8 v1, 1
```

Let say we want the known bits of v1.
- With cache:
Set v1 cache to we know nothing
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is in the cache
=> v1 is 0, thus v2 is 0x80
Finally v1 is v0 & v2 => 0x80

- Without cache and enough depth to do two iteration of the loop:
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is v0 & v2
v0 is 0xC0
v2 is v1 >> 1
Reach the max depth for v1...
unwinding
v1 is know nothing
v2 is 0x80
v0 is 0xC0
v1 is 0x80
v2 is 0xC0
v0 is 0xC0
v1 is 0xC0

Thus now v1 is 0xC0 instead of 0x80.

I've added a unittest demonstrating that.

NFC
2020-02-25 15:56:15 -08:00
..
CMakeLists.txt [Legalizer] Refactoring out legalizeMachineFunction 2019-12-13 15:45:18 -08:00
CSETest.cpp GlobalISel: Allow CSE of G_IMPLICIT_DEF 2020-02-05 17:47:21 -05:00
ConstantFoldingTest.cpp [CodeGen] Make use of MachineInstrBuilder::getReg 2020-01-23 13:38:13 +00:00
GISelMITest.cpp GlobalISel: Improve gtest usage 2019-02-04 18:58:27 +00:00
GISelMITest.h [GlobalISel] Legalize more G_FP(EXT|TRUNC) libcalls. 2020-02-06 11:41:34 -08:00
KnownBitsTest.cpp [GISel][KnownBits] Update a comment regarding the effect of cache on PHIs 2020-02-25 15:56:15 -08:00
LegalizerHelperTest.cpp GlobalISel: Fix narrowing of G_CTLZ/G_CTTZ 2020-02-09 18:11:43 -05:00
LegalizerInfoTest.cpp GlobalISel: Add alignment to LegalityQuery MMOs 2019-02-14 22:41:09 +00:00
LegalizerTest.cpp Fix Wpedantic 'extra semicolon' warning. NFC. 2019-12-21 17:32:00 +00:00
MachineIRBuilderTest.cpp [CodeGen] Make use of MachineInstrBuilder::getReg 2020-01-23 13:38:13 +00:00
PatternMatchTest.cpp GlobalISel: Add matcher for G_LSHR 2020-02-17 09:20:13 -05:00