| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt < %s -passes=instcombine -S | FileCheck %s |
| |
| define ptr @f1(ptr %arg, i64 %arg1) { |
| ; CHECK-LABEL: @f1( |
| ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [6 x i32], ptr [[ARG:%.*]], i64 3, i64 [[ARG1:%.*]] |
| ; CHECK-NEXT: ret ptr [[TMP1]] |
| ; |
| %1 = getelementptr [6 x i32], ptr %arg, i64 3 |
| %2 = getelementptr [6 x i32], ptr %1, i64 0, i64 %arg1 |
| ret ptr %2 |
| } |
| |
| define ptr @f2(ptr %arg, i64 %arg1) { |
| ; CHECK-LABEL: @f2( |
| ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [6 x i32], ptr [[ARG:%.*]], i64 3 |
| ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr [6 x i32], ptr [[TMP1]], i64 [[ARG1:%.*]], i64 [[ARG1]] |
| ; CHECK-NEXT: ret ptr [[TMP2]] |
| ; |
| %1 = getelementptr [6 x i32], ptr %arg, i64 3 |
| %2 = getelementptr [6 x i32], ptr %1, i64 %arg1, i64 %arg1 |
| ret ptr %2 |
| } |