[llvm-dev] Question about reg2mem

Alvin Ye via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 5 02:18:13 PST 2018


Greetings,

Lately I have been experimenting on using Obfuscator-llvm on swiftc
bitcode file. During the process of applying the Bogus Control Flow
function pass I encountered the following error:

swifterror value should be the second operand when used by stores
  %33 = alloca swifterror %swift.error*, align 8
  store %swift.error** %33, %swift.error*** %.reg2mem21
swifterror argument should come from an alloca or parameter
  %.reload25 = load volatile %swift.error**, %swift.error*** %.reg2mem21
  call swiftcc void %42(%swift.opaque* noalias nocapture nonnull sret
%.reload33, %swift.refcounted* swiftself %1, %swift.error** nocapture
nonnull swifterror %.reload25)
LLVM ERROR: Broken function found, compilation aborted!

I understand the cause of the error and disabled the demoteToStack()
function(invokes DemoteRegToStack() and DemotePHIToStack()) at the
very end of the bcf function pass. Doing so resolved the issuse, but
I'm not certain of the functinality of thoses two demote functions and
the consequence of not using them. I tried to search for information
regarding reg2mem, but couldn't find any detailed explaination. It
would be much appreciated if someone could elaborate on this or point
me to the right direction.

Sincerely,
Alvin


More information about the llvm-dev mailing list