Derek Schuff | 1b258d3 | 2016-08-31 20:27:20 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
Benjamin Kramer | 41b6124 | 2017-05-29 16:32:52 +0000 | [diff] [blame] | 4 | target triple = "wasm32---elf" |
Derek Schuff | 1b258d3 | 2016-08-31 20:27:20 +0000 | [diff] [blame] | 5 | |
| 6 | @args = hidden local_unnamed_addr global [32 x i32] zeroinitializer, align 16 |
| 7 | |
| 8 | ; Function Attrs: norecurse nounwind |
| 9 | define hidden i32 @main() local_unnamed_addr #0 { |
| 10 | |
| 11 | ; If LSR stops selecting a negative base reg value, then this test will no |
| 12 | ; longer be useful as written. |
| 13 | ; CHECK: i32.const $0=, -128 |
| 14 | entry: |
| 15 | br label %for.body |
| 16 | |
| 17 | for.body: ; preds = %for.body, %entry |
| 18 | %i.04 = phi i32 [ 0, %entry ], [ %inc, %for.body ] |
| 19 | ; The offset should not be folded into the store. |
| 20 | ; CHECK: i32.const $push{{[0-9]+}}=, args+128 |
| 21 | ; CHECK: i32.add |
Dan Gohman | 7f1bdb2 | 2016-10-06 22:08:28 +0000 | [diff] [blame] | 22 | ; CHECK: i32.store 0( |
Derek Schuff | 1b258d3 | 2016-08-31 20:27:20 +0000 | [diff] [blame] | 23 | %arrayidx = getelementptr inbounds [32 x i32], [32 x i32]* @args, i32 0, i32 %i.04 |
| 24 | store i32 1, i32* %arrayidx, align 4, !tbaa !1 |
| 25 | %inc = add nuw nsw i32 %i.04, 1 |
| 26 | %exitcond = icmp eq i32 %inc, 32 |
| 27 | br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5 |
| 28 | |
| 29 | for.end: ; preds = %for.body |
| 30 | ret i32 0 |
| 31 | } |
| 32 | |
| 33 | attributes #0 = { norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 34 | |
| 35 | !llvm.ident = !{!0} |
| 36 | |
| 37 | !0 = !{!"clang version 4.0.0 (trunk 279056) (llvm/trunk 279074)"} |
| 38 | !1 = !{!2, !2, i64 0} |
| 39 | !2 = !{!"int", !3, i64 0} |
| 40 | !3 = !{!"omnipotent char", !4, i64 0} |
| 41 | !4 = !{!"Simple C/C++ TBAA"} |
| 42 | !5 = distinct !{!5, !6} |
| 43 | !6 = !{!"llvm.loop.unroll.disable"} |