aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-06-20 23:52:14 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-06 18:30:44 +0200
commit9aa1c8656be5fee7394cb242a80d7ea8eed32385 (patch)
tree499fd2c3b3154ac371873dae541798cab2e021c0 /validation/optim
parentc2a5bd264187f42564b7055bce4cf72a7985cbc5 (diff)
downloadsparse-dev-9aa1c8656be5fee7394cb242a80d7ea8eed32385.tar.gz
bad-shift: wait dead code elimination to warn about bad shifts
Sparse complains when a shift amount is too big for the size of its operand or if it's negative. However, it does this even for expressions that are never evaluated. It's especially annoying in the kernel for type generic macros, for example the ones in arch/*/include/asm/cmpxchg.h So, remove all warnings done at expansion time and avoid any simplifications of such expressions. Same, at linearization and optimization time but in this case mark the instructions as 'tainted' to inhibit any further simplifications. Finally, at the end of the optimization phase, warn for the tainted instructions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
-rw-r--r--validation/optim/shift-big.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/validation/optim/shift-big.c b/validation/optim/shift-big.c
index 84bcd2ce..e7bf22fe 100644
--- a/validation/optim/shift-big.c
+++ b/validation/optim/shift-big.c
@@ -50,13 +50,15 @@ lsr31:
lsr32:
.L8:
<entry-point>
- ret.32 $0
+ lsr.32 %r14 <- %arg1, $32
+ ret.32 %r14
lsr33:
.L10:
<entry-point>
- ret.32 $0
+ lsr.32 %r17 <- %arg1, $33
+ ret.32 %r17
shl31:
@@ -69,13 +71,15 @@ shl31:
shl32:
.L14:
<entry-point>
- ret.32 $0
+ shl.32 %r23 <- %arg1, $32
+ ret.32 %r23
shl33:
.L16:
<entry-point>
- ret.32 $0
+ shl.32 %r26 <- %arg1, $33
+ ret.32 %r26
* check-output-end