[LLVMbugs] [Bug 24325] New: Compiler generating an unnecessary volatile load
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 30 17:58:46 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24325
Bug ID: 24325
Summary: Compiler generating an unnecessary volatile load
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: douglas_yung at playstation.sony.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
This bug was found when trying to modify the clang lit test
CodeGenCXX\volatile.cpp to work when the compiler is in c++11 mode.
The repro is as follows:
volatile int *x;
void test() {
*x;
}
If you compile the code with trunk (I am using r242449) and give the option "-S
-emit-llvm", you get the following:
@x = global i32* null, align 8
; Function Attrs: nounwind uwtable
define void @_Z4testv() #0 {
entry:
%0 = load i32*, i32** @x, align 8
ret void
}
However if you also add the switch "-std=c++11", the code generated is the
following:
@x = global i32* null, align 8
; Function Attrs: nounwind uwtable
define void @_Z4testv() #0 {
entry:
%0 = load i32*, i32** @x, align 8
%1 = load volatile i32, i32* %0, align 4
ret void
}
Note that there is an extra load volatile that is generated in this case.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150731/3b015325/attachment.html>
More information about the llvm-bugs
mailing list