diff options
| author | Philip Reames <listmail@philipreames.com> | 2019-08-23 18:27:57 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2019-08-23 18:27:57 +0000 |
| commit | 9cb059fdcc03e2144fa9aac0bfbb49c0d5d7efe2 (patch) | |
| tree | c4795fa7e15d38852c9d2c6235fac07960244852 /llvm/lib/Transforms | |
| parent | 2fd1afe8ef0726d8040d453bd15e07da831d7e51 (diff) | |
| download | bcm5719-llvm-9cb059fdcc03e2144fa9aac0bfbb49c0d5d7efe2.tar.gz bcm5719-llvm-9cb059fdcc03e2144fa9aac0bfbb49c0d5d7efe2.zip | |
Fix a bug in just submitted rL369789
Started implementing the vector case and realized the scalar case hadn't handled the GEP producing a different type than the base correctly. It's entertaining seeing what slips through review when we're focused on the 'hard' parts. :(
Also adding an extra vector test as it happened to be in workspace and wasn't worth separating.
llvm-svn: 369795
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 2bc21292b13..4e161d612cf 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -914,7 +914,10 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS, // In general, we're allowed to make values less poison (i.e. remove // sources of full UB), so in this case, we just select between the two // non-poison cases (1 and 4 above). - return new ICmpInst(Cond, GEPLHS->getPointerOperand(), RHS); + auto *Base = GEPLHS->getPointerOperand(); + return new ICmpInst(Cond, Base, + ConstantExpr::getBitCast(cast<Constant>(RHS), + Base->getType())); } else if (GEPOperator *GEPRHS = dyn_cast<GEPOperator>(RHS)) { // If the base pointers are different, but the indices are the same, just // compare the base pointer. |

