diff options
author | Florian Hahn <flo@fhahn.com> | 2019-11-17 21:29:55 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-11-17 21:30:14 +0000 |
commit | 8eeabbaf5da31f44b42f0ef7d625640570b0a620 (patch) | |
tree | 6fb5eeb827561f7034b7ee27ad6f22c84a959919 /llvm/test/Analysis | |
parent | 28c183859ae0e92b638721a738019fe7265910a5 (diff) | |
download | bcm5719-llvm-8eeabbaf5da31f44b42f0ef7d625640570b0a620.tar.gz bcm5719-llvm-8eeabbaf5da31f44b42f0ef7d625640570b0a620.zip |
[ConstantFold] Handle identity folds at top of ConstantFoldBinaryInst
Currently we miss folds with undef and identity values for binary ops
that do not fold to undef in general.
We can generalize the identity simplifications and do them before
checking for undef in particular.
Alive checks:
* OR - https://rise4fun.com/Alive/8OsK
* AND - https://rise4fun.com/Alive/e3tE
This will also allow us to remove some now redundant cases throughout
the function, but I would like to do this as follow-up. That should make
tracking down potential issues easier.
Reviewers: spatel, RKSimon, lebedev.ri
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D70169
Diffstat (limited to 'llvm/test/Analysis')
-rw-r--r-- | llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll b/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll index 7bb824dfb46..68307892187 100644 --- a/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll +++ b/llvm/test/Analysis/ConstantFolding/binop-identity-undef.ll @@ -3,7 +3,7 @@ define i32 @and1() { ; CHECK-LABEL: @and1( -; CHECK-NEXT: ret i32 0 +; CHECK-NEXT: ret i32 undef ; %r = and i32 undef, -1 ret i32 %r @@ -11,7 +11,7 @@ define i32 @and1() { define i32 @and2() { ; CHECK-LABEL: @and2( -; CHECK-NEXT: ret i32 0 +; CHECK-NEXT: ret i32 undef ; %r = and i32 -1, undef ret i32 %r @@ -27,7 +27,7 @@ define i32 @and3_no_identity() { define i32 @or1() { ; CHECK-LABEL: @or1( -; CHECK-NEXT: ret i32 -1 +; CHECK-NEXT: ret i32 undef ; %r = or i32 0, undef ret i32 %r @@ -35,7 +35,7 @@ define i32 @or1() { define i32 @or2() { ; CHECK-LABEL: @or2( -; CHECK-NEXT: ret i32 -1 +; CHECK-NEXT: ret i32 undef ; %r = or i32 undef, 0 ret i32 %r |