Skip to content

opt -O2 generates different results #11825

@llvmbot

Description

@llvmbot
Bugzilla Link 11453
Resolution INVALID
Resolved on Jan 27, 2014 16:08
Version trunk
OS Linux
Attachments Test program to reproduce the bug, Test program llvm/llvm-project#374 to reproduce the bug
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

  1. On ARM, the output of the attached programs is:
    Min is negative
    Min is negative
    Min is negative
    Min is negative

  2. But if "-O2" is used, on ARM the binary generates different results:
    Min is negative
    Min is negative
    Min is negative
    Min is NOT negative

To reproduce "1" above, please do:
A. cpp to ll
~/llvmUpstream/Release+Asserts/bin/clang -o lib.ll -S -emit-llvm lib.cpp
B. ll to bc
~/llvmUpstream/Release+Asserts/bin/llvm-as -o=lib.bc lib.ll
C. bc to o
~/llvmUpstream/Release+Asserts/bin/llc -relocation-model=pic -o=lib.o -filetype=obj -mtriple=armv7-none-linux-gnueabi -mattr=+v7 -float-abi=soft ./lib.bc
D. o to so
/Android/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-ld -soname libtest.so -L /Android/out/target/product/maguro/system/lib -lc -shared --no-undefined --fix-cortex-a8 -rpath-link=/Android/out/target/product/maguro/system/lib -rpath=/Android/out/target/product/maguro/system/lib -freloc=PIC -o ./libtest.so ./lib.o ~/Android/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a

To reproduce "2" above, please insert Step B1 and B2 while issuing the commands A-D above.

B1. Use opt with -O2. bc to bc.
~/llvmUpstream/Release+Asserts/bin/opt -o=lib.opt.bc -O2 lib.bc
B2. mv lib.opt.bc lib.bc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillainvalidResolved as invalid, i.e. not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions