1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=instcombine -S -o - %s | FileCheck %s
3 ; Test that we don't replace an alias with its aliasee when simplifying GEPs.
4 ; In this test case the transformation is invalid because it replaces the
5 ; reference to the symbol "b" (which refers to whichever instance of "b"
6 ; was chosen by the linker) with a reference to "a" (which refers to the
7 ; specific instance of "b" in this module).
9 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-unknown-linux-gnu"
12 @a = internal global [3 x ptr] zeroinitializer
13 @b = linkonce_odr alias [3 x ptr], ptr @a
16 ; CHECK-LABEL: define ptr @f() {
17 ; CHECK-NEXT: ret ptr getelementptr (i8, ptr @b, i64 8)
19 ret ptr getelementptr ([3 x ptr], ptr @b, i64 0, i64 1)